@object-ui/types 3.1.5 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +20 -1
  3. package/dist/app.d.ts +4 -12
  4. package/dist/app.d.ts.map +1 -1
  5. package/dist/complex.d.ts +126 -1
  6. package/dist/complex.d.ts.map +1 -1
  7. package/dist/data-display.d.ts +6 -0
  8. package/dist/data-display.d.ts.map +1 -1
  9. package/dist/data.d.ts +34 -0
  10. package/dist/data.d.ts.map +1 -1
  11. package/dist/designer.d.ts +123 -0
  12. package/dist/designer.d.ts.map +1 -1
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/objectql.d.ts +14 -0
  16. package/dist/objectql.d.ts.map +1 -1
  17. package/dist/ui-action.d.ts +13 -0
  18. package/dist/ui-action.d.ts.map +1 -1
  19. package/dist/views.d.ts +10 -0
  20. package/dist/views.d.ts.map +1 -1
  21. package/dist/zod/complex.zod.d.ts +68 -2
  22. package/dist/zod/complex.zod.d.ts.map +1 -1
  23. package/dist/zod/complex.zod.js +19 -1
  24. package/dist/zod/data-display.zod.d.ts +2 -0
  25. package/dist/zod/data-display.zod.d.ts.map +1 -1
  26. package/dist/zod/data-display.zod.js +1 -0
  27. package/dist/zod/feedback.zod.d.ts +8 -8
  28. package/dist/zod/index.zod.d.ts +36 -10
  29. package/dist/zod/index.zod.d.ts.map +1 -1
  30. package/dist/zod/index.zod.js +1 -1
  31. package/dist/zod/navigation.zod.d.ts +2 -2
  32. package/dist/zod/objectql.zod.d.ts +8 -4
  33. package/dist/zod/objectql.zod.d.ts.map +1 -1
  34. package/dist/zod/objectql.zod.js +1 -0
  35. package/dist/zod/views.zod.d.ts +6 -2
  36. package/dist/zod/views.zod.d.ts.map +1 -1
  37. package/dist/zod/views.zod.js +2 -0
  38. package/package.json +22 -7
  39. package/src/app.ts +4 -4
  40. package/src/complex.ts +135 -1
  41. package/src/data-display.ts +6 -0
  42. package/src/data.ts +36 -0
  43. package/src/designer.ts +166 -0
  44. package/src/index.ts +11 -0
  45. package/src/objectql.ts +16 -0
  46. package/src/ui-action.ts +14 -0
  47. package/src/views.ts +10 -0
  48. package/src/zod/complex.zod.ts +20 -1
  49. package/src/zod/data-display.zod.ts +1 -0
  50. package/src/zod/index.zod.ts +1 -0
  51. package/src/zod/objectql.zod.ts +1 -0
  52. package/src/zod/views.zod.ts +2 -0
  53. package/src/__tests__/examples-metadata-compliance.test.ts +0 -264
@@ -1,264 +0,0 @@
1
- /**
2
- * Examples Metadata Spec Compliance Tests
3
- *
4
- * Validates that all defineStack configurations in examples/ conform to the
5
- * ObjectStack spec protocol. Ensures required fields are present and correctly
6
- * typed across objects, views, dashboards, pages, apps, and manifests.
7
- */
8
- import { describe, it, expect } from 'vitest';
9
- import { ObjectStackDefinitionSchema } from '@objectstack/spec';
10
-
11
- // ---------------------------------------------------------------------------
12
- // Helpers
13
- // ---------------------------------------------------------------------------
14
-
15
- /** Validate a defineStack result against the Zod schema */
16
- function expectValidStack(config: unknown, name: string) {
17
- const result = ObjectStackDefinitionSchema.safeParse(config);
18
- if (!result.success) {
19
- const issues = result.error.issues.map(
20
- (i) => ` [${i.path.join('.')}] ${i.message}`
21
- );
22
- throw new Error(
23
- `${name} failed spec validation:\n${issues.join('\n')}`
24
- );
25
- }
26
- expect(result.success).toBe(true);
27
- }
28
-
29
- // ---------------------------------------------------------------------------
30
- // Structural helpers — verify required keys exist on metadata objects
31
- // ---------------------------------------------------------------------------
32
-
33
- function assertDashboards(dashboards: any[], label: string) {
34
- for (const d of dashboards) {
35
- expect(d).toHaveProperty('name');
36
- expect(d).toHaveProperty('label');
37
- expect(d).toHaveProperty('description');
38
- expect(Array.isArray(d.widgets)).toBe(true);
39
-
40
- for (const w of d.widgets) {
41
- // defineStack normalizes widgets — id may be stripped, but title/type/layout should remain
42
- expect(w).toHaveProperty('title');
43
- expect(w).toHaveProperty('type');
44
- expect(w).toHaveProperty('layout');
45
- }
46
- }
47
- }
48
-
49
- function assertManifest(manifest: any) {
50
- expect(manifest).toHaveProperty('id');
51
- expect(manifest).toHaveProperty('version');
52
- expect(manifest).toHaveProperty('type', 'app');
53
- expect(manifest).toHaveProperty('name');
54
- expect(manifest).toHaveProperty('description');
55
- }
56
-
57
- function assertNavigation(items: any[]) {
58
- for (const item of items) {
59
- expect(item).toHaveProperty('id');
60
- expect(item).toHaveProperty('type');
61
- expect(item).toHaveProperty('label');
62
- if (item.children) {
63
- assertNavigation(item.children);
64
- }
65
- }
66
- }
67
-
68
- // ---------------------------------------------------------------------------
69
- // Tests
70
- // ---------------------------------------------------------------------------
71
-
72
- describe('Example: todo', () => {
73
- let config: any;
74
-
75
- it('should import cleanly', async () => {
76
- const mod = await import('../../../../examples/todo/objectstack.config');
77
- config = mod.default;
78
- expect(config).toBeDefined();
79
- });
80
-
81
- it('should pass ObjectStackDefinitionSchema validation', () => {
82
- expectValidStack(config, 'todo');
83
- });
84
-
85
- it('should have explicit views', () => {
86
- expect(Array.isArray(config.views)).toBe(true);
87
- expect(config.views.length).toBeGreaterThan(0);
88
- });
89
-
90
- it('objects should have name, label, and fields', () => {
91
- for (const obj of config.objects) {
92
- expect(obj).toHaveProperty('name');
93
- expect(obj).toHaveProperty('label');
94
- expect(obj).toHaveProperty('fields');
95
- }
96
- });
97
-
98
- it('dashboards should have name, label, description, and valid widgets', () => {
99
- assertDashboards(config.dashboards, 'todo');
100
- });
101
-
102
- it('pages should have name, label, type, and regions', () => {
103
- for (const page of config.pages ?? []) {
104
- expect(page).toHaveProperty('name');
105
- expect(page).toHaveProperty('label');
106
- expect(page).toHaveProperty('type');
107
- expect(page).toHaveProperty('regions');
108
- }
109
- });
110
-
111
- it('manifest should have required fields', () => {
112
- assertManifest(config.manifest);
113
- });
114
-
115
- it('apps navigation items should have id/type/label', () => {
116
- for (const app of config.apps) {
117
- assertNavigation(app.navigation ?? []);
118
- }
119
- });
120
- });
121
-
122
- describe('Example: kitchen-sink', () => {
123
- let config: any;
124
-
125
- it('should import cleanly', async () => {
126
- const mod = await import(
127
- '../../../../examples/kitchen-sink/objectstack.config'
128
- );
129
- config = mod.default;
130
- expect(config).toBeDefined();
131
- });
132
-
133
- it('should pass ObjectStackDefinitionSchema validation', () => {
134
- expectValidStack(config, 'kitchen-sink');
135
- });
136
-
137
- it('objects should have name, label, and fields', () => {
138
- for (const obj of config.objects) {
139
- expect(obj).toHaveProperty('name');
140
- expect(obj).toHaveProperty('label');
141
- expect(obj).toHaveProperty('fields');
142
- }
143
- });
144
-
145
- it('should have explicit views', () => {
146
- expect(Array.isArray(config.views)).toBe(true);
147
- expect(config.views.length).toBeGreaterThan(0);
148
- });
149
-
150
- it('dashboards should have name, label, description, and valid widgets', () => {
151
- assertDashboards(config.dashboards, 'kitchen-sink');
152
- });
153
-
154
- it('pages should have name, label, type, and regions', () => {
155
- for (const page of config.pages ?? []) {
156
- expect(page).toHaveProperty('name');
157
- expect(page).toHaveProperty('label');
158
- expect(page).toHaveProperty('type');
159
- expect(page).toHaveProperty('regions');
160
- }
161
- });
162
-
163
- it('manifest should have required fields', () => {
164
- assertManifest(config.manifest);
165
- });
166
-
167
- it('apps navigation items should have id/type/label', () => {
168
- for (const app of config.apps) {
169
- assertNavigation(app.navigation ?? []);
170
- }
171
- });
172
- });
173
-
174
- describe('Example: crm', () => {
175
- let config: any;
176
-
177
- it('should import cleanly', async () => {
178
- const mod = await import('../../../../examples/crm/objectstack.config');
179
- config = mod.default;
180
- expect(config).toBeDefined();
181
- });
182
-
183
- it('should pass ObjectStackDefinitionSchema validation', () => {
184
- expectValidStack(config, 'crm');
185
- });
186
-
187
- it('objects should have name, label, and fields', () => {
188
- for (const obj of config.objects) {
189
- expect(obj).toHaveProperty('name');
190
- expect(obj).toHaveProperty('label');
191
- expect(obj).toHaveProperty('fields');
192
- }
193
- });
194
-
195
- it('should have explicit views', () => {
196
- expect(Array.isArray(config.views)).toBe(true);
197
- expect(config.views.length).toBeGreaterThan(0);
198
- });
199
-
200
- it('dashboards should have name, label, description, and valid widgets', () => {
201
- assertDashboards(config.dashboards, 'crm');
202
- });
203
-
204
- it('pages should have name, label, type, and regions', () => {
205
- for (const page of config.pages ?? []) {
206
- expect(page).toHaveProperty('name');
207
- expect(page).toHaveProperty('label');
208
- expect(page).toHaveProperty('type');
209
- expect(page).toHaveProperty('regions');
210
- }
211
- });
212
-
213
- it('manifest should have required fields', () => {
214
- assertManifest(config.manifest);
215
- });
216
-
217
- it('apps navigation items should have id/type/label', () => {
218
- for (const app of config.apps) {
219
- assertNavigation(app.navigation ?? []);
220
- }
221
- });
222
- });
223
-
224
- describe('Example: msw-todo', () => {
225
- let config: any;
226
-
227
- it('should import cleanly', async () => {
228
- const mod = await import(
229
- '../../../../examples/msw-todo/objectstack.config'
230
- );
231
- config = mod.default;
232
- expect(config).toBeDefined();
233
- });
234
-
235
- it('should pass ObjectStackDefinitionSchema validation', () => {
236
- expectValidStack(config, 'msw-todo');
237
- });
238
-
239
- it('should have explicit views', () => {
240
- expect(Array.isArray(config.views)).toBe(true);
241
- expect(config.views.length).toBeGreaterThan(0);
242
- });
243
-
244
- it('objects should use ObjectSchema.create (have normalized defaults)', () => {
245
- for (const obj of config.objects) {
246
- // ObjectSchema.create populates normalized defaults like active, isSystem, datasource
247
- expect(obj).toHaveProperty('name');
248
- expect(obj).toHaveProperty('label');
249
- expect(obj).toHaveProperty('fields');
250
- expect(obj).toHaveProperty('active', true);
251
- expect(obj).toHaveProperty('datasource', 'default');
252
- }
253
- });
254
-
255
- it('manifest should have required fields', () => {
256
- assertManifest(config.manifest);
257
- });
258
-
259
- it('apps navigation items should have id/type/label', () => {
260
- for (const app of config.apps) {
261
- assertNavigation(app.navigation ?? []);
262
- }
263
- });
264
- });