Skip to content

Commit 9b14a34

Browse files
authored
Merge pull request #827 from objectstack-ai/copilot/audit-definestack-metadata
2 parents f4ed51a + 96bb585 commit 9b14a34

File tree

9 files changed

+338
-15
lines changed

9 files changed

+338
-15
lines changed

ROADMAP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@ The `FlowDesigner` is a canvas-based flow editor that bridges the gap between th
851851
- [x] **P2: Spec Compliance Audit** — Fixed `variant: 'danger'``'destructive'` (4 actions), `columns: string``number` (33 form sections), added `type: 'dashboard'` to dashboard
852852
- [x] **P2: Dashboard Widget Spec Alignment** — Added `id`, `title`, `object`, `categoryField`, `valueField`, `aggregate` to all dashboard widgets across CRM, Todo, and Kitchen Sink examples (5 new spec-compliance tests)
853853
- [x] **P2: i18n (10 locales)** — Full CRM metadata translations for en, zh, ja, ko, de, fr, es, pt, ru, ar — objects, fields, fieldOptions, navigation, actions, views, formSections, dashboard, reports, pages (24 tests)
854+
- [x] **P2: Full Examples Metadata Audit** — Systematic spec compliance audit across all 4 examples: added `type: 'dashboard'` + `description` to todo/kitchen-sink dashboards, refactored msw-todo to use `ObjectSchema.create` + `Field.*` with snake_case field names, added explicit views to kitchen-sink and msw-todo, added missing `successMessage` on CRM opportunity action, 21 automated compliance tests
854855

855856
### Ecosystem & Marketplace
856857
- Plugin marketplace website with search, ratings, and install count

examples/crm/src/actions/account.actions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ export const AccountActions = [
3333
confirmText: 'Are you sure you want to merge these accounts? This action cannot be undone.',
3434
variant: 'danger' as const,
3535
refreshAfter: true,
36+
successMessage: 'Accounts merged successfully',
3637
},
3738
];

examples/crm/src/actions/opportunity.actions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ export const OpportunityActions = [
4444
],
4545
confirmText: 'Mark this opportunity as Closed Lost?',
4646
refreshAfter: true,
47+
successMessage: 'Opportunity marked as lost',
4748
},
4849
];

examples/crm/src/dashboards/crm.dashboard.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export const CrmDashboard = {
22
type: 'dashboard' as const,
33
name: 'crm_dashboard',
44
label: 'CRM Overview',
5+
description: 'Revenue metrics, pipeline analytics, and deal insights',
56
widgets: [
67
// --- KPI Row ---
78
{

examples/kitchen-sink/objectstack.config.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,43 @@ export default defineStack({
1717
AccountObject,
1818
ShowcaseObject
1919
],
20+
views: [
21+
{
22+
listViews: {
23+
all_fields: {
24+
name: 'all_fields',
25+
label: 'All Field Types',
26+
type: 'grid' as const,
27+
data: { provider: 'object' as const, object: 'kitchen_sink' },
28+
columns: ['name', 'category', 'amount', 'price', 'percent', 'rating', 'due_date', 'is_active', 'email'],
29+
sort: [{ field: 'name', order: 'asc' as const }],
30+
},
31+
},
32+
},
33+
{
34+
listViews: {
35+
all_showcase: {
36+
name: 'all_showcase',
37+
label: 'All Showcase Items',
38+
type: 'grid' as const,
39+
data: { provider: 'object' as const, object: 'showcase' },
40+
columns: ['title', 'category', 'status', 'priority', 'price', 'start_date', 'owner_email', 'is_featured'],
41+
sort: [{ field: 'title', order: 'asc' as const }],
42+
},
43+
showcase_board: {
44+
name: 'showcase_board',
45+
label: 'Status Board',
46+
type: 'kanban' as const,
47+
data: { provider: 'object' as const, object: 'showcase' },
48+
columns: ['title', 'priority', 'owner_email', 'start_date'],
49+
kanban: {
50+
groupByField: 'status',
51+
columns: ['title', 'priority', 'owner_email'],
52+
},
53+
},
54+
},
55+
},
56+
],
2057
apps: [
2158
App.create({
2259
name: 'analytics_app',
@@ -67,6 +104,7 @@ export default defineStack({
67104
],
68105
dashboards: [
69106
{
107+
type: 'dashboard' as const,
70108
name: 'showcase_dashboard',
71109
label: 'Platform Showcase',
72110
description: 'Demonstrating all dashboard widget types',

examples/msw-todo/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,18 @@ Create an `objectstack.config.ts` to define your data models and application str
3636
```typescript
3737
// objectstack.config.ts
3838
import { defineStack } from '@objectstack/spec';
39+
import { ObjectSchema, Field } from '@objectstack/spec/data';
3940
import { App } from '@objectstack/spec/ui';
4041

41-
export const TaskObject = {
42+
export const TaskObject = ObjectSchema.create({
4243
name: 'task',
4344
label: 'Task',
4445
fields: {
45-
subject: { type: 'text', required: true },
46-
priority: { type: 'number', defaultValue: 1 },
47-
isCompleted: { type: 'boolean', defaultValue: false }
48-
}
49-
};
46+
subject: Field.text({ label: 'Subject', required: true }),
47+
priority: Field.number({ label: 'Priority', defaultValue: 5 }),
48+
is_completed: Field.boolean({ label: 'Completed', defaultValue: false }),
49+
},
50+
});
5051

5152
export default defineStack({
5253
objects: [TaskObject],

examples/msw-todo/objectstack.config.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { defineStack } from '@objectstack/spec';
2+
import { ObjectSchema, Field } from '@objectstack/spec/data';
23
import { App } from '@objectstack/spec/ui';
34

45
/**
5-
* Task Object Definition
6+
* Task Object Definition — uses ObjectSchema.create + Field.* for spec compliance
67
*/
7-
export const TaskObject = {
8+
export const TaskObject = ObjectSchema.create({
89
name: 'task',
910
label: 'Task',
1011
description: 'Task management object',
@@ -18,13 +19,12 @@ export const TaskObject = {
1819
mru: true,
1920
},
2021
fields: {
21-
id: { name: 'id', label: 'ID', type: 'text', required: true },
22-
subject: { name: 'subject', label: 'Subject', type: 'text', required: true },
23-
priority: { name: 'priority', label: 'Priority', type: 'number', defaultValue: 5 },
24-
isCompleted: { name: 'isCompleted', label: 'Completed', type: 'boolean', defaultValue: false },
25-
createdAt: { name: 'createdAt', label: 'Created At', type: 'datetime' }
26-
}
27-
};
22+
subject: Field.text({ label: 'Subject', required: true }),
23+
priority: Field.number({ label: 'Priority', defaultValue: 5 }),
24+
is_completed: Field.boolean({ label: 'Completed', defaultValue: false }),
25+
created_at: Field.datetime({ label: 'Created At', readonly: true }),
26+
},
27+
});
2828

2929
/**
3030
* App Configuration — Standard ObjectStackDefinition format
@@ -33,6 +33,20 @@ export default defineStack({
3333
objects: [
3434
TaskObject
3535
],
36+
views: [
37+
{
38+
listViews: {
39+
all_tasks: {
40+
name: 'all_tasks',
41+
label: 'All Tasks',
42+
type: 'grid' as const,
43+
data: { provider: 'object' as const, object: 'task' },
44+
columns: ['subject', 'priority', 'is_completed', 'created_at'],
45+
sort: [{ field: 'created_at', order: 'desc' as const }],
46+
},
47+
},
48+
},
49+
],
3650
apps: [
3751
App.create({
3852
name: 'task_app',

examples/todo/objectstack.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ export default defineStack({
107107
],
108108
dashboards: [
109109
{
110+
type: 'dashboard' as const,
110111
name: 'task_dashboard',
111112
label: 'Task Overview',
113+
description: 'Task metrics, status distribution, and category breakdown',
112114
widgets: [
113115
{
114116
id: 'todo_total_tasks',

0 commit comments

Comments
 (0)