diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3ddabe..068fec1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,54 +25,24 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 9 - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + cache: 'npm' - name: Install dependencies - run: pnpm install --frozen-lockfile + run: npm ci - name: Type check - run: pnpm run type-check - - - name: Build all packages - run: pnpm run build - - - name: Run basic example - run: pnpm run example:basic - - - name: Run e-commerce example - run: pnpm run example:ecommerce - - - name: Run blog example - run: pnpm run example:blog + run: npm run type-check - - name: Run CRM example - run: pnpm run example:crm + - name: Build + run: npm run build - - name: Run comprehensive CRM example - run: pnpm run example:crm-comprehensive + - name: Run example + run: npm run example - name: Archive build artifacts if: matrix.node-version == '20.x' uses: actions/upload-artifact@v4 with: name: dist - path: | - packages/*/dist + path: dist/ retention-days: 7 diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index ca0ae65..e9ad288 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -19,35 +19,21 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20.x' - - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 9 - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + cache: 'npm' - name: Install dependencies - run: pnpm install --frozen-lockfile + run: npm ci + + - name: Type check + run: npm run type-check - - name: Type check all packages - run: pnpm run type-check + - name: Build + run: npm run build - name: Check for TypeScript errors run: | echo "Checking for TypeScript compilation errors..." - pnpm run build 2>&1 | tee build.log + npm run build 2>&1 | tee build.log if grep -i "error TS" build.log; then echo "TypeScript errors found!" exit 1 @@ -57,15 +43,16 @@ jobs: - name: Check package structure run: | echo "Verifying package structure..." - test -f packages/core/package.json || exit 1 - test -f packages/examples/package.json || exit 1 - test -d packages/core/src || exit 1 - test -d packages/examples/src || exit 1 + test -f package.json || exit 1 + test -f tsconfig.json || exit 1 + test -d src || exit 1 + test -f src/objectstack.config.ts || exit 1 + test -d src/objects || exit 1 + test -d src/views || exit 1 echo "Package structure verified." - - name: Verify examples can run + - name: Verify example can run run: | - echo "Testing if examples can execute..." - pnpm run build - pnpm run example:basic - echo "Examples verified successfully." + echo "Testing if example can execute..." + npm run example + echo "Example verified successfully." diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f8e8b84..0b3ce01 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,38 +23,20 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20.x' - - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 9 - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v4 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + cache: 'npm' - name: Install dependencies - run: pnpm install --frozen-lockfile + run: npm ci - - name: Build all packages - run: pnpm run build + - name: Build + run: npm run build - name: Create Release uses: softprops/action-gh-release@v2 with: generate_release_notes: true files: | - packages/*/package.json + package.json README.md - CRM_DOCUMENTATION.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index a17d888..9477021 100644 --- a/.gitignore +++ b/.gitignore @@ -1,48 +1,37 @@ # Dependencies node_modules/ -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* +pnpm-lock.yaml package-lock.json yarn.lock # Build outputs dist/ -build/ *.tsbuildinfo -# TypeScript build artifacts in root (if any) -/*.js -/*.js.map -/*.d.ts -/*.d.ts.map - # Environment files .env .env.local .env.*.local -# IDE -.vscode/ +# Editor directories and files +.vscode/* +!.vscode/extensions.json +!.vscode/settings.json .idea/ *.swp *.swo *~ - -# OS .DS_Store -Thumbs.db # Logs logs/ *.log +npm-debug.log* +pnpm-debug.log* -# Test coverage +# Testing coverage/ -.nyc_output/ # Temporary files -tmp/ -temp/ *.tmp +.temp/ diff --git a/CRM_DOCUMENTATION.md b/CRM_DOCUMENTATION.md deleted file mode 100644 index f9a6d1b..0000000 --- a/CRM_DOCUMENTATION.md +++ /dev/null @@ -1,391 +0,0 @@ -# Comprehensive CRM System Documentation - -## Overview - -This ObjectStack CRM system implements all core modules following industry best practices and protocol specifications. It provides a complete customer relationship management solution with 11 objects and 12 views. - -## Architecture - -### Core Modules - -#### 1. Lead Management -**Object:** `lead` -**Purpose:** Capture and qualify potential customers before conversion - -**Key Features:** -- Lead source tracking (Web, Referral, Cold Call, Partner, Event, Social Media, Email Campaign, Advertisement) -- Lead status workflow (New → Contacted → Qualified/Unqualified → Converted) -- Rating system (Hot, Warm, Cold) -- Conversion tracking to Account, Contact, and Opportunity -- Full address information -- Company details and revenue tracking - -**Fields:** 24 fields including first_name, last_name, company, email, phone, mobile, lead_source, lead_status, rating, industry, annual_revenue, employee_count, and conversion references. - -#### 2. Account Management -**Object:** `account` -**Purpose:** Manage business accounts and companies - -**Key Features:** -- Industry classification -- Account type (Customer, Prospect, Partner, Competitor) -- Revenue and employee tracking -- Billing and shipping addresses -- Website and contact information - -**Fields:** 11 fields including name, account_number, industry, type, annual_revenue, employee_count, website, phone, addresses. - -#### 3. Contact Management (Enhanced) -**Object:** `contact` -**Purpose:** Manage individual contacts linked to accounts - -**Key Features:** -- Account relationship (lookup to account object) -- Multiple contact methods (email, phone, mobile) -- Contact type classification -- Active status tracking - -**Fields:** 10 fields including first_name, last_name, email, phone, mobile, account (lookup), company, title, contact_type, is_active. - -#### 4. Opportunity Management -**Object:** `opportunity` -**Purpose:** Track sales opportunities through pipeline - -**Key Features:** -- Account relationship -- 6-stage sales pipeline (Prospecting → Qualification → Proposal → Negotiation → Closed Won/Lost) -- Amount and probability tracking -- Lead source attribution -- Owner assignment -- Expected and actual close dates - -**Fields:** 11 fields including name, account, stage, amount, probability, expected_close_date, actual_close_date, lead_source, owner, description, next_step. - -#### 5. Case/Support Management -**Object:** `case` -**Purpose:** Handle customer support tickets and issues - -**Key Features:** -- Status workflow (New → In Progress → Waiting → Escalated → Resolved → Closed) -- Priority levels (Low, Medium, High, Critical) -- Case type classification (Question, Problem, Feature Request, Bug, Refund) -- Origin tracking (Email, Phone, Web, Chat, Social Media) -- SLA violation tracking -- Resolution tracking - -**Fields:** 16 fields including case_number, subject, description, status, priority, type, origin, account, contact, product, owner, resolution, dates, sla_violation. - -#### 6. Campaign Management -**Object:** `campaign` -**Purpose:** Plan and track marketing campaigns - -**Key Features:** -- Campaign type (Email, Webinar, Conference, Trade Show, Advertisement, Direct Mail, Social Media) -- Status workflow (Planned → In Progress → Completed → Aborted) -- Budget and cost tracking -- Expected vs. actual revenue -- Response and conversion tracking -- Parent campaign hierarchy - -**Fields:** 16 fields including name, campaign_type, status, start_date, end_date, budget, actual_cost, expected_revenue, response metrics, parent_campaign. - -#### 7. Quote Management -**Object:** `quote` -**Purpose:** Generate sales quotes and proposals - -**Key Features:** -- Quote numbering system -- Opportunity and account relationships -- Status workflow (Draft → Sent → Accepted → Rejected → Expired) -- Financial calculations (subtotal, tax, discount, total) -- Payment terms -- Shipping methods -- Billing and shipping addresses -- Validity period - -**Fields:** 19 fields including quote_number, name, opportunity, account, contact, status, financial fields, dates, addresses, terms. - -#### 8. Contract Management -**Object:** `contract` -**Purpose:** Manage contracts and agreements - -**Key Features:** -- Contract numbering system -- Account relationship -- Status workflow (Draft → In Review → Approved → Active → Expired → Terminated) -- Contract type (Service Agreement, Subscription, License, Partnership, NDA, SLA) -- Auto-renewal support -- Term and notice period tracking -- Billing frequency options -- Payment terms - -**Fields:** 16 fields including contract_number, contract_name, account, status, contract_type, dates, auto_renew, billing details, payment terms. - -#### 9. Activity Management -**Objects:** `activity_task`, `event`, `call` -**Purpose:** Track all customer-related activities - -##### Task Object -**Features:** -- Status workflow (Not Started → In Progress → Completed → Deferred → Waiting) -- Priority levels (Low, Medium, High) -- Due dates and reminders -- Assignment tracking -- Related record linkage - -**Fields:** 9 fields including subject, description, status, priority, due_date, reminder_date, assigned_to, related_to. - -##### Event Object -**Features:** -- Event types (Meeting, Call, Demo, Presentation, Conference, Training) -- Date/time range tracking -- All-day event support -- Location tracking -- Reminder settings -- Organizer assignment - -**Fields:** 11 fields including subject, description, location, start/end datetime, all_day_event, event_type, organizer, reminder. - -##### Call Object -**Features:** -- Call type (Inbound, Outbound) -- Purpose tracking (Prospecting, Follow Up, Demo, Support, Negotiation) -- Duration tracking -- Result tracking (Connected, Voicemail, No Answer, Busy, Wrong Number) -- Call logging - -**Fields:** 10 fields including subject, call_type, call_purpose, call_duration, call_datetime, call_result, description, caller. - -## Object Relationships - -### Complete Relationship Map - -``` -Campaign → Lead (Lead generation) -Lead → Account (Conversion) -Lead → Contact (Conversion) -Lead → Opportunity (Conversion) - -Account ← Contact (Many-to-One) -Account ← Opportunity (One-to-Many) -Account ← Case (One-to-Many) -Account ← Quote (One-to-Many) -Account ← Contract (One-to-Many) - -Opportunity → Account (Many-to-One) -Opportunity → Quote (One-to-Many) - -Quote → Opportunity (Many-to-One) -Quote → Account (Many-to-One) -Quote → Contact (Many-to-One) - -Contract → Account (Many-to-One) - -Case → Account (Many-to-One) -Case → Contact (Many-to-One) -Case → Product (Many-to-One) - -Activity_Task → Related Records (Polymorphic) -Event → Related Records (Polymorphic) -Call → Related Records (Polymorphic) -``` - -## User Interface Views - -### Grid Views (10) -1. **Lead List** - Manage all leads with status, rating, and source -2. **Account List** - View all accounts with industry and revenue -3. **Opportunity List** - Track opportunities with stage and amount -4. **Case List** - Support ticket management with priority and status -5. **Campaign List** - Marketing campaign tracking with metrics -6. **Quote List** - Quote management with status and amounts -7. **Contract List** - Contract tracking with dates and values -8. **Task List** - Task management with assignments and due dates -9. **Event List** - Event calendar with dates and organizers -10. **Call List** - Call log with types and results - -### Kanban Views (2) -1. **Lead Pipeline** - Visual lead progression through status stages -2. **Sales Pipeline** - Visual opportunity progression through sales stages - -## Standard Workflows - -### 1. Lead-to-Cash Process -``` -Marketing Campaign - ↓ -Lead Creation (from campaign) - ↓ -Lead Qualification - ↓ -Lead Conversion → Account + Contact + Opportunity - ↓ -Opportunity Development - ↓ -Quote Generation - ↓ -Quote Acceptance - ↓ -Contract Creation - ↓ -Opportunity Closed Won - ↓ -Revenue Recognition -``` - -### 2. Customer Support Workflow -``` -Customer Contact (Email/Phone/Web/Chat) - ↓ -Case Creation - ↓ -Case Assignment to Agent - ↓ -Investigation & Resolution - ↓ -Customer Communication - ↓ -Resolution Approval - ↓ -Case Closure - ↓ -Customer Satisfaction Survey -``` - -### 3. Sales Opportunity Workflow -``` -Lead Qualification - ↓ -Opportunity Creation (Prospecting) - ↓ -Discovery & Qualification - ↓ -Proposal & Quote - ↓ -Negotiation - ↓ -Closed Won → Contract -or -Closed Lost → Analysis -``` - -## Technical Features - -### Data Protocol Compliance -- All objects follow ObjectStack Data Protocol (ObjectQL) -- Proper field type definitions -- Required field validations -- Unique constraints on key identifiers -- Lookup relationships with proper references - -### Enabled Capabilities -- ✅ **API Enabled** - RESTful API support for all objects -- ✅ **History Tracking** - Complete audit trail -- ✅ **Searchable** - Global search across all objects -- ✅ **Lookup Relationships** - Proper foreign key relationships -- ✅ **Status Workflows** - State management -- ✅ **Field Validation** - Required and unique constraints - -### UI Protocol Compliance -- All views follow ObjectStack UI Protocol (ObjectUI) -- Grid view type for list management -- Kanban view type for visual pipeline management -- Proper column definitions with widths -- Data provider configuration - -## Statistics - -- **Total Objects**: 11 - - Lead, Account, Contact, Opportunity, Case, Campaign, Quote, Contract, Task, Event, Call - -- **Total Views**: 12 - - 10 Grid views, 2 Kanban views - -- **Total Fields**: 143 fields across all objects - -- **Relationship Count**: 15+ lookup relationships - -## Best Practices Implemented - -### 1. Data Integrity -- Unique constraints on key identifiers (email, account_number, case_number, quote_number, contract_number) -- Required fields for critical data -- Proper field types (email, phone, url, date, datetime, decimal, number) - -### 2. User Experience -- Status workflows for process guidance -- Priority and rating systems -- Calendar and datetime tracking -- Address management -- Notes and description fields - -### 3. Business Intelligence -- Financial tracking (revenue, budget, costs, amounts) -- Performance metrics (response rates, conversion rates) -- Pipeline visibility -- Activity logging - -### 4. Integration Ready -- API enabled on all objects -- Lookup relationships for data consistency -- History tracking for auditing -- Searchable fields for findability - -## Usage Examples - -### Running the CRM Examples - -```bash -# Basic CRM example (Account and Opportunity only) -npm run example:crm - -# Comprehensive CRM example (All modules) -npm run example:crm-comprehensive -``` - -### Sample Output - -The comprehensive CRM example displays: -- All 11 core modules -- Object relationships -- Available views -- Enabled features -- Industry best practices -- Sample workflows -- Complete statistics - -## Extension Points - -### Adding New Objects -1. Create object definition in `packages/examples/src/data/` -2. Export from `packages/examples/src/index.ts` -3. Add relationships to existing objects as needed - -### Adding New Views -1. Create view definition in `packages/examples/src/ui/` -2. Export from `packages/examples/src/index.ts` -3. Reference in example files - -### Customizing Workflows -- Modify status options in select fields -- Add new stages to pipelines -- Create custom field validations -- Define business rules - -## Compliance & Security - -### Protocol Compliance -- ✅ ObjectStack Data Protocol v0.3.3 -- ✅ ObjectStack UI Protocol v0.3.3 -- ✅ Snake_case for machine names -- ✅ CamelCase for configuration keys - -### Security -- ✅ CodeQL analysis passed with 0 alerts -- ✅ No security vulnerabilities detected -- ✅ Unique constraints prevent duplicate data -- ✅ Required fields ensure data completeness - -## Conclusion - -This comprehensive CRM system provides a production-ready foundation for customer relationship management following industry best practices. All core modules are implemented with proper relationships, workflows, and validation rules, ready for customization and extension based on specific business needs. diff --git a/README.md b/README.md index 214c651..1369de2 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# ObjectStack Starter Template +# ObjectStack Plugin Starter Template -A multi-package starter template for building [ObjectStack](https://objectstack.ai) applications. This monorepo demonstrates the structure and conventions for creating metadata-driven low-code applications using the ObjectStack framework, with multiple examples covering different use cases. +A minimal starter template for creating [ObjectStack](https://objectstack.ai) plugins. This template provides a clean foundation for building plugins that extend ObjectStack with custom objects, views, and functionality. -[![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue.svg)](https://www.typescriptlang.org/) -[![ObjectStack Spec](https://img.shields.io/badge/@objectstack/spec-0.3.3-green.svg)](https://www.npmjs.com/package/@objectstack/spec) +[![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue.svg)](https://www.typescriptlang.org/) +[![ObjectStack Spec](https://img.shields.io/badge/@objectstack/spec-0.8.2-green.svg)](https://www.npmjs.com/package/@objectstack/spec) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ## 🚀 Quick Start @@ -11,190 +11,88 @@ A multi-package starter template for building [ObjectStack](https://objectstack. ### Installation ```bash -# Clone this repository -git clone https://github.com/objectstack-ai/objectstack-starter.git -cd objectstack-starter +# Clone this template +git clone https://github.com/objectstack-ai/objectstack-starter.git my-plugin +cd my-plugin -# Install dependencies (installs all workspace packages) -pnpm install +# Install dependencies +npm install -# Build all packages -pnpm run build -``` - -### Running Examples - -This template includes multiple example applications demonstrating different use cases: - -```bash -# Run the basic example (core objects) -pnpm run example:basic - -# Run the e-commerce example -pnpm run example:ecommerce +# Build the plugin +npm run build -# Run the blog example -pnpm run example:blog - -# Run the CRM example -pnpm run example:crm - -# Run the comprehensive CRM example (All core modules) -pnpm run example:crm-comprehensive -``` - -### Development - -```bash -# Watch mode - automatically rebuild all packages on changes -pnpm run dev - -# Build specific package -pnpm run build:core -pnpm run build:examples - -# Type checking -pnpm run type-check - -# Clean build artifacts -pnpm run clean +# Run the example +npm run example ``` ## 📦 What's Included -This starter template is organized as a monorepo with multiple packages: - -### Package: @objectstack-starter/core +This starter template includes: -Core package with base objects and views: +- **Plugin Configuration** (`src/objectstack.config.ts`) - Define your plugin metadata +- **Example Object** (`src/objects/example.object.ts`) - Sample data object definition +- **Example Views** (`src/views/example.view.ts`) - Sample list and kanban views +- **TypeScript Configuration** - Properly configured for ObjectStack development +- **Build Scripts** - Ready-to-use development and build commands -**Data Objects:** -- **Project Task** - Task management with status, priority, assignments, and time tracking -- **Contact** - Contact management with CRM capabilities - -**UI Views:** -- Task list view (grid) -- Task kanban board -- Contact list view (grid) -- Main app definition - -### Package: @objectstack-starter/examples - -Example applications demonstrating different use cases: - -**E-commerce:** -- Product object - Product catalog management -- Order object - Order processing and tracking -- Product and order list views +## 🏗️ Project Structure -**Blog:** -- Blog Post object - Content management -- Author object - Author management -- Blog post and author list views +``` +objectstack-starter/ +├── src/ +│ ├── objectstack.config.ts # Plugin configuration +│ ├── objects/ # Data object definitions +│ │ └── example.object.ts +│ ├── views/ # UI view definitions +│ │ └── example.view.ts +│ ├── index.ts # Main entry point +│ └── example.ts # Usage example +├── package.json +├── tsconfig.json +└── README.md +``` -**CRM (Comprehensive - All Core Modules):** -- **Lead Management** - Lead object with qualification and conversion tracking -- **Account Management** - Account object for business account management -- **Opportunity Management** - Opportunity object for sales pipeline tracking -- **Contact Management** - Enhanced Contact object linked to accounts -- **Case/Support Management** - Case object for customer support tickets -- **Campaign Management** - Campaign object for marketing campaigns -- **Quote Management** - Quote object for sales quotes and proposals -- **Contract Management** - Contract object for agreements and subscriptions -- **Activity Management** - Task, Event, and Call objects for activity tracking -- 12 Views including list and kanban boards for all objects +## 📚 Core Concepts -### Configuration +### Plugin Configuration -- `package.json` - Workspace configuration -- `packages/*/tsconfig.json` - TypeScript configuration per package -- `packages/*/package.json` - Package dependencies and scripts +Define your plugin's metadata in `src/objectstack.config.ts`: -## 🏗️ Project Structure +```typescript +import type { System } from '@objectstack/spec'; +export const config: System.ObjectStackManifest = { + id: 'my-plugin', + name: 'my-plugin', + version: '0.1.0', + type: 'plugin', + description: 'Description of your plugin' +}; ``` -objectstack-starter/ # Monorepo root -├── packages/ -│ ├── core/ # @objectstack-starter/core -│ │ ├── src/ -│ │ │ ├── data/ # Core data objects -│ │ │ │ ├── project-task.object.ts -│ │ │ │ └── contact.object.ts -│ │ │ ├── ui/ # Core UI views -│ │ │ │ ├── task.view.ts -│ │ │ │ ├── contact.view.ts -│ │ │ │ └── app.ts -│ │ │ ├── objectstack.config.ts -│ │ │ ├── example.ts -│ │ │ └── index.ts -│ │ ├── package.json -│ │ ├── tsconfig.json -│ │ └── README.md -│ │ -│ └── examples/ # @objectstack-starter/examples -│ ├── src/ -│ │ ├── data/ # Example data objects -│ │ │ ├── product.object.ts # E-commerce -│ │ │ ├── order.object.ts # E-commerce -│ │ │ ├── blog-post.object.ts # Blog -│ │ │ ├── author.object.ts # Blog -│ │ │ ├── account.object.ts # CRM -│ │ │ ├── opportunity.object.ts # CRM -│ │ │ ├── lead.object.ts # CRM -│ │ │ ├── case.object.ts # CRM -│ │ │ ├── campaign.object.ts # CRM -│ │ │ ├── quote.object.ts # CRM -│ │ │ ├── contract.object.ts # CRM -│ │ │ └── activity.object.ts # CRM (Task, Event, Call) -│ │ ├── ui/ # Example UI views -│ │ │ ├── ecommerce.view.ts -│ │ │ ├── blog.view.ts -│ │ │ ├── crm.view.ts -│ │ │ └── crm-extended.view.ts -│ │ ├── basic-example.ts -│ │ ├── ecommerce-example.ts -│ │ ├── blog-example.ts -│ │ ├── crm-example.ts -│ │ ├── crm-comprehensive-example.ts -│ │ └── index.ts -│ ├── package.json -│ ├── tsconfig.json -│ └── README.md -│ -├── package.json # Workspace root configuration -└── README.md # This file -``` - -## 📚 ObjectStack Concepts -### Data Protocol (ObjectQL) +### Data Objects -Define your data structures using the ObjectStack Data Protocol: +Define data structures in `src/objects/`: ```typescript -import type { Data } from '@objectstack/spec'; +import { Data } from '@objectstack/spec'; -export const myObject: Data.ObjectDefinition = { - name: 'my_object', // snake_case for machine names +export const myObject = Data.ObjectSchema.create({ + name: 'my_object', // snake_case for machine names label: 'My Object', fields: { - my_field: { - name: 'my_field', - label: 'My Field', + name: { type: 'text', + label: 'Name', required: true } - }, - enable: { - apiEnabled: true, - trackHistory: true } -}; +}); ``` -### UI Protocol (ObjectUI) +### UI Views -Define views for your data: +Define how data is displayed in `src/views/`: ```typescript import type { UI } from '@objectstack/spec'; @@ -203,31 +101,13 @@ export const myListView: UI.ListView = { name: 'my_list', label: 'My List', type: 'grid', - object: 'my_object', columns: [ - { field: 'my_field', width: 200 } - ] -}; -``` - -### System Protocol (ObjectOS) - -Configure your application: - -```typescript -import type { System } from '@objectstack/spec'; - -export const config: System.Manifest = { - name: 'my-app', - type: 'app', - displayName: 'My Application', - navigation: [ - { - type: 'object', - object: 'my_object', - label: 'My Objects' - } - ] + { field: 'name', label: 'Name', width: 200 } + ], + data: { + provider: 'object', + object: 'my_object' + } }; ``` @@ -236,130 +116,110 @@ export const config: System.Manifest = { ObjectStack follows strict naming conventions: - **Configuration Keys** (TypeScript properties): `camelCase` - - Example: `maxLength`, `defaultValue`, `referenceFilters` + - Example: `maxLength`, `defaultValue`, `trackHistory` - **Machine Names** (data values): `snake_case` - - Example: `project_task`, `first_name`, `my_object` + - Example: `my_object`, `first_name`, `example_field` -## 📖 Learn More +## 🛠️ Development -- [ObjectStack Spec](https://www.npmjs.com/package/@objectstack/spec) - The protocol specification -- [ObjectStack Documentation](https://objectstack.ai) - Full documentation -- [ObjectStack GitHub](https://github.com/objectstack-ai) - Source code and examples +### Available Scripts -## 🤝 Contributing +- `npm run build` - Build the plugin +- `npm run dev` - Watch mode for development +- `npm run clean` - Remove build artifacts +- `npm run type-check` - Type check without emitting files +- `npm run example` - Run the example usage -Contributions are welcome! Please feel free to submit a Pull Request. +### Adding a New Object -## 📄 License +1. Create a new file in `src/objects/` (e.g., `my-object.object.ts`) +2. Define your object using `Data.ObjectSchema.create()` +3. Export it from `src/index.ts` + +### Adding a New View -This project is licensed under the MIT License - see the LICENSE file for details. - -## 🤖 Automation & CI/CD - -This repository includes comprehensive automation workflows: - -### Continuous Integration (CI) -- **CI Workflow** (`.github/workflows/ci.yml`) - - Runs on push to `main` and `develop` branches - - Tests on Node.js 18.x and 20.x - - Type checking with TypeScript - - Builds all packages - - Runs all example scripts to validate functionality - - Archives build artifacts - -### Code Quality -- **Code Quality Workflow** (`.github/workflows/code-quality.yml`) - - Runs on pull requests - - Type checking - - Build validation - - Package structure verification - - Example execution tests - -### Release Management -- **Release Workflow** (`.github/workflows/release.yml`) - - Triggered on version tags (e.g., `v1.0.0`) - - Automated builds - - GitHub release creation with auto-generated notes - - Attaches relevant files to releases - -### Dependency Management -- **Dependabot** (`.github/dependabot.yml`) - - Automated dependency updates - - Weekly checks for npm packages and GitHub Actions - - Separate configurations for root, core, and examples packages - - Auto-assigns PRs to maintainers - -### Repository Automation -- **Auto-assign** (`.github/workflows/auto-assign.yml`) - Automatically assigns issues and PRs -- **Auto-label** (`.github/workflows/auto-label.yml`) - Labels PRs based on changed files -- **Stale Management** (`.github/workflows/stale.yml`) - Closes inactive issues and PRs -- **Proof HTML** (`.github/workflows/proof-html.yml`) - Validates HTML content - -## 🌟 Features - -- ✅ Monorepo structure with pnpm workspaces -- ✅ Multiple packages: core and examples -- ✅ TypeScript support with strict type checking -- ✅ Based on the latest @objectstack/spec (v0.3.3) -- ✅ **Automated CI/CD workflows** with GitHub Actions -- ✅ **Automated dependency updates** with Dependabot -- ✅ **Code quality checks** on pull requests -- ✅ Core objects: Task and Contact management -- ✅ E-commerce example: Product and Order management -- ✅ Blog example: Post and Author management -- ✅ **Comprehensive CRM example**: Complete CRM system with all core modules - - Lead Management with qualification workflow - - Account & Contact Management with relationships - - Opportunity Management with sales pipeline - - Case/Support Management for customer service - - Campaign Management for marketing - - Quote & Contract Management for sales - - Activity Tracking (Tasks, Events, Calls) - - 11 CRM objects with 12 views -- ✅ Multiple view types (grid and kanban) -- ✅ Proper project structure and configuration -- ✅ Ready to extend with AI, API, and System protocols - -## 🔧 Extending This Template - -### Adding a New Object to Core Package - -1. Create a new file in `packages/core/src/data/` (e.g., `account.object.ts`) -2. Define your object following the Data Protocol -3. Export it from `packages/core/src/index.ts` -4. Add navigation for it in `packages/core/src/objectstack.config.ts` - -### Adding a New View to Core Package - -1. Create a new file in `packages/core/src/ui/` (e.g., `account.view.ts`) +1. Create a new file in `src/views/` (e.g., `my-object.view.ts`) 2. Define your view following the UI Protocol -3. Export it from `packages/core/src/index.ts` +3. Export it from `src/index.ts` + +## 📖 ObjectStack Protocols + +This starter template uses the ObjectStack Protocol Specification: + +- **Data Protocol** - Define data structures and relationships +- **UI Protocol** - Define user interface views +- **System Protocol** - Define plugin configuration and metadata + +## 🔧 Customization + +### 1. Update Plugin Metadata + +Edit `src/objectstack.config.ts` to set your plugin's ID, name, version, and description. + +### 2. Create Your Objects + +Replace or extend `src/objects/example.object.ts` with your own object definitions. -### Creating a New Example Package +### 3. Create Your Views -1. Create a new directory in `packages/` (e.g., `packages/my-example`) -2. Add `package.json` with dependencies -3. Create `src/` directory with objects and views -4. Add example runner files -5. Update workspace configuration in root `package.json` +Replace or extend `src/views/example.view.ts` with your own view definitions. -### Adding More Examples to Examples Package +### 4. Export Your Definitions -1. Create new object files in `packages/examples/src/data/` -2. Create corresponding view files in `packages/examples/src/ui/` -3. Create example runner file (e.g., `my-example.ts`) -4. Export from `packages/examples/src/index.ts` -5. Add script to `packages/examples/package.json` +Make sure to export all your objects and views in `src/index.ts`. + +## 📦 Building and Publishing + +### Build for Distribution + +```bash +npm run build +``` + +This creates a `dist/` directory with compiled JavaScript and TypeScript definitions. + +### Publish to npm + +```bash +npm publish +``` + +Make sure to update `package.json` with your plugin details before publishing. + +## 🤝 Integration with ObjectStack + +Once built, your plugin can be: + +1. **Imported** in other ObjectStack applications +2. **Registered** with an ObjectStack runtime +3. **Used** to extend ObjectStack functionality + +Example integration: + +```typescript +import myPlugin from '@your-org/my-plugin'; + +// Use in ObjectStack application +``` + +## 📖 Learn More + +- [ObjectStack Spec](https://www.npmjs.com/package/@objectstack/spec) - Protocol specification +- [ObjectStack Documentation](https://objectstack.ai) - Full documentation +- [ObjectStack GitHub](https://github.com/objectstack-ai) - Source code and examples +- [Writing Plugins Guide](https://protocol.objectstack.ai/docs/developers/writing-plugins) - Official plugin development guide ## 💡 Tips -- Use the TypeScript language server for IntelliSense and type checking -- Refer to the `@objectstack/spec` package for the complete protocol reference - Follow the naming conventions strictly (camelCase for config, snake_case for data) -- Enable capabilities like `trackHistory` and `apiEnabled` as needed -- Use the `prompts/` directory in `@objectstack/spec` for AI context +- Use the TypeScript language server for IntelliSense and type checking +- Use `Data.ObjectSchema.create()` for creating objects with proper type inference +- Keep your plugin focused on a specific domain or functionality + +## 📄 License + +MIT --- Built with ❤️ using [ObjectStack](https://objectstack.ai) - diff --git a/package.json b/package.json index ba88b35..844e9eb 100644 --- a/package.json +++ b/package.json @@ -1,35 +1,38 @@ { - "name": "objectstack-starter", + "name": "@objectstack/starter-plugin", "version": "0.1.0", - "description": "ObjectStack Starter Template - A metadata-driven low-code platform starter (Multi-package Monorepo)", + "description": "ObjectStack Plugin Starter Template - A minimal template for creating ObjectStack plugins", "type": "module", - "private": true, + "main": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { - "build": "pnpm -r run build", - "build:core": "pnpm --filter @objectstack-starter/core run build", - "build:examples": "pnpm --filter @objectstack-starter/examples run build", - "dev": "pnpm -r run dev", - "clean": "pnpm -r run clean", - "type-check": "pnpm -r run type-check", - "example:basic": "pnpm --filter @objectstack-starter/examples run example:basic", - "example:ecommerce": "pnpm --filter @objectstack-starter/examples run example:ecommerce", - "example:blog": "pnpm --filter @objectstack-starter/examples run example:blog", - "example:crm": "pnpm --filter @objectstack-starter/examples run example:crm", - "example:crm-comprehensive": "pnpm --filter @objectstack-starter/examples run example:crm-comprehensive" + "build": "tsc", + "dev": "tsc --watch", + "clean": "rm -rf dist", + "type-check": "tsc --noEmit", + "example": "node dist/example.js" + }, + "dependencies": { + "@objectstack/spec": "^0.8.2" }, "devDependencies": { "@types/node": "^25.0.10", - "typescript": "^5.3.0" + "typescript": "^5.9.0" }, "engines": { "node": ">=18.0.0" }, "keywords": [ "objectstack", - "low-code", - "metadata-driven", - "starter-template", - "monorepo" + "plugin", + "starter", + "template", + "low-code" ], - "license": "MIT" + "author": "", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/objectstack-ai/objectstack-starter.git" + } } diff --git a/packages/core/README.md b/packages/core/README.md deleted file mode 100644 index ecf92de..0000000 --- a/packages/core/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# @objectstack-starter/core - -Core package for ObjectStack Starter - includes base objects and views for task and contact management. - -## What's Included - -### Data Objects - -- **Project Task** (`project_task`) - Task management with status, priority, assignments, and time tracking -- **Contact** (`contact`) - Contact management with CRM capabilities - -### UI Views - -- **Task Views** - - Grid view for task lists - - Kanban board for visual task management -- **Contact Views** - - Grid view for contact management -- **App Definition** - Main application structure and navigation - -## Installation - -```bash -npm install @objectstack-starter/core -``` - -## Usage - -```typescript -import { - config, - projectTaskObject, - contactObject, - taskListView, - taskKanbanView, - contactListView, - mainApp -} from '@objectstack-starter/core'; - -console.log('Task Fields:', Object.keys(projectTaskObject.fields)); -console.log('Contact Fields:', Object.keys(contactObject.fields)); -``` - -## API - -### Exports - -- `config` - ObjectStack manifest configuration -- `projectTaskObject` - Project task data object definition -- `contactObject` - Contact data object definition -- `taskListView` - Task grid view definition -- `taskKanbanView` - Task kanban view definition -- `contactListView` - Contact grid view definition -- `mainApp` - Main application definition - -### Type Exports - -Re-exports all types from `@objectstack/spec`: -- `Data` - Data Protocol types -- `UI` - UI Protocol types -- `System` - System Protocol types -- `AI` - AI Protocol types -- `API` - API Protocol types - -## Development - -```bash -# Build the package -npm run build - -# Watch mode -npm run dev - -# Type checking -npm run type-check - -# Clean build artifacts -npm run clean -``` - -## License - -MIT diff --git a/packages/core/package.json b/packages/core/package.json deleted file mode 100644 index da3c9f5..0000000 --- a/packages/core/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@objectstack-starter/core", - "version": "0.1.0", - "description": "ObjectStack Starter Template - Core package with base objects and views", - "type": "module", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "tsc --build", - "dev": "tsc --build --watch", - "clean": "tsc --build --clean && rm -rf dist", - "type-check": "tsc --build --dry" - }, - "dependencies": { - "@objectstack/spec": "^0.3.3" - }, - "devDependencies": { - "@types/node": "^25.0.10", - "typescript": "^5.3.0" - }, - "engines": { - "node": ">=18.0.0" - }, - "keywords": [ - "objectstack", - "low-code", - "metadata-driven", - "core" - ], - "license": "MIT" -} diff --git a/packages/core/src/data/contact.object.ts b/packages/core/src/data/contact.object.ts deleted file mode 100644 index 2a757b8..0000000 --- a/packages/core/src/data/contact.object.ts +++ /dev/null @@ -1,107 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Contact Object - * Defines the schema for contact management - */ -export const contactObject = { - name: 'contact', - label: 'Contact', - pluralLabel: 'Contacts', - description: 'Contact management for customers and partners', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - first_name: { - name: 'first_name', - label: 'First Name', - type: 'text', - required: true - }, - - last_name: { - name: 'last_name', - label: 'Last Name', - type: 'text', - required: true - }, - - email: { - name: 'email', - label: 'Email', - type: 'email', - required: true, - unique: true - }, - - phone: { - name: 'phone', - label: 'Phone', - type: 'phone' - }, - - mobile: { - name: 'mobile', - label: 'Mobile', - type: 'phone' - }, - - account: { - name: 'account', - label: 'Account', - type: 'lookup', - reference: 'account', - description: 'Associated business account' - }, - - company: { - name: 'company', - label: 'Company', - type: 'text' - }, - - title: { - name: 'title', - label: 'Job Title', - type: 'text' - }, - - contact_type: { - name: 'contact_type', - label: 'Contact Type', - type: 'select', - defaultValue: 'customer', - options: [ - { label: 'Customer', value: 'customer' }, - { label: 'Partner', value: 'partner' }, - { label: 'Vendor', value: 'vendor' }, - { label: 'Other', value: 'other' } - ] - }, - - notes: { - name: 'notes', - label: 'Notes', - type: 'textarea' - }, - - is_active: { - name: 'is_active', - label: 'Active', - type: 'boolean', - defaultValue: true - } - }, - - // Enable capabilities - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default contactObject; diff --git a/packages/core/src/data/project-task.object.ts b/packages/core/src/data/project-task.object.ts deleted file mode 100644 index e6c5cbc..0000000 --- a/packages/core/src/data/project-task.object.ts +++ /dev/null @@ -1,87 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Project Task Object - * Defines the schema for project task management - */ -export const projectTaskObject = { - name: 'project_task', - label: 'Task', - pluralLabel: 'Tasks', - description: 'Project task management', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - name: { - name: 'name', - label: 'Task Name', - type: 'text', - required: true - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea' - }, - - status: { - name: 'status', - label: 'Status', - type: 'select', - required: true, - defaultValue: 'not_started', - options: [ - { label: 'Not Started', value: 'not_started' }, - { label: 'In Progress', value: 'in_progress' }, - { label: 'Completed', value: 'completed' }, - { label: 'Blocked', value: 'blocked' } - ] - }, - - priority: { - name: 'priority', - label: 'Priority', - type: 'select', - required: true, - defaultValue: 'medium', - options: [ - { label: 'Low', value: 'low' }, - { label: 'Medium', value: 'medium' }, - { label: 'High', value: 'high' }, - { label: 'Urgent', value: 'urgent' } - ] - }, - - assigned_to: { - name: 'assigned_to', - label: 'Assigned To', - type: 'lookup', - reference: 'user' - }, - - due_date: { - name: 'due_date', - label: 'Due Date', - type: 'date' - }, - - completed_date: { - name: 'completed_date', - label: 'Completed Date', - type: 'datetime' - } - }, - - // Enable capabilities - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default projectTaskObject; diff --git a/packages/core/src/example.ts b/packages/core/src/example.ts deleted file mode 100644 index f0d5087..0000000 --- a/packages/core/src/example.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Example Usage - * - * This file demonstrates how to use the ObjectStack starter template. - * It shows how to import and work with the defined objects and views. - */ - -import { - config, - projectTaskObject, - contactObject, - taskListView, - taskKanbanView, - contactListView, - mainApp -} from './index.js'; - -import type { Data, UI } from '@objectstack/spec'; - -// Example 1: Access the configuration -console.log('App Configuration:', config); -console.log('App Name:', config.name); -console.log('App Version:', config.version); - -// Example 2: Access object definitions -console.log('\nProject Task Object:', projectTaskObject.name); -console.log('Fields:', Object.keys(projectTaskObject.fields)); - -console.log('\nContact Object:', contactObject.name); -console.log('Fields:', Object.keys(contactObject.fields)); - -// Example 3: Access view definitions -console.log('\nTask List View:', taskListView.name); -console.log('View Type:', taskListView.type); -console.log('Data Provider:', taskListView.data?.provider); - -console.log('\nTask Kanban View:', taskKanbanView.name); -console.log('View Type:', taskKanbanView.type); - -// Example 4: Access app definition -console.log('\nMain App:', mainApp.name); -console.log('App Label:', mainApp.label); -console.log('Navigation Items:', mainApp.navigation?.length); - -// Example 5: Create a custom object using the same pattern -// Note: In real usage, you would define these in separate files like the examples -console.log('\nYou can create custom objects following the same pattern as the examples.'); - -// Example 6: Working with the spec types -console.log('\nThe starter template includes TypeScript types from @objectstack/spec'); -console.log('Available namespaces: Data, UI, System, AI, API'); - -console.log('\n✅ ObjectStack Starter Template loaded successfully!'); diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts deleted file mode 100644 index 1bab6b8..0000000 --- a/packages/core/src/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * ObjectStack Starter Template - * - * This is a starter template for building ObjectStack applications. - * It demonstrates the basic structure and conventions for defining - * data objects, UI views, and application configuration. - */ - -// Export configuration -export { default as config } from './objectstack.config.js'; - -// Export data objects -export { projectTaskObject } from './data/project-task.object.js'; -export { contactObject } from './data/contact.object.js'; - -// Export UI views -export { taskListView, taskKanbanView } from './ui/task.view.js'; -export { contactListView } from './ui/contact.view.js'; - -// Export app definition -export { mainApp } from './ui/app.js'; - -// Re-export types from @objectstack/spec for convenience -export type { Data, UI, System, AI, API } from '@objectstack/spec'; diff --git a/packages/core/src/objectstack.config.ts b/packages/core/src/objectstack.config.ts deleted file mode 100644 index e531c5e..0000000 --- a/packages/core/src/objectstack.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Kernel } from '@objectstack/spec'; - -/** - * ObjectStack Configuration - * This file defines the metadata and capabilities of this ObjectStack package. - */ -export const config = { - name: 'objectstack-starter', - version: '0.1.0', - type: 'app', - description: 'A starter template for building ObjectStack applications' -} as Kernel.ObjectStackManifest; - -export default config; diff --git a/packages/core/src/ui/app.ts b/packages/core/src/ui/app.ts deleted file mode 100644 index 639709a..0000000 --- a/packages/core/src/ui/app.ts +++ /dev/null @@ -1,47 +0,0 @@ -import type { UI } from '@objectstack/spec'; - -/** - * Main Application - * Defines the main application structure and navigation - */ -export const mainApp = { - name: 'main_app', - label: 'ObjectStack Starter', - description: 'Main application for the ObjectStack starter template', - - // Navigation menu structure - navigation: [ - { - type: 'group', - label: 'Work', - children: [ - { - type: 'object', - object: 'project_task', - label: 'Tasks', - icon: 'CheckSquare' - } - ] - }, - { - type: 'group', - label: 'CRM', - children: [ - { - type: 'object', - object: 'contact', - label: 'Contacts', - icon: 'Users' - } - ] - } - ], - - // Branding - branding: { - logo: '/logo.svg', - primaryColor: '#2563eb' - } -} as UI.App; - -export default mainApp; diff --git a/packages/core/src/ui/contact.view.ts b/packages/core/src/ui/contact.view.ts deleted file mode 100644 index 27cabeb..0000000 --- a/packages/core/src/ui/contact.view.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { UI } from '@objectstack/spec'; - -/** - * Contact List View - * Defines the grid view for contacts - */ -export const contactListView = { - name: 'contact_list', - label: 'All Contacts', - type: 'grid', - - // Data source configuration - data: { - provider: 'object', - object: 'contact' - }, - - // Columns to display - columns: [ - { field: 'first_name', width: 150 }, - { field: 'last_name', width: 150 }, - { field: 'email', width: 200 }, - { field: 'phone', width: 130 }, - { field: 'company', width: 180 }, - { field: 'contact_type', width: 120 } - ], - - // Default sort by last name - sort: [ - { field: 'last_name', order: 'asc' }, - { field: 'first_name', order: 'asc' } - ] -} as UI.ListView; - -export default contactListView; diff --git a/packages/core/src/ui/task.view.ts b/packages/core/src/ui/task.view.ts deleted file mode 100644 index 67106a2..0000000 --- a/packages/core/src/ui/task.view.ts +++ /dev/null @@ -1,61 +0,0 @@ -import type { UI } from '@objectstack/spec'; - -/** - * Task List View - * Defines the grid view for project tasks - */ -export const taskListView = { - name: 'task_list', - label: 'All Tasks', - type: 'grid', - - // Data source configuration - data: { - provider: 'object', - object: 'project_task' - }, - - // Columns to display - columns: [ - { field: 'name', width: 250 }, - { field: 'status', width: 120 }, - { field: 'priority', width: 100 }, - { field: 'assigned_to', width: 150 }, - { field: 'due_date', width: 120 } - ], - - // Default sort - sort: [ - { field: 'due_date', order: 'asc' }, - { field: 'priority', order: 'desc' } - ] -} as UI.ListView; - -/** - * Task Kanban View - * Kanban board view for tasks organized by status - */ -export const taskKanbanView = { - name: 'task_kanban', - label: 'Task Board', - type: 'kanban', - - // Data source configuration - data: { - provider: 'object', - object: 'project_task' - }, - - // Card fields to display - columns: [ - 'name', - 'priority', - 'assigned_to', - 'due_date' - ] -} as UI.ListView; - -export default { - taskListView, - taskKanbanView -}; diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json deleted file mode 100644 index 15d9efa..0000000 --- a/packages/core/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "module": "ESNext", - "lib": ["ES2022"], - "moduleResolution": "bundler", - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "outDir": "./dist", - "rootDir": "./src", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true, - "allowSyntheticDefaultImports": true, - "composite": true - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist"] -} diff --git a/packages/examples/README.md b/packages/examples/README.md deleted file mode 100644 index 43c2d90..0000000 --- a/packages/examples/README.md +++ /dev/null @@ -1,136 +0,0 @@ -# @objectstack-starter/examples - -Example applications demonstrating various ObjectStack use cases. - -## What's Included - -This package contains complete example applications for different domains: - -### E-commerce Example - -**Objects:** -- `product` - Product catalog management -- `order` - Order processing and tracking - -**Views:** -- Product list view -- Order list view - -**Run:** -```bash -npm run example:ecommerce -``` - -### Blog Example - -**Objects:** -- `blog_post` - Blog post content management -- `author` - Content author management - -**Views:** -- Blog post list view -- Author list view - -**Run:** -```bash -npm run example:blog -``` - -### CRM Example - -**Objects:** -- `account` - Business account management -- `opportunity` - Sales opportunity tracking - -**Views:** -- Account list view -- Opportunity list view -- Opportunity kanban view (sales pipeline) - -**Run:** -```bash -npm run example:crm -``` - -### Basic Example - -Demonstrates the core objects from `@objectstack-starter/core`. - -**Run:** -```bash -npm run example:basic -``` - -## Installation - -```bash -npm install @objectstack-starter/examples -``` - -## Usage - -```typescript -// Import E-commerce objects -import { productObject, orderObject, productListView } from '@objectstack-starter/examples'; - -// Import Blog objects -import { blogPostObject, authorObject } from '@objectstack-starter/examples'; - -// Import CRM objects -import { accountObject, opportunityObject, opportunityKanbanView } from '@objectstack-starter/examples'; -``` - -## Available Exports - -### E-commerce -- `productObject` - Product data object -- `orderObject` - Order data object -- `productListView` - Product grid view -- `orderListView` - Order grid view - -### Blog -- `blogPostObject` - Blog post data object -- `authorObject` - Author data object -- `blogPostListView` - Blog post grid view -- `authorListView` - Author grid view - -### CRM -- `accountObject` - Account data object -- `opportunityObject` - Opportunity data object -- `accountListView` - Account grid view -- `opportunityListView` - Opportunity grid view -- `opportunityKanbanView` - Opportunity kanban view - -## Development - -```bash -# Build the package -npm run build - -# Watch mode -npm run dev - -# Type checking -npm run type-check - -# Run all examples -npm run example:basic -npm run example:ecommerce -npm run example:blog -npm run example:crm -``` - -## Use Cases - -### E-commerce -Build an online store with product catalog and order management. - -### Blog -Create a content management system with multi-author support. - -### CRM -Develop a sales management system with account and opportunity tracking. - -## License - -MIT diff --git a/packages/examples/package.json b/packages/examples/package.json deleted file mode 100644 index 9d0e025..0000000 --- a/packages/examples/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "@objectstack-starter/examples", - "version": "0.1.0", - "description": "ObjectStack Starter Template - Example applications and use cases", - "type": "module", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "tsc --build", - "dev": "tsc --build --watch", - "clean": "tsc --build --clean && rm -rf dist", - "type-check": "tsc --build --dry", - "example:basic": "node dist/basic-example.js", - "example:ecommerce": "node dist/ecommerce-example.js", - "example:blog": "node dist/blog-example.js", - "example:crm": "node dist/crm-example.js", - "example:crm-comprehensive": "node dist/crm-comprehensive-example.js" - }, - "dependencies": { - "@objectstack/spec": "^0.3.3", - "@objectstack-starter/core": "workspace:*" - }, - "devDependencies": { - "@types/node": "^25.0.10", - "typescript": "^5.3.0" - }, - "engines": { - "node": ">=18.0.0" - }, - "keywords": [ - "objectstack", - "examples", - "starter-template" - ], - "license": "MIT" -} diff --git a/packages/examples/src/basic-example.ts b/packages/examples/src/basic-example.ts deleted file mode 100644 index 6f140f8..0000000 --- a/packages/examples/src/basic-example.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Basic Example - * Demonstrates the core objects from @objectstack-starter/core - */ - -import { - config, - projectTaskObject, - contactObject, - taskListView, - taskKanbanView, - contactListView, - mainApp -} from '@objectstack-starter/core'; - -console.log('===================================='); -console.log('Basic Example - Core Objects'); -console.log('====================================\n'); - -// Example 1: Access configuration -console.log('📋 App Configuration:'); -console.log(` Name: ${config.name}`); -console.log(` Version: ${config.version}`); -console.log(` Type: ${config.type}\n`); - -// Example 2: Project Task Object -console.log('📝 Project Task Object:'); -console.log(` Name: ${projectTaskObject.name}`); -console.log(` Label: ${projectTaskObject.label}`); -console.log(` Fields: ${Object.keys(projectTaskObject.fields).join(', ')}`); -console.log(` Searchable: ${projectTaskObject.enable?.searchable}`); -console.log(` API Enabled: ${projectTaskObject.enable?.apiEnabled}\n`); - -// Example 3: Contact Object -console.log('👤 Contact Object:'); -console.log(` Name: ${contactObject.name}`); -console.log(` Label: ${contactObject.label}`); -console.log(` Fields: ${Object.keys(contactObject.fields).join(', ')}\n`); - -// Example 4: Task Views -console.log('🎨 Task Views:'); -console.log(` List View: ${taskListView.name} (${taskListView.type})`); -console.log(` Kanban View: ${taskKanbanView.name} (${taskKanbanView.type})\n`); - -// Example 5: Contact View -console.log('🎨 Contact View:'); -console.log(` List View: ${contactListView.name} (${contactListView.type})`); -console.log(` Columns: ${contactListView.columns?.length}\n`); - -// Example 6: Main App -console.log('🏠 Main Application:'); -console.log(` Name: ${mainApp.name}`); -console.log(` Label: ${mainApp.label}`); -console.log(` Navigation Items: ${mainApp.navigation?.length}\n`); - -console.log('✅ Basic example completed successfully!'); diff --git a/packages/examples/src/blog-example.ts b/packages/examples/src/blog-example.ts deleted file mode 100644 index 73d924c..0000000 --- a/packages/examples/src/blog-example.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Blog Example - * Demonstrates blog content management objects (Blog Post, Author) - */ - -import { blogPostObject } from './data/blog-post.object.js'; -import { authorObject } from './data/author.object.js'; -import { blogPostListView, authorListView } from './ui/blog.view.js'; - -console.log('===================================='); -console.log('Blog Example'); -console.log('====================================\n'); - -// Example 1: Blog Post Object -console.log('📝 Blog Post Object:'); -console.log(` Name: ${blogPostObject.name}`); -console.log(` Label: ${blogPostObject.label}`); -console.log(` Description: ${blogPostObject.description}`); -console.log(` Fields: ${Object.keys(blogPostObject.fields).join(', ')}`); -console.log(` Searchable: ${blogPostObject.enable?.searchable}\n`); - -// Example 2: Post Status Workflow -console.log('🔄 Post Status Workflow:'); -const statusField = blogPostObject.fields.status; -if (statusField.type === 'select' && statusField.options) { - statusField.options.forEach(option => { - console.log(` ${option.value === 'draft' ? '➡️' : ' '} ${option.label}`); - }); -} -console.log(); - -// Example 3: Author Object -console.log('✍️ Author Object:'); -console.log(` Name: ${authorObject.name}`); -console.log(` Label: ${authorObject.label}`); -console.log(` Description: ${authorObject.description}`); -console.log(` Fields: ${Object.keys(authorObject.fields).join(', ')}\n`); - -// Example 4: Author Social Fields -console.log('🌐 Author Social Media Integration:'); -console.log(` Twitter: ${authorObject.fields.social_twitter.label}`); -console.log(` GitHub: ${authorObject.fields.social_github.label}\n`); - -// Example 5: Blog Post List View -console.log('🎨 Blog Post List View:'); -console.log(` Name: ${blogPostListView.name}`); -console.log(` Type: ${blogPostListView.type}`); -if (blogPostListView.columns && typeof blogPostListView.columns[0] === 'object') { - console.log(` Columns: ${blogPostListView.columns.map(c => typeof c === 'object' ? c.field : c).join(', ')}`); -} -console.log(); - -// Example 6: Author List View -console.log('🎨 Author List View:'); -console.log(` Name: ${authorListView.name}`); -console.log(` Type: ${authorListView.type}`); -if (authorListView.columns && typeof authorListView.columns[0] === 'object') { - console.log(` Columns: ${authorListView.columns.map(c => typeof c === 'object' ? c.field : c).join(', ')}`); -} -console.log(); - -// Example 7: Content Relationships -console.log('🔗 Object Relationships:'); -console.log(` Blog Post -> Author: ${blogPostObject.fields.author.type} (${blogPostObject.fields.author.reference})\n`); - -console.log('✅ Blog example completed successfully!'); -console.log('\n💡 Use Case: Build a content management system with multi-author support'); diff --git a/packages/examples/src/crm-comprehensive-example.ts b/packages/examples/src/crm-comprehensive-example.ts deleted file mode 100644 index 09274bd..0000000 --- a/packages/examples/src/crm-comprehensive-example.ts +++ /dev/null @@ -1,183 +0,0 @@ -/** - * Comprehensive CRM Example - * Demonstrates all CRM core modules and objects - */ - -// Import all CRM objects -import { accountObject } from './data/account.object.js'; -import { opportunityObject } from './data/opportunity.object.js'; -import { leadObject } from './data/lead.object.js'; -import { caseObject } from './data/case.object.js'; -import { campaignObject } from './data/campaign.object.js'; -import { quoteObject } from './data/quote.object.js'; -import { contractObject } from './data/contract.object.js'; -import { activityTaskObject, eventObject, callObject } from './data/activity.object.js'; - -// Import views -import { accountListView, opportunityListView, opportunityKanbanView } from './ui/crm.view.js'; -import { - leadListView, - leadKanbanView, - caseListView, - campaignListView, - quoteListView, - contractListView, - taskListView, - eventListView, - callListView -} from './ui/crm-extended.view.js'; - -console.log('========================================================'); -console.log(' COMPREHENSIVE CRM SYSTEM - CORE MODULES'); -console.log(' Based on Industry Best Practices'); -console.log('========================================================\n'); - -// Display all core modules -console.log('📦 CORE CRM MODULES:\n'); - -console.log('1. 👥 LEAD MANAGEMENT'); -console.log(` Object: ${leadObject.name}`); -console.log(` Description: ${leadObject.description}`); -console.log(` Fields: ${Object.keys(leadObject.fields).length} fields`); -console.log(` Key Features: Lead tracking, qualification, conversion workflow\n`); - -console.log('2. 🏢 ACCOUNT MANAGEMENT'); -console.log(` Object: ${accountObject.name}`); -console.log(` Description: ${accountObject.description}`); -console.log(` Fields: ${Object.keys(accountObject.fields).length} fields`); -console.log(` Key Features: Business accounts, industry tracking, revenue management\n`); - -console.log('3. 💼 OPPORTUNITY MANAGEMENT'); -console.log(` Object: ${opportunityObject.name}`); -console.log(` Description: ${opportunityObject.description}`); -console.log(` Fields: ${Object.keys(opportunityObject.fields).length} fields`); -console.log(` Key Features: Sales pipeline, stage tracking, probability analysis\n`); - -console.log('4. 🎫 CASE/SUPPORT MANAGEMENT'); -console.log(` Object: ${caseObject.name}`); -console.log(` Description: ${caseObject.description}`); -console.log(` Fields: ${Object.keys(caseObject.fields).length} fields`); -console.log(` Key Features: Ticket tracking, SLA monitoring, resolution management\n`); - -console.log('5. 📢 CAMPAIGN MANAGEMENT'); -console.log(` Object: ${campaignObject.name}`); -console.log(` Description: ${campaignObject.description}`); -console.log(` Fields: ${Object.keys(campaignObject.fields).length} fields`); -console.log(` Key Features: Marketing campaigns, ROI tracking, response monitoring\n`); - -console.log('6. 📄 QUOTE MANAGEMENT'); -console.log(` Object: ${quoteObject.name}`); -console.log(` Description: ${quoteObject.description}`); -console.log(` Fields: ${Object.keys(quoteObject.fields).length} fields`); -console.log(` Key Features: Quote generation, pricing, payment terms\n`); - -console.log('7. 📋 CONTRACT MANAGEMENT'); -console.log(` Object: ${contractObject.name}`); -console.log(` Description: ${contractObject.description}`); -console.log(` Fields: ${Object.keys(contractObject.fields).length} fields`); -console.log(` Key Features: Contract lifecycle, auto-renewal, billing schedules\n`); - -console.log('8. ✅ ACTIVITY MANAGEMENT'); -console.log(` Objects: Tasks, Events, Calls`); -console.log(` Task Fields: ${Object.keys(activityTaskObject.fields).length}`); -console.log(` Event Fields: ${Object.keys(eventObject.fields).length}`); -console.log(` Call Fields: ${Object.keys(callObject.fields).length}`); -console.log(` Key Features: Task tracking, calendar events, call logging\n`); - -console.log('========================================================'); -console.log('📊 OBJECT RELATIONSHIPS:\n'); - -console.log('Lead → Account/Contact/Opportunity (Conversion)'); -console.log('Account ← Contact (Many-to-One)'); -console.log('Account ← Opportunity (One-to-Many)'); -console.log('Account ← Quote (One-to-Many)'); -console.log('Account ← Contract (One-to-Many)'); -console.log('Account ← Case (One-to-Many)'); -console.log('Opportunity → Quote (One-to-Many)'); -console.log('Campaign → Lead (Lead tracking)\n'); - -console.log('========================================================'); -console.log('🎨 AVAILABLE VIEWS:\n'); - -const views = [ - { name: leadListView.name, type: leadListView.type, label: leadListView.label }, - { name: leadKanbanView.name, type: leadKanbanView.type, label: leadKanbanView.label }, - { name: accountListView.name, type: accountListView.type, label: accountListView.label }, - { name: opportunityListView.name, type: opportunityListView.type, label: opportunityListView.label }, - { name: opportunityKanbanView.name, type: opportunityKanbanView.type, label: opportunityKanbanView.label }, - { name: caseListView.name, type: caseListView.type, label: caseListView.label }, - { name: campaignListView.name, type: campaignListView.type, label: campaignListView.label }, - { name: quoteListView.name, type: quoteListView.type, label: quoteListView.label }, - { name: contractListView.name, type: contractListView.type, label: contractListView.label }, - { name: taskListView.name, type: taskListView.type, label: taskListView.label }, - { name: eventListView.name, type: eventListView.type, label: eventListView.label }, - { name: callListView.name, type: callListView.type, label: callListView.label } -]; - -views.forEach((view, index) => { - console.log(`${index + 1}. ${view.label} (${view.type})`); -}); - -console.log('\n========================================================'); -console.log('⚙️ ENABLED FEATURES:\n'); - -console.log('✓ API Enabled - All objects have RESTful API support'); -console.log('✓ History Tracking - Full audit trail for all changes'); -console.log('✓ Searchable - Global search across all objects'); -console.log('✓ Lookup Relationships - Proper foreign key relationships'); -console.log('✓ Status Workflows - State management for processes'); -console.log('✓ Field Validation - Required fields and unique constraints'); - -console.log('\n========================================================'); -console.log('🎯 INDUSTRY BEST PRACTICES IMPLEMENTED:\n'); - -console.log('1. Lead-to-Cash Process:'); -console.log(' Lead → Qualification → Opportunity → Quote → Contract → Revenue\n'); - -console.log('2. Customer Support Workflow:'); -console.log(' Case Creation → Assignment → Resolution → Closure\n'); - -console.log('3. Marketing Operations:'); -console.log(' Campaign → Lead Generation → Lead Nurturing → Conversion\n'); - -console.log('4. Activity Tracking:'); -console.log(' Tasks, Events, and Calls linked to all customer touchpoints\n'); - -console.log('5. 360° Customer View:'); -console.log(' Accounts linked to Contacts, Opportunities, Cases, Quotes, Contracts\n'); - -console.log('========================================================'); -console.log('📈 SAMPLE WORKFLOW EXAMPLES:\n'); - -console.log('SALES WORKFLOW:'); -console.log('1. Marketing generates Lead from Campaign'); -console.log('2. Sales qualifies Lead and converts to Account + Contact + Opportunity'); -console.log('3. Sales creates Quote for Opportunity'); -console.log('4. Quote accepted → Contract created'); -console.log('5. Opportunity marked as Closed Won\n'); - -console.log('SUPPORT WORKFLOW:'); -console.log('1. Customer contacts support (Email, Phone, Web)'); -console.log('2. Case created and assigned to support agent'); -console.log('3. Support agent works on Case, updates status'); -console.log('4. Resolution provided and Case closed'); -console.log('5. Customer satisfaction tracked\n'); - -console.log('ACTIVITY TRACKING:'); -console.log('1. Task created for follow-up with Lead'); -console.log('2. Event scheduled for product demo with Contact'); -console.log('3. Call logged after customer conversation'); -console.log('4. All activities linked to relevant records\n'); - -console.log('========================================================'); -console.log('✅ COMPREHENSIVE CRM SYSTEM READY!\n'); - -console.log('💡 This CRM system includes all core modules following'); -console.log(' industry best practices and protocol specifications.\n'); - -console.log('📚 Total Objects: 11'); -console.log('📊 Total Views: 12'); -console.log('🔗 Relationships: Fully integrated'); -console.log('⚡ Features: Production-ready\n'); - -console.log('========================================================'); diff --git a/packages/examples/src/crm-example.ts b/packages/examples/src/crm-example.ts deleted file mode 100644 index 3050dcb..0000000 --- a/packages/examples/src/crm-example.ts +++ /dev/null @@ -1,103 +0,0 @@ -/** - * CRM Example - * Demonstrates CRM objects (Account, Opportunity) - */ - -import { accountObject } from './data/account.object.js'; -import { opportunityObject } from './data/opportunity.object.js'; -import { accountListView, opportunityListView, opportunityKanbanView } from './ui/crm.view.js'; - -console.log('===================================='); -console.log('CRM Example'); -console.log('====================================\n'); - -// Example 1: Account Object -console.log('🏢 Account Object:'); -console.log(` Name: ${accountObject.name}`); -console.log(` Label: ${accountObject.label}`); -console.log(` Description: ${accountObject.description}`); -console.log(` Fields: ${Object.keys(accountObject.fields).join(', ')}`); -console.log(` Track History: ${accountObject.enable?.trackHistory}\n`); - -// Example 2: Account Industries -console.log('🏭 Industries:'); -const industryField = accountObject.fields.industry; -if (industryField.type === 'select' && industryField.options) { - industryField.options.forEach(option => { - console.log(` - ${option.label}`); - }); -} -console.log(); - -// Example 3: Account Types -console.log('📊 Account Types:'); -const typeField = accountObject.fields.type; -if (typeField.type === 'select' && typeField.options) { - typeField.options.forEach(option => { - console.log(` - ${option.label} (${option.value})`); - }); -} -console.log(); - -// Example 4: Opportunity Object -console.log('💰 Opportunity Object:'); -console.log(` Name: ${opportunityObject.name}`); -console.log(` Label: ${opportunityObject.label}`); -console.log(` Description: ${opportunityObject.description}`); -console.log(` Fields: ${Object.keys(opportunityObject.fields).join(', ')}\n`); - -// Example 5: Sales Pipeline Stages -console.log('🔄 Sales Pipeline Stages:'); -const stageField = opportunityObject.fields.stage; -if (stageField.type === 'select' && stageField.options) { - stageField.options.forEach((option, index) => { - const arrow = index < stageField.options!.length - 1 ? '➡️' : ''; - console.log(` ${option.label} ${arrow}`); - }); -} -console.log(); - -// Example 6: Lead Sources -console.log('📢 Lead Sources:'); -const leadSourceField = opportunityObject.fields.lead_source; -if (leadSourceField.type === 'select' && leadSourceField.options) { - leadSourceField.options.forEach(option => { - console.log(` - ${option.label}`); - }); -} -console.log(); - -// Example 7: Account List View -console.log('🎨 Account List View:'); -console.log(` Name: ${accountListView.name}`); -console.log(` Type: ${accountListView.type}`); -if (accountListView.columns && typeof accountListView.columns[0] === 'object') { - console.log(` Columns: ${accountListView.columns.map(c => typeof c === 'object' ? c.field : c).join(', ')}`); -} -console.log(); - -// Example 8: Opportunity List View -console.log('🎨 Opportunity List View:'); -console.log(` Name: ${opportunityListView.name}`); -console.log(` Type: ${opportunityListView.type}`); -if (opportunityListView.columns && typeof opportunityListView.columns[0] === 'object') { - console.log(` Columns: ${opportunityListView.columns.map(c => typeof c === 'object' ? c.field : c).join(', ')}`); -} -console.log(); - -// Example 9: Opportunity Kanban View -console.log('🎨 Opportunity Kanban View (Sales Pipeline):'); -console.log(` Name: ${opportunityKanbanView.name}`); -console.log(` Type: ${opportunityKanbanView.type}`); -if (opportunityKanbanView.columns && typeof opportunityKanbanView.columns[0] === 'string') { - console.log(` Card Fields: ${opportunityKanbanView.columns.join(', ')}`); -} -console.log(); - -// Example 10: Object Relationships -console.log('🔗 Object Relationships:'); -console.log(` Opportunity -> Account: ${opportunityObject.fields.account.type} (${opportunityObject.fields.account.reference})`); -console.log(` Opportunity -> Owner: ${opportunityObject.fields.owner.type} (${opportunityObject.fields.owner.reference})\n`); - -console.log('✅ CRM example completed successfully!'); -console.log('\n💡 Use Case: Build a sales management system with account and opportunity tracking'); diff --git a/packages/examples/src/data/account.object.ts b/packages/examples/src/data/account.object.ts deleted file mode 100644 index e4a5eef..0000000 --- a/packages/examples/src/data/account.object.ts +++ /dev/null @@ -1,109 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Account Object - * CRM account/company management - */ -export const accountObject = { - name: 'account', - label: 'Account', - pluralLabel: 'Accounts', - description: 'Business account management', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - name: { - name: 'name', - label: 'Account Name', - type: 'text', - required: true - }, - - account_number: { - name: 'account_number', - label: 'Account Number', - type: 'text', - unique: true - }, - - industry: { - name: 'industry', - label: 'Industry', - type: 'select', - options: [ - { label: 'Technology', value: 'technology' }, - { label: 'Finance', value: 'finance' }, - { label: 'Healthcare', value: 'healthcare' }, - { label: 'Manufacturing', value: 'manufacturing' }, - { label: 'Retail', value: 'retail' }, - { label: 'Education', value: 'education' }, - { label: 'Other', value: 'other' } - ] - }, - - type: { - name: 'type', - label: 'Account Type', - type: 'select', - options: [ - { label: 'Customer', value: 'customer' }, - { label: 'Prospect', value: 'prospect' }, - { label: 'Partner', value: 'partner' }, - { label: 'Competitor', value: 'competitor' } - ] - }, - - annual_revenue: { - name: 'annual_revenue', - label: 'Annual Revenue', - type: 'decimal' - }, - - employee_count: { - name: 'employee_count', - label: 'Number of Employees', - type: 'number' - }, - - website: { - name: 'website', - label: 'Website', - type: 'url' - }, - - phone: { - name: 'phone', - label: 'Phone', - type: 'text' - }, - - billing_address: { - name: 'billing_address', - label: 'Billing Address', - type: 'textarea' - }, - - shipping_address: { - name: 'shipping_address', - label: 'Shipping Address', - type: 'textarea' - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea' - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default accountObject; diff --git a/packages/examples/src/data/activity.object.ts b/packages/examples/src/data/activity.object.ts deleted file mode 100644 index d741bdc..0000000 --- a/packages/examples/src/data/activity.object.ts +++ /dev/null @@ -1,318 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Activity Task Object - * CRM task and to-do management - */ -const activityTaskObject = { - name: 'activity_task', - label: 'Task', - pluralLabel: 'Tasks', - description: 'Task and to-do management', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - subject: { - name: 'subject', - label: 'Subject', - type: 'text', - required: true - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea' - }, - - status: { - name: 'status', - label: 'Status', - type: 'select', - required: true, - defaultValue: 'not_started', - options: [ - { label: 'Not Started', value: 'not_started' }, - { label: 'In Progress', value: 'in_progress' }, - { label: 'Completed', value: 'completed' }, - { label: 'Deferred', value: 'deferred' }, - { label: 'Waiting', value: 'waiting' } - ] - }, - - priority: { - name: 'priority', - label: 'Priority', - type: 'select', - defaultValue: 'medium', - options: [ - { label: 'Low', value: 'low' }, - { label: 'Medium', value: 'medium' }, - { label: 'High', value: 'high' } - ] - }, - - due_date: { - name: 'due_date', - label: 'Due Date', - type: 'date' - }, - - reminder_date: { - name: 'reminder_date', - label: 'Reminder Date', - type: 'datetime' - }, - - assigned_to: { - name: 'assigned_to', - label: 'Assigned To', - type: 'lookup', - reference: 'user', - required: true - }, - - related_to: { - name: 'related_to', - label: 'Related To', - type: 'text', - description: 'Reference to related object (Account, Opportunity, etc.)' - }, - - related_to_id: { - name: 'related_to_id', - label: 'Related To ID', - type: 'text' - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -/** - * Event Object - * CRM event and meeting management - */ -const eventObject = { - name: 'event', - label: 'Event', - pluralLabel: 'Events', - description: 'Event and meeting management', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - subject: { - name: 'subject', - label: 'Subject', - type: 'text', - required: true - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea' - }, - - location: { - name: 'location', - label: 'Location', - type: 'text' - }, - - start_datetime: { - name: 'start_datetime', - label: 'Start Date & Time', - type: 'datetime', - required: true - }, - - end_datetime: { - name: 'end_datetime', - label: 'End Date & Time', - type: 'datetime', - required: true - }, - - all_day_event: { - name: 'all_day_event', - label: 'All Day Event', - type: 'boolean', - defaultValue: false - }, - - event_type: { - name: 'event_type', - label: 'Event Type', - type: 'select', - options: [ - { label: 'Meeting', value: 'meeting' }, - { label: 'Call', value: 'call' }, - { label: 'Demo', value: 'demo' }, - { label: 'Presentation', value: 'presentation' }, - { label: 'Conference', value: 'conference' }, - { label: 'Training', value: 'training' } - ] - }, - - organizer: { - name: 'organizer', - label: 'Organizer', - type: 'lookup', - reference: 'user', - required: true - }, - - reminder: { - name: 'reminder', - label: 'Reminder', - type: 'select', - options: [ - { label: 'None', value: 'none' }, - { label: '15 minutes before', value: '15min' }, - { label: '30 minutes before', value: '30min' }, - { label: '1 hour before', value: '1hour' }, - { label: '1 day before', value: '1day' } - ] - }, - - related_to: { - name: 'related_to', - label: 'Related To', - type: 'text', - description: 'Reference to related object (Account, Opportunity, etc.)' - }, - - related_to_id: { - name: 'related_to_id', - label: 'Related To ID', - type: 'text' - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -/** - * Call Object - * CRM call log management - */ -const callObject = { - name: 'call', - label: 'Call', - pluralLabel: 'Calls', - description: 'Call log and tracking', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - subject: { - name: 'subject', - label: 'Subject', - type: 'text', - required: true - }, - - call_type: { - name: 'call_type', - label: 'Call Type', - type: 'select', - required: true, - options: [ - { label: 'Inbound', value: 'inbound' }, - { label: 'Outbound', value: 'outbound' } - ] - }, - - call_purpose: { - name: 'call_purpose', - label: 'Call Purpose', - type: 'select', - options: [ - { label: 'Prospecting', value: 'prospecting' }, - { label: 'Follow Up', value: 'follow_up' }, - { label: 'Demo', value: 'demo' }, - { label: 'Support', value: 'support' }, - { label: 'Negotiation', value: 'negotiation' } - ] - }, - - call_duration: { - name: 'call_duration', - label: 'Call Duration (minutes)', - type: 'number' - }, - - call_datetime: { - name: 'call_datetime', - label: 'Call Date & Time', - type: 'datetime', - required: true - }, - - call_result: { - name: 'call_result', - label: 'Call Result', - type: 'select', - options: [ - { label: 'Connected', value: 'connected' }, - { label: 'Left Voicemail', value: 'voicemail' }, - { label: 'No Answer', value: 'no_answer' }, - { label: 'Busy', value: 'busy' }, - { label: 'Wrong Number', value: 'wrong_number' } - ] - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea' - }, - - caller: { - name: 'caller', - label: 'Caller', - type: 'lookup', - reference: 'user', - required: true - }, - - related_to: { - name: 'related_to', - label: 'Related To', - type: 'text', - description: 'Reference to related object (Account, Contact, etc.)' - }, - - related_to_id: { - name: 'related_to_id', - label: 'Related To ID', - type: 'text' - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export { activityTaskObject, eventObject, callObject }; -export default { activityTaskObject, eventObject, callObject }; diff --git a/packages/examples/src/data/author.object.ts b/packages/examples/src/data/author.object.ts deleted file mode 100644 index a3de256..0000000 --- a/packages/examples/src/data/author.object.ts +++ /dev/null @@ -1,85 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Author Object - * Blog author/content creator management - */ -export const authorObject = { - name: 'author', - label: 'Author', - pluralLabel: 'Authors', - description: 'Content author management', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - name: { - name: 'name', - label: 'Full Name', - type: 'text', - required: true - }, - - email: { - name: 'email', - label: 'Email', - type: 'email', - required: true, - unique: true - }, - - bio: { - name: 'bio', - label: 'Biography', - type: 'textarea' - }, - - avatar_url: { - name: 'avatar_url', - label: 'Avatar URL', - type: 'url' - }, - - website: { - name: 'website', - label: 'Website', - type: 'url' - }, - - social_twitter: { - name: 'social_twitter', - label: 'Twitter Handle', - type: 'text' - }, - - social_github: { - name: 'social_github', - label: 'GitHub Username', - type: 'text' - }, - - is_active: { - name: 'is_active', - label: 'Active', - type: 'boolean', - defaultValue: true - }, - - joined_date: { - name: 'joined_date', - label: 'Joined Date', - type: 'date', - required: true - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default authorObject; diff --git a/packages/examples/src/data/blog-post.object.ts b/packages/examples/src/data/blog-post.object.ts deleted file mode 100644 index 1df5dfd..0000000 --- a/packages/examples/src/data/blog-post.object.ts +++ /dev/null @@ -1,105 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Blog Post Object - * Blog post content management - */ -export const blogPostObject = { - name: 'blog_post', - label: 'Blog Post', - pluralLabel: 'Blog Posts', - description: 'Blog content management', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - title: { - name: 'title', - label: 'Title', - type: 'text', - required: true - }, - - slug: { - name: 'slug', - label: 'URL Slug', - type: 'text', - required: true, - unique: true - }, - - content: { - name: 'content', - label: 'Content', - type: 'textarea', - required: true - }, - - excerpt: { - name: 'excerpt', - label: 'Excerpt', - type: 'textarea' - }, - - author: { - name: 'author', - label: 'Author', - type: 'lookup', - reference: 'author' - }, - - status: { - name: 'status', - label: 'Status', - type: 'select', - required: true, - defaultValue: 'draft', - options: [ - { label: 'Draft', value: 'draft' }, - { label: 'Published', value: 'published' }, - { label: 'Archived', value: 'archived' } - ] - }, - - published_date: { - name: 'published_date', - label: 'Published Date', - type: 'datetime' - }, - - featured_image: { - name: 'featured_image', - label: 'Featured Image', - type: 'url' - }, - - categories: { - name: 'categories', - label: 'Categories', - type: 'text' - }, - - tags: { - name: 'tags', - label: 'Tags', - type: 'text' - }, - - view_count: { - name: 'view_count', - label: 'View Count', - type: 'number', - defaultValue: 0 - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default blogPostObject; diff --git a/packages/examples/src/data/campaign.object.ts b/packages/examples/src/data/campaign.object.ts deleted file mode 100644 index fe39ef2..0000000 --- a/packages/examples/src/data/campaign.object.ts +++ /dev/null @@ -1,146 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Campaign Object - * CRM marketing campaign management - */ -export const campaignObject = { - name: 'campaign', - label: 'Campaign', - pluralLabel: 'Campaigns', - description: 'Marketing campaign management and tracking', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - name: { - name: 'name', - label: 'Campaign Name', - type: 'text', - required: true - }, - - campaign_type: { - name: 'campaign_type', - label: 'Campaign Type', - type: 'select', - required: true, - options: [ - { label: 'Email', value: 'email' }, - { label: 'Webinar', value: 'webinar' }, - { label: 'Conference', value: 'conference' }, - { label: 'Trade Show', value: 'trade_show' }, - { label: 'Advertisement', value: 'advertisement' }, - { label: 'Direct Mail', value: 'direct_mail' }, - { label: 'Social Media', value: 'social_media' }, - { label: 'Other', value: 'other' } - ] - }, - - status: { - name: 'status', - label: 'Status', - type: 'select', - required: true, - defaultValue: 'planned', - options: [ - { label: 'Planned', value: 'planned' }, - { label: 'In Progress', value: 'in_progress' }, - { label: 'Completed', value: 'completed' }, - { label: 'Aborted', value: 'aborted' } - ] - }, - - start_date: { - name: 'start_date', - label: 'Start Date', - type: 'date', - required: true - }, - - end_date: { - name: 'end_date', - label: 'End Date', - type: 'date' - }, - - budget: { - name: 'budget', - label: 'Budget', - type: 'decimal' - }, - - actual_cost: { - name: 'actual_cost', - label: 'Actual Cost', - type: 'decimal' - }, - - expected_revenue: { - name: 'expected_revenue', - label: 'Expected Revenue', - type: 'decimal' - }, - - expected_response: { - name: 'expected_response', - label: 'Expected Response (%)', - type: 'number' - }, - - num_sent: { - name: 'num_sent', - label: 'Number Sent', - type: 'number' - }, - - num_responses: { - name: 'num_responses', - label: 'Number of Responses', - type: 'number' - }, - - num_converted: { - name: 'num_converted', - label: 'Number Converted', - type: 'number' - }, - - parent_campaign: { - name: 'parent_campaign', - label: 'Parent Campaign', - type: 'lookup', - reference: 'campaign' - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea' - }, - - owner: { - name: 'owner', - label: 'Owner', - type: 'lookup', - reference: 'user' - }, - - is_active: { - name: 'is_active', - label: 'Active', - type: 'boolean', - defaultValue: true - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default campaignObject; diff --git a/packages/examples/src/data/case.object.ts b/packages/examples/src/data/case.object.ts deleted file mode 100644 index fce16a4..0000000 --- a/packages/examples/src/data/case.object.ts +++ /dev/null @@ -1,167 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Case Object - * CRM customer support case/ticket management - */ -export const caseObject = { - name: 'case', - label: 'Case', - pluralLabel: 'Cases', - description: 'Customer support case and ticket management', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - case_number: { - name: 'case_number', - label: 'Case Number', - type: 'text', - unique: true, - required: true - }, - - subject: { - name: 'subject', - label: 'Subject', - type: 'text', - required: true - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea', - required: true - }, - - status: { - name: 'status', - label: 'Status', - type: 'select', - required: true, - defaultValue: 'new', - options: [ - { label: 'New', value: 'new' }, - { label: 'In Progress', value: 'in_progress' }, - { label: 'Waiting on Customer', value: 'waiting_customer' }, - { label: 'Waiting on Internal', value: 'waiting_internal' }, - { label: 'Escalated', value: 'escalated' }, - { label: 'Resolved', value: 'resolved' }, - { label: 'Closed', value: 'closed' } - ] - }, - - priority: { - name: 'priority', - label: 'Priority', - type: 'select', - required: true, - defaultValue: 'medium', - options: [ - { label: 'Low', value: 'low' }, - { label: 'Medium', value: 'medium' }, - { label: 'High', value: 'high' }, - { label: 'Critical', value: 'critical' } - ] - }, - - type: { - name: 'type', - label: 'Case Type', - type: 'select', - options: [ - { label: 'Question', value: 'question' }, - { label: 'Problem', value: 'problem' }, - { label: 'Feature Request', value: 'feature_request' }, - { label: 'Bug', value: 'bug' }, - { label: 'Refund', value: 'refund' } - ] - }, - - origin: { - name: 'origin', - label: 'Case Origin', - type: 'select', - options: [ - { label: 'Email', value: 'email' }, - { label: 'Phone', value: 'phone' }, - { label: 'Web', value: 'web' }, - { label: 'Chat', value: 'chat' }, - { label: 'Social Media', value: 'social_media' } - ] - }, - - account: { - name: 'account', - label: 'Account', - type: 'lookup', - reference: 'account' - }, - - contact: { - name: 'contact', - label: 'Contact', - type: 'lookup', - reference: 'contact', - required: true - }, - - product: { - name: 'product', - label: 'Product', - type: 'lookup', - reference: 'product' - }, - - owner: { - name: 'owner', - label: 'Owner', - type: 'lookup', - reference: 'user', - required: true - }, - - resolution: { - name: 'resolution', - label: 'Resolution', - type: 'textarea' - }, - - reported_date: { - name: 'reported_date', - label: 'Reported Date', - type: 'datetime', - defaultValue: 'now' - }, - - closed_date: { - name: 'closed_date', - label: 'Closed Date', - type: 'datetime' - }, - - sla_violation: { - name: 'sla_violation', - label: 'SLA Violation', - type: 'boolean', - defaultValue: false - }, - - internal_comments: { - name: 'internal_comments', - label: 'Internal Comments', - type: 'textarea' - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default caseObject; diff --git a/packages/examples/src/data/contract.object.ts b/packages/examples/src/data/contract.object.ts deleted file mode 100644 index 8d22c0f..0000000 --- a/packages/examples/src/data/contract.object.ts +++ /dev/null @@ -1,162 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Contract Object - * CRM contract and agreement management - */ -export const contractObject = { - name: 'contract', - label: 'Contract', - pluralLabel: 'Contracts', - description: 'Contract and agreement management', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - contract_number: { - name: 'contract_number', - label: 'Contract Number', - type: 'text', - unique: true, - required: true - }, - - contract_name: { - name: 'contract_name', - label: 'Contract Name', - type: 'text', - required: true - }, - - account: { - name: 'account', - label: 'Account', - type: 'lookup', - reference: 'account', - required: true - }, - - status: { - name: 'status', - label: 'Status', - type: 'select', - required: true, - defaultValue: 'draft', - options: [ - { label: 'Draft', value: 'draft' }, - { label: 'In Review', value: 'in_review' }, - { label: 'Approved', value: 'approved' }, - { label: 'Active', value: 'active' }, - { label: 'Expired', value: 'expired' }, - { label: 'Terminated', value: 'terminated' } - ] - }, - - contract_type: { - name: 'contract_type', - label: 'Contract Type', - type: 'select', - options: [ - { label: 'Service Agreement', value: 'service_agreement' }, - { label: 'Subscription', value: 'subscription' }, - { label: 'License', value: 'license' }, - { label: 'Partnership', value: 'partnership' }, - { label: 'NDA', value: 'nda' }, - { label: 'SLA', value: 'sla' } - ] - }, - - start_date: { - name: 'start_date', - label: 'Start Date', - type: 'date', - required: true - }, - - end_date: { - name: 'end_date', - label: 'End Date', - type: 'date' - }, - - contract_term: { - name: 'contract_term', - label: 'Contract Term (Months)', - type: 'number' - }, - - auto_renew: { - name: 'auto_renew', - label: 'Auto Renew', - type: 'boolean', - defaultValue: false - }, - - notice_period: { - name: 'notice_period', - label: 'Notice Period (Days)', - type: 'number' - }, - - contract_value: { - name: 'contract_value', - label: 'Contract Value', - type: 'decimal' - }, - - billing_frequency: { - name: 'billing_frequency', - label: 'Billing Frequency', - type: 'select', - options: [ - { label: 'Monthly', value: 'monthly' }, - { label: 'Quarterly', value: 'quarterly' }, - { label: 'Semi-Annually', value: 'semi_annually' }, - { label: 'Annually', value: 'annually' }, - { label: 'One-Time', value: 'one_time' } - ] - }, - - payment_terms: { - name: 'payment_terms', - label: 'Payment Terms', - type: 'select', - options: [ - { label: 'Net 15', value: 'net_15' }, - { label: 'Net 30', value: 'net_30' }, - { label: 'Net 60', value: 'net_60' }, - { label: 'Net 90', value: 'net_90' }, - { label: 'Due on Receipt', value: 'due_on_receipt' } - ] - }, - - owner: { - name: 'owner', - label: 'Owner', - type: 'lookup', - reference: 'user' - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea' - }, - - special_terms: { - name: 'special_terms', - label: 'Special Terms', - type: 'textarea' - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default contractObject; diff --git a/packages/examples/src/data/lead.object.ts b/packages/examples/src/data/lead.object.ts deleted file mode 100644 index 934ed49..0000000 --- a/packages/examples/src/data/lead.object.ts +++ /dev/null @@ -1,214 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Lead Object - * CRM lead management and qualification - * Represents potential customers before they become opportunities - */ -export const leadObject = { - name: 'lead', - label: 'Lead', - pluralLabel: 'Leads', - description: 'Lead management and qualification for potential customers', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - first_name: { - name: 'first_name', - label: 'First Name', - type: 'text', - required: true - }, - - last_name: { - name: 'last_name', - label: 'Last Name', - type: 'text', - required: true - }, - - company: { - name: 'company', - label: 'Company', - type: 'text', - required: true - }, - - title: { - name: 'title', - label: 'Job Title', - type: 'text' - }, - - email: { - name: 'email', - label: 'Email', - type: 'email', - required: true, - unique: true - }, - - phone: { - name: 'phone', - label: 'Phone', - type: 'text' - }, - - mobile: { - name: 'mobile', - label: 'Mobile', - type: 'text' - }, - - website: { - name: 'website', - label: 'Website', - type: 'url' - }, - - lead_source: { - name: 'lead_source', - label: 'Lead Source', - type: 'select', - required: true, - options: [ - { label: 'Web', value: 'web' }, - { label: 'Referral', value: 'referral' }, - { label: 'Cold Call', value: 'cold_call' }, - { label: 'Partner', value: 'partner' }, - { label: 'Event', value: 'event' }, - { label: 'Social Media', value: 'social_media' }, - { label: 'Email Campaign', value: 'email_campaign' }, - { label: 'Advertisement', value: 'advertisement' } - ] - }, - - lead_status: { - name: 'lead_status', - label: 'Lead Status', - type: 'select', - required: true, - defaultValue: 'new', - options: [ - { label: 'New', value: 'new' }, - { label: 'Contacted', value: 'contacted' }, - { label: 'Qualified', value: 'qualified' }, - { label: 'Unqualified', value: 'unqualified' }, - { label: 'Converted', value: 'converted' } - ] - }, - - rating: { - name: 'rating', - label: 'Rating', - type: 'select', - options: [ - { label: 'Hot', value: 'hot' }, - { label: 'Warm', value: 'warm' }, - { label: 'Cold', value: 'cold' } - ] - }, - - industry: { - name: 'industry', - label: 'Industry', - type: 'select', - options: [ - { label: 'Technology', value: 'technology' }, - { label: 'Finance', value: 'finance' }, - { label: 'Healthcare', value: 'healthcare' }, - { label: 'Manufacturing', value: 'manufacturing' }, - { label: 'Retail', value: 'retail' }, - { label: 'Education', value: 'education' }, - { label: 'Other', value: 'other' } - ] - }, - - annual_revenue: { - name: 'annual_revenue', - label: 'Annual Revenue', - type: 'decimal' - }, - - employee_count: { - name: 'employee_count', - label: 'Number of Employees', - type: 'number' - }, - - street: { - name: 'street', - label: 'Street', - type: 'text' - }, - - city: { - name: 'city', - label: 'City', - type: 'text' - }, - - state: { - name: 'state', - label: 'State/Province', - type: 'text' - }, - - postal_code: { - name: 'postal_code', - label: 'Postal Code', - type: 'text' - }, - - country: { - name: 'country', - label: 'Country', - type: 'text' - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea' - }, - - converted_account: { - name: 'converted_account', - label: 'Converted Account', - type: 'lookup', - reference: 'account' - }, - - converted_contact: { - name: 'converted_contact', - label: 'Converted Contact', - type: 'lookup', - reference: 'contact' - }, - - converted_opportunity: { - name: 'converted_opportunity', - label: 'Converted Opportunity', - type: 'lookup', - reference: 'opportunity' - }, - - owner: { - name: 'owner', - label: 'Owner', - type: 'lookup', - reference: 'user' - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default leadObject; diff --git a/packages/examples/src/data/opportunity.object.ts b/packages/examples/src/data/opportunity.object.ts deleted file mode 100644 index 9afc4c8..0000000 --- a/packages/examples/src/data/opportunity.object.ts +++ /dev/null @@ -1,116 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Opportunity Object - * CRM sales opportunity management - */ -export const opportunityObject = { - name: 'opportunity', - label: 'Opportunity', - pluralLabel: 'Opportunities', - description: 'Sales opportunity tracking', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - name: { - name: 'name', - label: 'Opportunity Name', - type: 'text', - required: true - }, - - account: { - name: 'account', - label: 'Account', - type: 'lookup', - reference: 'account', - required: true - }, - - stage: { - name: 'stage', - label: 'Stage', - type: 'select', - required: true, - defaultValue: 'prospecting', - options: [ - { label: 'Prospecting', value: 'prospecting' }, - { label: 'Qualification', value: 'qualification' }, - { label: 'Proposal', value: 'proposal' }, - { label: 'Negotiation', value: 'negotiation' }, - { label: 'Closed Won', value: 'closed_won' }, - { label: 'Closed Lost', value: 'closed_lost' } - ] - }, - - amount: { - name: 'amount', - label: 'Amount', - type: 'decimal', - required: true - }, - - probability: { - name: 'probability', - label: 'Probability (%)', - type: 'number', - defaultValue: 50 - }, - - expected_close_date: { - name: 'expected_close_date', - label: 'Expected Close Date', - type: 'date', - required: true - }, - - actual_close_date: { - name: 'actual_close_date', - label: 'Actual Close Date', - type: 'date' - }, - - lead_source: { - name: 'lead_source', - label: 'Lead Source', - type: 'select', - options: [ - { label: 'Web', value: 'web' }, - { label: 'Referral', value: 'referral' }, - { label: 'Cold Call', value: 'cold_call' }, - { label: 'Partner', value: 'partner' }, - { label: 'Event', value: 'event' } - ] - }, - - owner: { - name: 'owner', - label: 'Owner', - type: 'lookup', - reference: 'user' - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea' - }, - - next_step: { - name: 'next_step', - label: 'Next Step', - type: 'text' - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default opportunityObject; diff --git a/packages/examples/src/data/order.object.ts b/packages/examples/src/data/order.object.ts deleted file mode 100644 index 755e426..0000000 --- a/packages/examples/src/data/order.object.ts +++ /dev/null @@ -1,107 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Order Object - * E-commerce order management - */ -export const orderObject = { - name: 'order', - label: 'Order', - pluralLabel: 'Orders', - description: 'Customer order management', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - order_number: { - name: 'order_number', - label: 'Order Number', - type: 'text', - required: true, - unique: true - }, - - customer_name: { - name: 'customer_name', - label: 'Customer Name', - type: 'text', - required: true - }, - - customer_email: { - name: 'customer_email', - label: 'Customer Email', - type: 'email', - required: true - }, - - status: { - name: 'status', - label: 'Status', - type: 'select', - required: true, - defaultValue: 'pending', - options: [ - { label: 'Pending', value: 'pending' }, - { label: 'Processing', value: 'processing' }, - { label: 'Shipped', value: 'shipped' }, - { label: 'Delivered', value: 'delivered' }, - { label: 'Cancelled', value: 'cancelled' } - ] - }, - - total_amount: { - name: 'total_amount', - label: 'Total Amount', - type: 'decimal', - required: true - }, - - shipping_address: { - name: 'shipping_address', - label: 'Shipping Address', - type: 'textarea' - }, - - order_date: { - name: 'order_date', - label: 'Order Date', - type: 'datetime', - required: true - }, - - shipped_date: { - name: 'shipped_date', - label: 'Shipped Date', - type: 'datetime' - }, - - payment_method: { - name: 'payment_method', - label: 'Payment Method', - type: 'select', - options: [ - { label: 'Credit Card', value: 'credit_card' }, - { label: 'PayPal', value: 'paypal' }, - { label: 'Bank Transfer', value: 'bank_transfer' }, - { label: 'Cash on Delivery', value: 'cod' } - ] - }, - - notes: { - name: 'notes', - label: 'Notes', - type: 'textarea' - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default orderObject; diff --git a/packages/examples/src/data/product.object.ts b/packages/examples/src/data/product.object.ts deleted file mode 100644 index ea3b1b8..0000000 --- a/packages/examples/src/data/product.object.ts +++ /dev/null @@ -1,93 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Product Object - * E-commerce product catalog management - */ -export const productObject = { - name: 'product', - label: 'Product', - pluralLabel: 'Products', - description: 'E-commerce product catalog', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - name: { - name: 'name', - label: 'Product Name', - type: 'text', - required: true - }, - - sku: { - name: 'sku', - label: 'SKU', - type: 'text', - required: true, - unique: true - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea' - }, - - price: { - name: 'price', - label: 'Price', - type: 'decimal', - required: true - }, - - category: { - name: 'category', - label: 'Category', - type: 'select', - options: [ - { label: 'Electronics', value: 'electronics' }, - { label: 'Clothing', value: 'clothing' }, - { label: 'Books', value: 'books' }, - { label: 'Home & Garden', value: 'home_garden' }, - { label: 'Sports', value: 'sports' } - ] - }, - - stock_quantity: { - name: 'stock_quantity', - label: 'Stock Quantity', - type: 'number', - defaultValue: 0 - }, - - image_url: { - name: 'image_url', - label: 'Image URL', - type: 'url' - }, - - is_active: { - name: 'is_active', - label: 'Active', - type: 'boolean', - defaultValue: true - }, - - tags: { - name: 'tags', - label: 'Tags', - type: 'text' - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default productObject; diff --git a/packages/examples/src/data/quote.object.ts b/packages/examples/src/data/quote.object.ts deleted file mode 100644 index f2308b0..0000000 --- a/packages/examples/src/data/quote.object.ts +++ /dev/null @@ -1,174 +0,0 @@ -import type { Data } from '@objectstack/spec'; - -/** - * Quote Object - * CRM sales quote/proposal management - */ -export const quoteObject = { - name: 'quote', - label: 'Quote', - pluralLabel: 'Quotes', - description: 'Sales quote and proposal management', - active: true, - isSystem: false, - abstract: false, - datasource: 'default', - - fields: { - quote_number: { - name: 'quote_number', - label: 'Quote Number', - type: 'text', - unique: true, - required: true - }, - - name: { - name: 'name', - label: 'Quote Name', - type: 'text', - required: true - }, - - opportunity: { - name: 'opportunity', - label: 'Opportunity', - type: 'lookup', - reference: 'opportunity' - }, - - account: { - name: 'account', - label: 'Account', - type: 'lookup', - reference: 'account', - required: true - }, - - contact: { - name: 'contact', - label: 'Contact', - type: 'lookup', - reference: 'contact' - }, - - status: { - name: 'status', - label: 'Status', - type: 'select', - required: true, - defaultValue: 'draft', - options: [ - { label: 'Draft', value: 'draft' }, - { label: 'Sent', value: 'sent' }, - { label: 'Accepted', value: 'accepted' }, - { label: 'Rejected', value: 'rejected' }, - { label: 'Expired', value: 'expired' } - ] - }, - - subtotal: { - name: 'subtotal', - label: 'Subtotal', - type: 'decimal' - }, - - tax: { - name: 'tax', - label: 'Tax', - type: 'decimal' - }, - - discount: { - name: 'discount', - label: 'Discount', - type: 'decimal' - }, - - total_amount: { - name: 'total_amount', - label: 'Total Amount', - type: 'decimal', - required: true - }, - - valid_until: { - name: 'valid_until', - label: 'Valid Until', - type: 'date', - required: true - }, - - quote_date: { - name: 'quote_date', - label: 'Quote Date', - type: 'date', - required: true, - defaultValue: 'today' - }, - - payment_terms: { - name: 'payment_terms', - label: 'Payment Terms', - type: 'select', - options: [ - { label: 'Net 15', value: 'net_15' }, - { label: 'Net 30', value: 'net_30' }, - { label: 'Net 60', value: 'net_60' }, - { label: 'Net 90', value: 'net_90' }, - { label: 'Due on Receipt', value: 'due_on_receipt' } - ] - }, - - shipping_method: { - name: 'shipping_method', - label: 'Shipping Method', - type: 'select', - options: [ - { label: 'Standard', value: 'standard' }, - { label: 'Express', value: 'express' }, - { label: 'Overnight', value: 'overnight' }, - { label: 'Pickup', value: 'pickup' } - ] - }, - - billing_address: { - name: 'billing_address', - label: 'Billing Address', - type: 'textarea' - }, - - shipping_address: { - name: 'shipping_address', - label: 'Shipping Address', - type: 'textarea' - }, - - description: { - name: 'description', - label: 'Description', - type: 'textarea' - }, - - terms_and_conditions: { - name: 'terms_and_conditions', - label: 'Terms and Conditions', - type: 'textarea' - }, - - owner: { - name: 'owner', - label: 'Owner', - type: 'lookup', - reference: 'user' - } - }, - - enable: { - apiEnabled: true, - trackHistory: true, - searchable: true - } -} as unknown as Data.ServiceObject; - -export default quoteObject; diff --git a/packages/examples/src/ecommerce-example.ts b/packages/examples/src/ecommerce-example.ts deleted file mode 100644 index cff327f..0000000 --- a/packages/examples/src/ecommerce-example.ts +++ /dev/null @@ -1,78 +0,0 @@ -/** - * E-commerce Example - * Demonstrates e-commerce objects (Product, Order) - */ - -import { productObject } from './data/product.object.js'; -import { orderObject } from './data/order.object.js'; -import { productListView, orderListView } from './ui/ecommerce.view.js'; - -console.log('===================================='); -console.log('E-commerce Example'); -console.log('====================================\n'); - -// Example 1: Product Object -console.log('🛍️ Product Object:'); -console.log(` Name: ${productObject.name}`); -console.log(` Label: ${productObject.label}`); -console.log(` Description: ${productObject.description}`); -console.log(` Fields: ${Object.keys(productObject.fields).join(', ')}`); -console.log(` API Enabled: ${productObject.enable?.apiEnabled}\n`); - -// Example 2: Product Categories -console.log('📦 Product Categories:'); -const categoryField = productObject.fields.category; -if (categoryField.type === 'select' && categoryField.options) { - categoryField.options.forEach(option => { - console.log(` - ${option.label} (${option.value})`); - }); -} -console.log(); - -// Example 3: Order Object -console.log('📋 Order Object:'); -console.log(` Name: ${orderObject.name}`); -console.log(` Label: ${orderObject.label}`); -console.log(` Description: ${orderObject.description}`); -console.log(` Fields: ${Object.keys(orderObject.fields).join(', ')}\n`); - -// Example 4: Order Status Flow -console.log('🔄 Order Status Flow:'); -const statusField = orderObject.fields.status; -if (statusField.type === 'select' && statusField.options) { - statusField.options.forEach(option => { - console.log(` ${option.value === 'pending' ? '➡️' : ' '} ${option.label}`); - }); -} -console.log(); - -// Example 5: Payment Methods -console.log('💳 Payment Methods:'); -const paymentField = orderObject.fields.payment_method; -if (paymentField.type === 'select' && paymentField.options) { - paymentField.options.forEach(option => { - console.log(` - ${option.label}`); - }); -} -console.log(); - -// Example 6: Product List View -console.log('🎨 Product List View:'); -console.log(` Name: ${productListView.name}`); -console.log(` Type: ${productListView.type}`); -if (productListView.columns && typeof productListView.columns[0] === 'object') { - console.log(` Columns: ${productListView.columns.map(c => typeof c === 'object' ? c.field : c).join(', ')}`); -} -console.log(); - -// Example 7: Order List View -console.log('🎨 Order List View:'); -console.log(` Name: ${orderListView.name}`); -console.log(` Type: ${orderListView.type}`); -if (orderListView.columns && typeof orderListView.columns[0] === 'object') { - console.log(` Columns: ${orderListView.columns.map(c => typeof c === 'object' ? c.field : c).join(', ')}`); -} -console.log(); - -console.log('✅ E-commerce example completed successfully!'); -console.log('\n💡 Use Case: Build an online store with product catalog and order management'); diff --git a/packages/examples/src/index.ts b/packages/examples/src/index.ts deleted file mode 100644 index 2200987..0000000 --- a/packages/examples/src/index.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * ObjectStack Examples Package - * - * This package contains example applications demonstrating - * different use cases for ObjectStack: - * - E-commerce (Product, Order) - * - Blog (Post, Author) - * - CRM (Comprehensive - All core modules) - */ - -// Export E-commerce objects -export { productObject } from './data/product.object.js'; -export { orderObject } from './data/order.object.js'; - -// Export Blog objects -export { blogPostObject } from './data/blog-post.object.js'; -export { authorObject } from './data/author.object.js'; - -// Export CRM objects -export { accountObject } from './data/account.object.js'; -export { opportunityObject } from './data/opportunity.object.js'; -export { leadObject } from './data/lead.object.js'; -export { caseObject } from './data/case.object.js'; -export { campaignObject } from './data/campaign.object.js'; -export { quoteObject } from './data/quote.object.js'; -export { contractObject } from './data/contract.object.js'; -export { activityTaskObject, eventObject, callObject } from './data/activity.object.js'; - -// Export E-commerce views -export { productListView, orderListView } from './ui/ecommerce.view.js'; - -// Export Blog views -export { blogPostListView, authorListView } from './ui/blog.view.js'; - -// Export CRM views -export { accountListView, opportunityListView, opportunityKanbanView } from './ui/crm.view.js'; -export { - leadListView, - leadKanbanView, - caseListView, - campaignListView, - quoteListView, - contractListView, - taskListView, - eventListView, - callListView -} from './ui/crm-extended.view.js'; - -// Re-export types from @objectstack/spec for convenience -export type { Data, UI, System, AI, API } from '@objectstack/spec'; diff --git a/packages/examples/src/ui/blog.view.ts b/packages/examples/src/ui/blog.view.ts deleted file mode 100644 index 3486008..0000000 --- a/packages/examples/src/ui/blog.view.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type { UI } from '@objectstack/spec'; - -/** - * Blog Post List View - * Grid view for managing blog posts - */ -export const blogPostListView: UI.ListView = { - name: 'blog_post_list', - label: 'Blog Posts', - type: 'grid', - data: { - provider: 'object', - object: 'blog_post' - }, - columns: [ - { field: 'title', width: 300 }, - { field: 'author', width: 150 }, - { field: 'status', width: 120 }, - { field: 'published_date', width: 150 }, - { field: 'view_count', width: 100 } - ] -}; - -/** - * Author List View - * Grid view for managing authors - */ -export const authorListView: UI.ListView = { - name: 'author_list', - label: 'Authors', - type: 'grid', - data: { - provider: 'object', - object: 'author' - }, - columns: [ - { field: 'name', width: 200 }, - { field: 'email', width: 200 }, - { field: 'website', width: 200 }, - { field: 'is_active', width: 80 }, - { field: 'joined_date', width: 120 } - ] -}; - -export default { blogPostListView, authorListView }; diff --git a/packages/examples/src/ui/crm-extended.view.ts b/packages/examples/src/ui/crm-extended.view.ts deleted file mode 100644 index 14cb8db..0000000 --- a/packages/examples/src/ui/crm-extended.view.ts +++ /dev/null @@ -1,216 +0,0 @@ -import type { UI } from '@objectstack/spec'; - -/** - * Lead List View - * Grid view for managing leads - */ -export const leadListView: UI.ListView = { - name: 'lead_list', - label: 'Leads', - type: 'grid', - data: { - provider: 'object', - object: 'lead' - }, - columns: [ - { field: 'first_name', width: 120 }, - { field: 'last_name', width: 120 }, - { field: 'company', width: 200 }, - { field: 'email', width: 200 }, - { field: 'lead_status', width: 120 }, - { field: 'rating', width: 100 }, - { field: 'lead_source', width: 120 } - ] -}; - -/** - * Lead Kanban View - * Kanban board for visual lead pipeline management - */ -export const leadKanbanView: UI.ListView = { - name: 'lead_kanban', - label: 'Lead Pipeline', - type: 'kanban', - data: { - provider: 'object', - object: 'lead' - }, - columns: [ - 'first_name', - 'last_name', - 'company', - 'email', - 'phone' - ] -}; - -/** - * Case List View - * Grid view for managing customer support cases - */ -export const caseListView: UI.ListView = { - name: 'case_list', - label: 'Cases', - type: 'grid', - data: { - provider: 'object', - object: 'case' - }, - columns: [ - { field: 'case_number', width: 120 }, - { field: 'subject', width: 250 }, - { field: 'status', width: 140 }, - { field: 'priority', width: 100 }, - { field: 'type', width: 130 }, - { field: 'contact', width: 150 }, - { field: 'owner', width: 150 } - ] -}; - -/** - * Campaign List View - * Grid view for managing marketing campaigns - */ -export const campaignListView: UI.ListView = { - name: 'campaign_list', - label: 'Campaigns', - type: 'grid', - data: { - provider: 'object', - object: 'campaign' - }, - columns: [ - { field: 'name', width: 250 }, - { field: 'campaign_type', width: 140 }, - { field: 'status', width: 120 }, - { field: 'start_date', width: 120 }, - { field: 'budget', width: 120 }, - { field: 'num_sent', width: 100 }, - { field: 'num_responses', width: 120 } - ] -}; - -/** - * Quote List View - * Grid view for managing sales quotes - */ -export const quoteListView: UI.ListView = { - name: 'quote_list', - label: 'Quotes', - type: 'grid', - data: { - provider: 'object', - object: 'quote' - }, - columns: [ - { field: 'quote_number', width: 120 }, - { field: 'name', width: 200 }, - { field: 'account', width: 180 }, - { field: 'status', width: 120 }, - { field: 'total_amount', width: 130 }, - { field: 'quote_date', width: 120 }, - { field: 'valid_until', width: 120 } - ] -}; - -/** - * Contract List View - * Grid view for managing contracts - */ -export const contractListView: UI.ListView = { - name: 'contract_list', - label: 'Contracts', - type: 'grid', - data: { - provider: 'object', - object: 'contract' - }, - columns: [ - { field: 'contract_number', width: 130 }, - { field: 'contract_name', width: 220 }, - { field: 'account', width: 180 }, - { field: 'status', width: 120 }, - { field: 'contract_type', width: 150 }, - { field: 'start_date', width: 120 }, - { field: 'end_date', width: 120 }, - { field: 'contract_value', width: 130 } - ] -}; - -/** - * Task List View - * Grid view for managing tasks - */ -export const taskListView: UI.ListView = { - name: 'task_list', - label: 'Tasks', - type: 'grid', - data: { - provider: 'object', - object: 'activity_task' - }, - columns: [ - { field: 'subject', width: 250 }, - { field: 'status', width: 120 }, - { field: 'priority', width: 100 }, - { field: 'assigned_to', width: 150 }, - { field: 'due_date', width: 120 } - ] -}; - -/** - * Event List View - * Grid view for managing events - */ -export const eventListView: UI.ListView = { - name: 'event_list', - label: 'Events', - type: 'grid', - data: { - provider: 'object', - object: 'event' - }, - columns: [ - { field: 'subject', width: 250 }, - { field: 'event_type', width: 140 }, - { field: 'start_datetime', width: 180 }, - { field: 'end_datetime', width: 180 }, - { field: 'location', width: 150 }, - { field: 'organizer', width: 150 } - ] -}; - -/** - * Call List View - * Grid view for managing call logs - */ -export const callListView: UI.ListView = { - name: 'call_list', - label: 'Call Logs', - type: 'grid', - data: { - provider: 'object', - object: 'call' - }, - columns: [ - { field: 'subject', width: 200 }, - { field: 'call_type', width: 100 }, - { field: 'call_purpose', width: 130 }, - { field: 'call_datetime', width: 180 }, - { field: 'call_duration', width: 120 }, - { field: 'call_result', width: 130 }, - { field: 'caller', width: 150 } - ] -}; - -export default { - leadListView, - leadKanbanView, - caseListView, - campaignListView, - quoteListView, - contractListView, - taskListView, - eventListView, - callListView -}; diff --git a/packages/examples/src/ui/crm.view.ts b/packages/examples/src/ui/crm.view.ts deleted file mode 100644 index 5ec06f1..0000000 --- a/packages/examples/src/ui/crm.view.ts +++ /dev/null @@ -1,67 +0,0 @@ -import type { UI } from '@objectstack/spec'; - -/** - * Account List View - * Grid view for managing accounts - */ -export const accountListView: UI.ListView = { - name: 'account_list', - label: 'Accounts', - type: 'grid', - data: { - provider: 'object', - object: 'account' - }, - columns: [ - { field: 'name', width: 250 }, - { field: 'industry', width: 150 }, - { field: 'type', width: 120 }, - { field: 'annual_revenue', width: 150 }, - { field: 'employee_count', width: 120 }, - { field: 'phone', width: 150 } - ] -}; - -/** - * Opportunity List View - * Grid view for managing opportunities - */ -export const opportunityListView: UI.ListView = { - name: 'opportunity_list', - label: 'Opportunities', - type: 'grid', - data: { - provider: 'object', - object: 'opportunity' - }, - columns: [ - { field: 'name', width: 250 }, - { field: 'account', width: 200 }, - { field: 'stage', width: 150 }, - { field: 'amount', width: 120 }, - { field: 'probability', width: 100 }, - { field: 'expected_close_date', width: 150 } - ] -}; - -/** - * Opportunity Kanban View - * Kanban board for visual opportunity pipeline management - */ -export const opportunityKanbanView: UI.ListView = { - name: 'opportunity_kanban', - label: 'Sales Pipeline', - type: 'kanban', - data: { - provider: 'object', - object: 'opportunity' - }, - columns: [ - 'name', - 'amount', - 'probability', - 'expected_close_date' - ] -}; - -export default { accountListView, opportunityListView, opportunityKanbanView }; diff --git a/packages/examples/src/ui/ecommerce.view.ts b/packages/examples/src/ui/ecommerce.view.ts deleted file mode 100644 index 6b022b7..0000000 --- a/packages/examples/src/ui/ecommerce.view.ts +++ /dev/null @@ -1,47 +0,0 @@ -import type { UI } from '@objectstack/spec'; - -/** - * Product List View - * Grid view for managing products - */ -export const productListView: UI.ListView = { - name: 'product_list', - label: 'Products', - type: 'grid', - data: { - provider: 'object', - object: 'product' - }, - columns: [ - { field: 'name', width: 200 }, - { field: 'sku', width: 120 }, - { field: 'price', width: 100 }, - { field: 'category', width: 150 }, - { field: 'stock_quantity', width: 120 }, - { field: 'is_active', width: 80 } - ] -}; - -/** - * Order List View - * Grid view for managing orders - */ -export const orderListView: UI.ListView = { - name: 'order_list', - label: 'Orders', - type: 'grid', - data: { - provider: 'object', - object: 'order' - }, - columns: [ - { field: 'order_number', width: 150 }, - { field: 'customer_name', width: 200 }, - { field: 'status', width: 120 }, - { field: 'total_amount', width: 120 }, - { field: 'order_date', width: 150 }, - { field: 'payment_method', width: 150 } - ] -}; - -export default { productListView, orderListView }; diff --git a/packages/examples/tsconfig.json b/packages/examples/tsconfig.json deleted file mode 100644 index d48f015..0000000 --- a/packages/examples/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "module": "ESNext", - "lib": ["ES2022"], - "moduleResolution": "bundler", - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "outDir": "./dist", - "rootDir": "./src", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true, - "allowSyntheticDefaultImports": true, - "composite": true - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist"], - "references": [ - { "path": "../core" } - ] -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml deleted file mode 100644 index 7f2ce5f..0000000 --- a/pnpm-lock.yaml +++ /dev/null @@ -1,81 +0,0 @@ -lockfileVersion: '9.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -importers: - - .: - devDependencies: - '@types/node': - specifier: ^25.0.10 - version: 25.0.10 - typescript: - specifier: ^5.3.0 - version: 5.9.3 - - packages/core: - dependencies: - '@objectstack/spec': - specifier: ^0.3.3 - version: 0.3.3 - devDependencies: - '@types/node': - specifier: ^25.0.10 - version: 25.0.10 - typescript: - specifier: ^5.3.0 - version: 5.9.3 - - packages/examples: - dependencies: - '@objectstack-starter/core': - specifier: workspace:* - version: link:../core - '@objectstack/spec': - specifier: ^0.3.3 - version: 0.3.3 - devDependencies: - '@types/node': - specifier: ^25.0.10 - version: 25.0.10 - typescript: - specifier: ^5.3.0 - version: 5.9.3 - -packages: - - '@objectstack/spec@0.3.3': - resolution: {integrity: sha512-GGSrRLECgYY1epLocdCkCsicerFKAKlRpluGmCqK1iVNgTgiC04zniLogYQXu5kf6UIB6mHQNBHcbr1x5DOmVQ==} - engines: {node: '>=18.0.0'} - - '@types/node@25.0.10': - resolution: {integrity: sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg==} - - typescript@5.9.3: - resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} - engines: {node: '>=14.17'} - hasBin: true - - undici-types@7.16.0: - resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==} - - zod@3.25.76: - resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==} - -snapshots: - - '@objectstack/spec@0.3.3': - dependencies: - zod: 3.25.76 - - '@types/node@25.0.10': - dependencies: - undici-types: 7.16.0 - - typescript@5.9.3: {} - - undici-types@7.16.0: {} - - zod@3.25.76: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml deleted file mode 100644 index 18ec407..0000000 --- a/pnpm-workspace.yaml +++ /dev/null @@ -1,2 +0,0 @@ -packages: - - 'packages/*' diff --git a/src/example.ts b/src/example.ts new file mode 100644 index 0000000..b1a8a21 --- /dev/null +++ b/src/example.ts @@ -0,0 +1,53 @@ +/** + * Example Usage + * + * This file demonstrates how to use your ObjectStack plugin. + */ + +import { + config, + exampleObject, + exampleListView, + exampleKanbanView +} from './index.js'; + +// Display plugin configuration +console.log('='.repeat(60)); +console.log('ObjectStack Plugin Starter Template'); +console.log('='.repeat(60)); +console.log(); + +console.log('📦 Plugin Configuration:'); +console.log(' ID:', config.id); +console.log(' Name:', config.name); +console.log(' Version:', config.version); +console.log(' Type:', config.type); +console.log(' Description:', config.description); +console.log(); + +// Display object definition +console.log('📊 Example Object:', exampleObject.name); +console.log(' Label:', exampleObject.label); +console.log(' Fields:', Object.keys(exampleObject.fields).join(', ')); +console.log(); + +// Display views +console.log('👁️ Views:'); +console.log(' List View:', exampleListView.name); +console.log(' Type:', exampleListView.type); +console.log(' Columns:', exampleListView.columns.length); +console.log(); +console.log(' Kanban View:', exampleKanbanView.name); +console.log(' Type:', exampleKanbanView.type); +console.log(' Group By Field:', exampleKanbanView.kanban?.groupByField); +console.log(); + +console.log('✅ Plugin loaded successfully!'); +console.log(); +console.log('Next Steps:'); +console.log(' 1. Customize objectstack.config.ts with your plugin details'); +console.log(' 2. Modify or add objects in src/objects/'); +console.log(' 3. Modify or add views in src/views/'); +console.log(' 4. Export everything in src/index.ts'); +console.log(' 5. Build with: npm run build'); +console.log(); diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..f1f7894 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,18 @@ +/** + * ObjectStack Plugin Entry Point + * + * This is the main entry point for your ObjectStack plugin. + * Export all your objects, views, and configuration here. + */ + +// Export plugin configuration +export { config, default } from './objectstack.config.js'; + +// Export objects +export { exampleObject } from './objects/example.object.js'; + +// Export views +export { exampleListView, exampleKanbanView } from './views/example.view.js'; + +// Re-export types from @objectstack/spec for convenience +export type { Data, UI, System, AI, API } from '@objectstack/spec'; diff --git a/src/objects/example.object.ts b/src/objects/example.object.ts new file mode 100644 index 0000000..b8e96b4 --- /dev/null +++ b/src/objects/example.object.ts @@ -0,0 +1,74 @@ +import { Data } from '@objectstack/spec'; + +/** + * Example Object Definition + * + * This demonstrates how to define a data object in ObjectStack. + * Objects define the structure of your data entities. + */ +export const exampleObject = Data.ObjectSchema.create({ + /** + * Object name (machine name, use snake_case) + */ + name: 'example_object', + + /** + * Human-readable label (singular) + */ + label: 'Example', + + /** + * Human-readable label (plural) + */ + pluralLabel: 'Examples', + + /** + * Object description + */ + description: 'An example object to demonstrate ObjectStack data modeling', + + /** + * Field definitions + */ + fields: { + /** + * Name field (required text field) + */ + name: { + type: 'text', + label: 'Name', + required: true + }, + + /** + * Description field (optional textarea) + */ + description: { + type: 'textarea', + label: 'Description' + }, + + /** + * Status field (select field with predefined options) + */ + status: { + type: 'select', + label: 'Status', + required: true, + defaultValue: 'draft', + options: [ + { label: 'Draft', value: 'draft' }, + { label: 'Active', value: 'active' }, + { label: 'Archived', value: 'archived' } + ] + }, + + /** + * Created date (automatically managed) + */ + created_at: { + type: 'datetime', + label: 'Created At' + } + } +}); diff --git a/src/objectstack.config.ts b/src/objectstack.config.ts new file mode 100644 index 0000000..e035562 --- /dev/null +++ b/src/objectstack.config.ts @@ -0,0 +1,37 @@ +import type { System } from '@objectstack/spec'; + +/** + * ObjectStack Plugin Configuration + * + * This configuration file defines the metadata for your ObjectStack plugin. + * It specifies the plugin's identity, type, and basic information. + */ +export const config: System.ObjectStackManifest = { + /** + * Plugin ID (machine name, use lowercase with hyphens) + * This is used to identify your plugin in the ObjectStack ecosystem + */ + id: 'my-plugin', + + /** + * Plugin name + */ + name: 'my-plugin', + + /** + * Plugin version following semantic versioning + */ + version: '0.1.0', + + /** + * Plugin type - can be 'plugin', 'app', 'package', etc. + */ + type: 'plugin', + + /** + * Human-readable description of what this plugin does + */ + description: 'A starter template for creating ObjectStack plugins' +}; + +export default config; diff --git a/src/views/example.view.ts b/src/views/example.view.ts new file mode 100644 index 0000000..64e9b63 --- /dev/null +++ b/src/views/example.view.ts @@ -0,0 +1,102 @@ +import type { UI } from '@objectstack/spec'; + +/** + * Example List View + * + * This demonstrates how to define a list view in ObjectStack. + * Views define how data is displayed in the UI. + */ +export const exampleListView: UI.ListView = { + /** + * View name (machine name, use snake_case) + */ + name: 'example_list', + + /** + * Human-readable label + */ + label: 'Examples', + + /** + * View type - determines how data is displayed + * Common types: 'grid', 'kanban', 'calendar', 'gallery' + */ + type: 'grid', + + /** + * Column definitions for grid view + */ + columns: [ + { + field: 'name', + label: 'Name', + width: 200 + }, + { + field: 'description', + label: 'Description', + width: 300 + }, + { + field: 'status', + label: 'Status', + width: 120 + }, + { + field: 'created_at', + label: 'Created', + width: 150 + } + ], + + /** + * Data provider configuration + */ + data: { + provider: 'object', + object: 'example_object' + } +}; + +/** + * Example Kanban View + * + * Demonstrates a kanban board view organized by status + */ +export const exampleKanbanView: UI.ListView = { + /** + * View name + */ + name: 'example_kanban', + + /** + * Human-readable label + */ + label: 'Examples Board', + + /** + * View type for kanban board + */ + type: 'kanban', + + /** + * Columns to display (required for all views) + */ + columns: ['name', 'status', 'created_at'], + + /** + * Data provider configuration + */ + data: { + provider: 'object', + object: 'example_object' + }, + + /** + * Kanban configuration + */ + kanban: { + groupByField: 'status', + columns: ['draft', 'active', 'archived'] + } +}; diff --git a/tsconfig.json b/tsconfig.json index 7092a21..eb4b704 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,31 @@ { - "files": [], - "references": [ - { "path": "./packages/core" }, - { "path": "./packages/examples" } + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "lib": ["ES2022"], + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "./dist", + "rootDir": "./src", + "resolveJsonModule": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules", + "dist", + "packages" ] }