@object-ui/types 0.3.1 → 2.0.0

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 (141) hide show
  1. package/README.md +1 -1
  2. package/dist/ai.d.ts +376 -0
  3. package/dist/ai.d.ts.map +1 -0
  4. package/dist/ai.js +8 -0
  5. package/dist/app.d.ts +10 -0
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/blocks.d.ts +332 -0
  8. package/dist/blocks.d.ts.map +1 -0
  9. package/dist/blocks.js +8 -0
  10. package/dist/crud.d.ts +177 -3
  11. package/dist/crud.d.ts.map +1 -1
  12. package/dist/data-display.d.ts +35 -0
  13. package/dist/data-display.d.ts.map +1 -1
  14. package/dist/data-protocol.d.ts +1268 -0
  15. package/dist/data-protocol.d.ts.map +1 -0
  16. package/dist/data-protocol.js +8 -0
  17. package/dist/data.d.ts +74 -1
  18. package/dist/data.d.ts.map +1 -1
  19. package/dist/designer.d.ts +473 -0
  20. package/dist/designer.d.ts.map +1 -0
  21. package/dist/designer.js +8 -0
  22. package/dist/field-types.d.ts +353 -11
  23. package/dist/field-types.d.ts.map +1 -1
  24. package/dist/form.d.ts +35 -1
  25. package/dist/form.d.ts.map +1 -1
  26. package/dist/index.d.ts +58 -4
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +18 -0
  29. package/dist/layout.d.ts +63 -8
  30. package/dist/layout.d.ts.map +1 -1
  31. package/dist/mobile.d.ts +186 -0
  32. package/dist/mobile.d.ts.map +1 -0
  33. package/dist/mobile.js +8 -0
  34. package/dist/objectql.d.ts +337 -89
  35. package/dist/objectql.d.ts.map +1 -1
  36. package/dist/permissions.d.ts +150 -0
  37. package/dist/permissions.d.ts.map +1 -0
  38. package/dist/permissions.js +8 -0
  39. package/dist/plugin-scope.d.ts +194 -0
  40. package/dist/plugin-scope.d.ts.map +1 -0
  41. package/dist/plugin-scope.js +8 -0
  42. package/dist/reports.d.ts +336 -0
  43. package/dist/reports.d.ts.map +1 -0
  44. package/dist/reports.js +8 -0
  45. package/dist/tenant.d.ts +138 -0
  46. package/dist/tenant.d.ts.map +1 -0
  47. package/dist/tenant.js +8 -0
  48. package/dist/theme.d.ts +180 -0
  49. package/dist/theme.d.ts.map +1 -0
  50. package/dist/theme.js +8 -0
  51. package/dist/ui-action.d.ts +290 -0
  52. package/dist/ui-action.d.ts.map +1 -0
  53. package/dist/ui-action.js +8 -0
  54. package/dist/views.d.ts +427 -0
  55. package/dist/views.d.ts.map +1 -0
  56. package/dist/views.js +8 -0
  57. package/dist/widget.d.ts +181 -0
  58. package/dist/widget.d.ts.map +1 -0
  59. package/dist/widget.js +8 -0
  60. package/dist/workflow.d.ts +340 -0
  61. package/dist/workflow.d.ts.map +1 -0
  62. package/dist/workflow.js +8 -0
  63. package/dist/zod/app.zod.d.ts +120 -0
  64. package/dist/zod/app.zod.d.ts.map +1 -0
  65. package/dist/zod/app.zod.js +60 -0
  66. package/dist/zod/blocks.zod.d.ts +834 -0
  67. package/dist/zod/blocks.zod.d.ts.map +1 -0
  68. package/dist/zod/blocks.zod.js +145 -0
  69. package/dist/zod/complex.zod.d.ts +4 -4
  70. package/dist/zod/complex.zod.js +1 -1
  71. package/dist/zod/crud.zod.d.ts +598 -0
  72. package/dist/zod/crud.zod.d.ts.map +1 -0
  73. package/dist/zod/crud.zod.js +230 -0
  74. package/dist/zod/data-display.zod.js +1 -1
  75. package/dist/zod/disclosure.zod.js +1 -1
  76. package/dist/zod/feedback.zod.d.ts +10 -10
  77. package/dist/zod/feedback.zod.js +1 -1
  78. package/dist/zod/form.zod.d.ts +4 -4
  79. package/dist/zod/form.zod.js +1 -1
  80. package/dist/zod/index.zod.d.ts +2032 -30
  81. package/dist/zod/index.zod.d.ts.map +1 -1
  82. package/dist/zod/index.zod.js +96 -19
  83. package/dist/zod/layout.zod.d.ts +134 -2
  84. package/dist/zod/layout.zod.d.ts.map +1 -1
  85. package/dist/zod/layout.zod.js +35 -1
  86. package/dist/zod/navigation.zod.js +1 -1
  87. package/dist/zod/objectql.zod.d.ts +34 -18
  88. package/dist/zod/objectql.zod.d.ts.map +1 -1
  89. package/dist/zod/objectql.zod.js +9 -1
  90. package/dist/zod/overlay.zod.js +1 -1
  91. package/dist/zod/reports.zod.d.ts +1628 -0
  92. package/dist/zod/reports.zod.d.ts.map +1 -0
  93. package/dist/zod/reports.zod.js +152 -0
  94. package/dist/zod/theme.zod.d.ts +1292 -0
  95. package/dist/zod/theme.zod.d.ts.map +1 -0
  96. package/dist/zod/theme.zod.js +260 -0
  97. package/dist/zod/views.zod.d.ts +675 -0
  98. package/dist/zod/views.zod.d.ts.map +1 -0
  99. package/dist/zod/views.zod.js +159 -0
  100. package/package.json +3 -2
  101. package/src/__tests__/namespace-exports.test.ts +36 -0
  102. package/src/__tests__/phase2-schemas.test.ts +634 -0
  103. package/src/ai.ts +454 -0
  104. package/src/app.ts +12 -0
  105. package/src/blocks.ts +405 -0
  106. package/src/crud.ts +180 -3
  107. package/src/data-display.ts +31 -0
  108. package/src/data-protocol.ts +1679 -0
  109. package/src/data.ts +84 -1
  110. package/src/designer.ts +509 -0
  111. package/src/field-types.ts +392 -11
  112. package/src/form.ts +35 -1
  113. package/src/index.ts +426 -0
  114. package/src/layout.ts +66 -8
  115. package/src/mobile.ts +205 -0
  116. package/src/objectql.ts +412 -94
  117. package/src/permissions.ts +166 -0
  118. package/src/plugin-scope.ts +210 -0
  119. package/src/reports.ts +408 -0
  120. package/src/tenant.ts +153 -0
  121. package/src/theme.ts +238 -0
  122. package/src/ui-action.ts +415 -0
  123. package/src/views.ts +436 -0
  124. package/src/widget.ts +197 -0
  125. package/src/workflow.ts +409 -0
  126. package/src/zod/app.zod.ts +72 -0
  127. package/src/zod/blocks.zod.ts +170 -0
  128. package/src/zod/complex.zod.ts +1 -1
  129. package/src/zod/crud.zod.ts +259 -0
  130. package/src/zod/data-display.zod.ts +1 -1
  131. package/src/zod/disclosure.zod.ts +1 -1
  132. package/src/zod/feedback.zod.ts +1 -1
  133. package/src/zod/form.zod.ts +1 -1
  134. package/src/zod/index.zod.ts +178 -19
  135. package/src/zod/layout.zod.ts +39 -1
  136. package/src/zod/navigation.zod.ts +1 -1
  137. package/src/zod/objectql.zod.ts +9 -1
  138. package/src/zod/overlay.zod.ts +1 -1
  139. package/src/zod/reports.zod.ts +183 -0
  140. package/src/zod/theme.zod.ts +296 -0
  141. package/src/zod/views.zod.ts +182 -0
@@ -0,0 +1,150 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ /**
9
+ * @object-ui/types - Permission & RBAC Types
10
+ *
11
+ * Complete RBAC (Role-Based Access Control) type definitions for
12
+ * object/field/row-level permissions aligned with @objectstack/spec v2.0.1.
13
+ *
14
+ * @module permissions
15
+ * @packageDocumentation
16
+ */
17
+ /** Standard CRUD permission actions */
18
+ export type PermissionAction = 'create' | 'read' | 'update' | 'delete' | 'export' | 'import' | 'share' | 'admin';
19
+ /** Permission effect */
20
+ export type PermissionEffect = 'allow' | 'deny';
21
+ /** Role definition for RBAC */
22
+ export interface RoleDefinition {
23
+ /** Unique role identifier */
24
+ name: string;
25
+ /** Display label */
26
+ label: string;
27
+ /** Role description */
28
+ description?: string;
29
+ /** Parent role for inheritance */
30
+ inherits?: string[];
31
+ /** Whether this is a system role */
32
+ system?: boolean;
33
+ /** Object-level permissions */
34
+ permissions: ObjectLevelPermission[];
35
+ }
36
+ /** Object-level permission assignment */
37
+ export interface ObjectLevelPermission {
38
+ /** Target object name */
39
+ object: string;
40
+ /** Allowed actions */
41
+ actions: PermissionAction[];
42
+ /** Permission effect */
43
+ effect?: PermissionEffect;
44
+ /** Conditions for conditional permissions */
45
+ conditions?: PermissionCondition[];
46
+ }
47
+ /** Field-level permission */
48
+ export interface FieldLevelPermission {
49
+ /** Target field name */
50
+ field: string;
51
+ /** Read permission */
52
+ read?: boolean;
53
+ /** Write permission */
54
+ write?: boolean;
55
+ /** Permission effect */
56
+ effect?: PermissionEffect;
57
+ /** Mask value for restricted fields (e.g., '****' for SSN) */
58
+ mask?: string;
59
+ }
60
+ /** Row-level permission (record-level security) */
61
+ export interface RowLevelPermission {
62
+ /** Filter expression to scope visible records */
63
+ filter: string;
64
+ /** Actions allowed on matching records */
65
+ actions: PermissionAction[];
66
+ /** Description of the rule */
67
+ description?: string;
68
+ }
69
+ /** Permission condition for conditional access */
70
+ export interface PermissionCondition {
71
+ /** Field to evaluate */
72
+ field: string;
73
+ /** Comparison operator */
74
+ operator: 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'not_in' | 'contains' | 'is_null' | 'is_not_null';
75
+ /** Value to compare */
76
+ value: unknown;
77
+ }
78
+ /** Complete permission configuration for an object */
79
+ export interface ObjectPermissionConfig {
80
+ /** Object name */
81
+ object: string;
82
+ /** Default permissions for unauthenticated users */
83
+ publicAccess?: PermissionAction[];
84
+ /** Role-based permissions */
85
+ roles: Record<string, {
86
+ actions: PermissionAction[];
87
+ fieldPermissions?: FieldLevelPermission[];
88
+ rowPermissions?: RowLevelPermission[];
89
+ }>;
90
+ /** Field-level permission defaults */
91
+ fieldDefaults?: FieldLevelPermission[];
92
+ /** Sharing rules */
93
+ sharingRules?: SharingRuleConfig[];
94
+ }
95
+ /** Sharing rule configuration */
96
+ export interface SharingRuleConfig {
97
+ /** Rule name */
98
+ name: string;
99
+ /** Share with type */
100
+ type: 'role' | 'user' | 'group' | 'public';
101
+ /** Target entity (role name, user ID, group name) */
102
+ entity: string;
103
+ /** Permitted actions */
104
+ actions: PermissionAction[];
105
+ /** Filter to scope which records are shared */
106
+ filter?: string;
107
+ }
108
+ /** Permission check result */
109
+ export interface PermissionCheckResult {
110
+ /** Whether the action is allowed */
111
+ allowed: boolean;
112
+ /** Reason for denial */
113
+ reason?: string;
114
+ /** Applicable field restrictions */
115
+ fieldRestrictions?: FieldLevelPermission[];
116
+ /** Row filter to apply */
117
+ rowFilter?: string;
118
+ }
119
+ /** Permission context for evaluating permissions */
120
+ export interface PermissionContext {
121
+ /** Current user */
122
+ user: {
123
+ id: string;
124
+ roles: string[];
125
+ groups?: string[];
126
+ [key: string]: unknown;
127
+ };
128
+ /** Target object */
129
+ object: string;
130
+ /** Target action */
131
+ action: PermissionAction;
132
+ /** Target record (for row-level checks) */
133
+ record?: Record<string, unknown>;
134
+ /** Target field (for field-level checks) */
135
+ field?: string;
136
+ }
137
+ /** Permission guard configuration for UI components */
138
+ export interface PermissionGuardConfig {
139
+ /** Required permission */
140
+ permission: string | PermissionAction;
141
+ /** Target object */
142
+ object?: string;
143
+ /** Fallback behavior when denied */
144
+ fallback?: 'hide' | 'disable' | 'redirect' | 'custom';
145
+ /** Custom fallback component type */
146
+ fallbackComponent?: string;
147
+ /** Redirect path for 'redirect' fallback */
148
+ redirectPath?: string;
149
+ }
150
+ //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAMH,uCAAuC;AACvC,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjH,wBAAwB;AACxB,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEhD,+BAA+B;AAC/B,MAAM,WAAW,cAAc;IAC7B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oCAAoC;IACpC,MAAM,CAAC,EAAE,OA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B;IACpB,MAAM,EAAE,gBAAgB,CAAC;IACzB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,uDAAuD;AACvD,MAAM,WAAW,qBAAqB;IACpC,0BAA0B;IAC1B,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACtC,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IACtD,qCAAqC;IACrC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export {};
@@ -0,0 +1,194 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ /**
9
+ * @object-ui/types - Plugin Scope Isolation
10
+ *
11
+ * Section 3.3: Plugin scope isolation types to prevent conflicts between plugins.
12
+ * Provides scoped component registration, state management, and event bus.
13
+ *
14
+ * @module plugin-scope
15
+ * @packageDocumentation
16
+ */
17
+ /**
18
+ * Plugin Scope Interface
19
+ *
20
+ * Provides isolated access to the component registry, state management,
21
+ * and event bus for a specific plugin, preventing conflicts between plugins.
22
+ */
23
+ export interface PluginScope {
24
+ /**
25
+ * Plugin name
26
+ */
27
+ name: string;
28
+ /**
29
+ * Plugin version
30
+ */
31
+ version: string;
32
+ /**
33
+ * Register a component in the scoped namespace.
34
+ * Components will be registered as "pluginName:type" to prevent conflicts.
35
+ *
36
+ * @param type - Component type identifier (e.g., 'table', 'chart')
37
+ * @param component - Component renderer
38
+ * @param meta - Optional component metadata
39
+ *
40
+ * @example
41
+ * // Plugin 'my-grid' registers a 'table' component
42
+ * // Registered as 'my-grid:table'
43
+ * scope.registerComponent('table', TableComponent, {
44
+ * label: 'Data Table',
45
+ * category: 'data'
46
+ * });
47
+ */
48
+ registerComponent(type: string, component: any, meta?: ComponentMeta): void;
49
+ /**
50
+ * Get a component from the scoped namespace.
51
+ * First tries scoped lookup (pluginName:type), then falls back to global.
52
+ *
53
+ * @param type - Component type identifier
54
+ * @returns Component renderer or undefined if not found
55
+ */
56
+ getComponent(type: string): any | undefined;
57
+ /**
58
+ * Scoped state management.
59
+ * Each plugin has its own isolated state that won't conflict with others.
60
+ *
61
+ * @param key - State key unique to this plugin
62
+ * @param initialValue - Initial state value
63
+ * @returns Tuple of [currentValue, setValue]
64
+ *
65
+ * @example
66
+ * const [config, setConfig] = scope.useState('config', { theme: 'light' });
67
+ */
68
+ useState<T>(key: string, initialValue: T): [T, (value: T | ((prev: T) => T)) => void];
69
+ /**
70
+ * Get scoped state value without setter.
71
+ *
72
+ * @param key - State key
73
+ * @returns Current state value or undefined
74
+ */
75
+ getState<T>(key: string): T | undefined;
76
+ /**
77
+ * Set scoped state value directly.
78
+ *
79
+ * @param key - State key
80
+ * @param value - New state value
81
+ */
82
+ setState<T>(key: string, value: T): void;
83
+ /**
84
+ * Subscribe to scoped events.
85
+ * Events are namespaced to prevent cross-plugin conflicts.
86
+ *
87
+ * @param event - Event name (will be prefixed with plugin namespace)
88
+ * @param handler - Event handler function
89
+ * @returns Unsubscribe function
90
+ *
91
+ * @example
92
+ * const unsubscribe = scope.on('data-updated', (data) => {
93
+ * console.log('Scoped event received:', data);
94
+ * });
95
+ */
96
+ on(event: string, handler: PluginEventHandler): () => void;
97
+ /**
98
+ * Emit a scoped event.
99
+ * Only subscribers within this plugin scope will receive it.
100
+ *
101
+ * @param event - Event name
102
+ * @param data - Event data
103
+ *
104
+ * @example
105
+ * scope.emit('data-updated', { rows: 100 });
106
+ */
107
+ emit(event: string, data?: any): void;
108
+ /**
109
+ * Emit a global event that all plugins can receive.
110
+ * Use sparingly for cross-plugin communication.
111
+ *
112
+ * @param event - Event name
113
+ * @param data - Event data
114
+ */
115
+ emitGlobal(event: string, data?: any): void;
116
+ /**
117
+ * Subscribe to global events from any plugin.
118
+ *
119
+ * @param event - Event name
120
+ * @param handler - Event handler function
121
+ * @returns Unsubscribe function
122
+ */
123
+ onGlobal(event: string, handler: PluginEventHandler): () => void;
124
+ /**
125
+ * Clean up all plugin resources (state, event listeners, etc.)
126
+ * Called automatically when plugin is unloaded.
127
+ */
128
+ cleanup(): void;
129
+ }
130
+ /**
131
+ * Component metadata for registration
132
+ */
133
+ export interface ComponentMeta {
134
+ label?: string;
135
+ icon?: string;
136
+ category?: string;
137
+ inputs?: ComponentInput[];
138
+ defaultProps?: Record<string, any>;
139
+ defaultChildren?: any[];
140
+ examples?: Record<string, any>;
141
+ isContainer?: boolean;
142
+ resizable?: boolean;
143
+ resizeConstraints?: {
144
+ width?: boolean;
145
+ height?: boolean;
146
+ minWidth?: number;
147
+ maxWidth?: number;
148
+ minHeight?: number;
149
+ maxHeight?: number;
150
+ };
151
+ }
152
+ /**
153
+ * Component input definition
154
+ */
155
+ export interface ComponentInput {
156
+ name: string;
157
+ type: 'string' | 'number' | 'boolean' | 'enum' | 'array' | 'object' | 'color' | 'date' | 'code' | 'file' | 'slot';
158
+ label?: string;
159
+ defaultValue?: any;
160
+ required?: boolean;
161
+ enum?: string[] | {
162
+ label: string;
163
+ value: any;
164
+ }[];
165
+ description?: string;
166
+ advanced?: boolean;
167
+ inputType?: string;
168
+ }
169
+ /**
170
+ * Event handler type
171
+ */
172
+ export type PluginEventHandler = (data?: any) => void;
173
+ /**
174
+ * Plugin scope configuration
175
+ */
176
+ export interface PluginScopeConfig {
177
+ /**
178
+ * Whether to enable state isolation (default: true)
179
+ */
180
+ enableStateIsolation?: boolean;
181
+ /**
182
+ * Whether to enable event isolation (default: true)
183
+ */
184
+ enableEventIsolation?: boolean;
185
+ /**
186
+ * Whether to allow global event access (default: true)
187
+ */
188
+ allowGlobalEvents?: boolean;
189
+ /**
190
+ * Maximum state size per plugin in bytes (default: 5MB)
191
+ */
192
+ maxStateSize?: number;
193
+ }
194
+ //# sourceMappingURL=plugin-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-scope.d.ts","sourceRoot":"","sources":["../src/plugin-scope.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAE5E;;;;;;OAMG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC;IAE5C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAEtF;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAExC;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAEzC;;;;;;;;;;;;OAYG;IACH,EAAE,CAAC,KA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AAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAClH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,EAAE,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export {};
@@ -0,0 +1,336 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ /**
9
+ * @object-ui/types - Report Schema
10
+ *
11
+ * Defines report configuration for data aggregation, visualization, and export.
12
+ */
13
+ import type { BaseSchema, SchemaNode } from './base';
14
+ import type { ChartSchema } from './data-display';
15
+ import type { DataSource } from './data';
16
+ /**
17
+ * Report Export Format
18
+ */
19
+ export type ReportExportFormat = 'pdf' | 'excel' | 'csv' | 'json' | 'html';
20
+ /**
21
+ * Report Schedule Frequency
22
+ */
23
+ export type ReportScheduleFrequency = 'once' | 'daily' | 'weekly' | 'monthly' | 'quarterly' | 'yearly';
24
+ /**
25
+ * Report Aggregation Type
26
+ */
27
+ export type ReportAggregationType = 'sum' | 'avg' | 'min' | 'max' | 'count' | 'distinct';
28
+ /**
29
+ * Report Field Definition
30
+ */
31
+ export interface ReportField {
32
+ /**
33
+ * Field name/identifier
34
+ */
35
+ name: string;
36
+ /**
37
+ * Display label
38
+ */
39
+ label?: string;
40
+ /**
41
+ * Field type
42
+ */
43
+ type?: 'string' | 'number' | 'date' | 'boolean';
44
+ /**
45
+ * Aggregation function
46
+ */
47
+ aggregation?: ReportAggregationType;
48
+ /**
49
+ * Format string
50
+ */
51
+ format?: string;
52
+ /**
53
+ * Show in summary
54
+ */
55
+ showInSummary?: boolean;
56
+ /**
57
+ * Sort order
58
+ */
59
+ sortOrder?: number;
60
+ }
61
+ /**
62
+ * Report Filter Definition
63
+ */
64
+ export interface ReportFilter {
65
+ /**
66
+ * Field to filter on
67
+ */
68
+ field: string;
69
+ /**
70
+ * Filter operator
71
+ */
72
+ operator: 'equals' | 'not_equals' | 'contains' | 'greater_than' | 'less_than' | 'between' | 'in' | 'not_in';
73
+ /**
74
+ * Filter value
75
+ */
76
+ value?: any;
77
+ /**
78
+ * Multiple values (for 'in' operator)
79
+ */
80
+ values?: any[];
81
+ }
82
+ /**
83
+ * Report Group By Definition
84
+ */
85
+ export interface ReportGroupBy {
86
+ /**
87
+ * Field to group by
88
+ */
89
+ field: string;
90
+ /**
91
+ * Display label
92
+ */
93
+ label?: string;
94
+ /**
95
+ * Sort direction
96
+ */
97
+ sort?: 'asc' | 'desc';
98
+ }
99
+ /**
100
+ * Report Section Definition
101
+ */
102
+ export interface ReportSection {
103
+ /**
104
+ * Section type
105
+ */
106
+ type: 'header' | 'summary' | 'chart' | 'table' | 'text' | 'page-break';
107
+ /**
108
+ * Section title
109
+ */
110
+ title?: string;
111
+ /**
112
+ * Section content
113
+ */
114
+ content?: SchemaNode | SchemaNode[];
115
+ /**
116
+ * Chart configuration (for type='chart')
117
+ */
118
+ chart?: ChartSchema;
119
+ /**
120
+ * Columns to display (for type='table')
121
+ */
122
+ columns?: ReportField[];
123
+ /**
124
+ * Text content (for type='text')
125
+ */
126
+ text?: string;
127
+ /**
128
+ * Visibility condition
129
+ */
130
+ visible?: boolean | string;
131
+ }
132
+ /**
133
+ * Report Schedule Configuration
134
+ */
135
+ export interface ReportSchedule {
136
+ /**
137
+ * Schedule enabled
138
+ */
139
+ enabled?: boolean;
140
+ /**
141
+ * Frequency
142
+ */
143
+ frequency?: ReportScheduleFrequency;
144
+ /**
145
+ * Specific day of week (for weekly)
146
+ */
147
+ dayOfWeek?: number;
148
+ /**
149
+ * Specific day of month (for monthly)
150
+ */
151
+ dayOfMonth?: number;
152
+ /**
153
+ * Time to run (HH:mm format)
154
+ */
155
+ time?: string;
156
+ /**
157
+ * Timezone
158
+ */
159
+ timezone?: string;
160
+ /**
161
+ * Email recipients
162
+ */
163
+ recipients?: string[];
164
+ /**
165
+ * Email subject
166
+ */
167
+ subject?: string;
168
+ /**
169
+ * Email body
170
+ */
171
+ body?: string;
172
+ /**
173
+ * Export formats to attach
174
+ */
175
+ formats?: ReportExportFormat[];
176
+ }
177
+ /**
178
+ * Report Export Configuration
179
+ */
180
+ export interface ReportExportConfig {
181
+ /**
182
+ * Export format
183
+ */
184
+ format: ReportExportFormat;
185
+ /**
186
+ * Filename template
187
+ */
188
+ filename?: string;
189
+ /**
190
+ * Include headers
191
+ */
192
+ includeHeaders?: boolean;
193
+ /**
194
+ * Page orientation (for PDF)
195
+ */
196
+ orientation?: 'portrait' | 'landscape';
197
+ /**
198
+ * Page size (for PDF)
199
+ */
200
+ pageSize?: 'A4' | 'A3' | 'Letter' | 'Legal';
201
+ /**
202
+ * Custom options
203
+ */
204
+ options?: Record<string, any>;
205
+ }
206
+ /**
207
+ * Report Schema - Main report configuration
208
+ */
209
+ export interface ReportSchema extends BaseSchema {
210
+ type: 'report';
211
+ /**
212
+ * Report title
213
+ */
214
+ title?: string;
215
+ /**
216
+ * Report description
217
+ */
218
+ description?: string;
219
+ /**
220
+ * Data source configuration
221
+ */
222
+ dataSource?: DataSource;
223
+ /**
224
+ * Report fields
225
+ */
226
+ fields?: ReportField[];
227
+ /**
228
+ * Report filters
229
+ */
230
+ filters?: ReportFilter[];
231
+ /**
232
+ * Group by configuration
233
+ */
234
+ groupBy?: ReportGroupBy[];
235
+ /**
236
+ * Report sections
237
+ */
238
+ sections?: ReportSection[];
239
+ /**
240
+ * Schedule configuration
241
+ */
242
+ schedule?: ReportSchedule;
243
+ /**
244
+ * Default export format
245
+ */
246
+ defaultExportFormat?: ReportExportFormat;
247
+ /**
248
+ * Export configurations
249
+ */
250
+ exportConfigs?: Record<ReportExportFormat, ReportExportConfig>;
251
+ /**
252
+ * Show export buttons
253
+ */
254
+ showExportButtons?: boolean;
255
+ /**
256
+ * Show print button
257
+ */
258
+ showPrintButton?: boolean;
259
+ /**
260
+ * Show schedule button
261
+ */
262
+ showScheduleButton?: boolean;
263
+ /**
264
+ * Auto-refresh interval (in seconds)
265
+ */
266
+ refreshInterval?: number;
267
+ /**
268
+ * Loading state
269
+ */
270
+ loading?: boolean;
271
+ /**
272
+ * Report data
273
+ */
274
+ data?: any[];
275
+ }
276
+ /**
277
+ * Report Builder Schema - Interactive report builder component
278
+ */
279
+ export interface ReportBuilderSchema extends BaseSchema {
280
+ type: 'report-builder';
281
+ /**
282
+ * Initial report configuration
283
+ */
284
+ report?: ReportSchema;
285
+ /**
286
+ * Available data sources
287
+ */
288
+ dataSources?: DataSource[];
289
+ /**
290
+ * Available fields
291
+ */
292
+ availableFields?: ReportField[];
293
+ /**
294
+ * Show preview
295
+ */
296
+ showPreview?: boolean;
297
+ /**
298
+ * Save callback
299
+ */
300
+ onSave?: string;
301
+ /**
302
+ * Cancel callback
303
+ */
304
+ onCancel?: string;
305
+ }
306
+ /**
307
+ * Report Viewer Schema - Display a generated report
308
+ */
309
+ export interface ReportViewerSchema extends BaseSchema {
310
+ type: 'report-viewer';
311
+ /**
312
+ * Report to display
313
+ */
314
+ report?: ReportSchema;
315
+ /**
316
+ * Report data
317
+ */
318
+ data?: any[];
319
+ /**
320
+ * Show toolbar
321
+ */
322
+ showToolbar?: boolean;
323
+ /**
324
+ * Allow export
325
+ */
326
+ allowExport?: boolean;
327
+ /**
328
+ * Allow print
329
+ */
330
+ allowPrint?: boolean;
331
+ /**
332
+ * Loading state
333
+ */
334
+ loading?: boolean;
335
+ }
336
+ //# sourceMappingURL=reports.d.ts.map