@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
package/src/reports.ts ADDED
@@ -0,0 +1,408 @@
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
+ /**
10
+ * @object-ui/types - Report Schema
11
+ *
12
+ * Defines report configuration for data aggregation, visualization, and export.
13
+ */
14
+
15
+ import type { BaseSchema, SchemaNode } from './base';
16
+ import type { ChartSchema } from './data-display';
17
+ import type { DataSource } from './data';
18
+
19
+ /**
20
+ * Report Export Format
21
+ */
22
+ export type ReportExportFormat = 'pdf' | 'excel' | 'csv' | 'json' | 'html';
23
+
24
+ /**
25
+ * Report Schedule Frequency
26
+ */
27
+ export type ReportScheduleFrequency = 'once' | 'daily' | 'weekly' | 'monthly' | 'quarterly' | 'yearly';
28
+
29
+ /**
30
+ * Report Aggregation Type
31
+ */
32
+ export type ReportAggregationType = 'sum' | 'avg' | 'min' | 'max' | 'count' | 'distinct';
33
+
34
+ /**
35
+ * Report Field Definition
36
+ */
37
+ export interface ReportField {
38
+ /**
39
+ * Field name/identifier
40
+ */
41
+ name: string;
42
+
43
+ /**
44
+ * Display label
45
+ */
46
+ label?: string;
47
+
48
+ /**
49
+ * Field type
50
+ */
51
+ type?: 'string' | 'number' | 'date' | 'boolean';
52
+
53
+ /**
54
+ * Aggregation function
55
+ */
56
+ aggregation?: ReportAggregationType;
57
+
58
+ /**
59
+ * Format string
60
+ */
61
+ format?: string;
62
+
63
+ /**
64
+ * Show in summary
65
+ */
66
+ showInSummary?: boolean;
67
+
68
+ /**
69
+ * Sort order
70
+ */
71
+ sortOrder?: number;
72
+ }
73
+
74
+ /**
75
+ * Report Filter Definition
76
+ */
77
+ export interface ReportFilter {
78
+ /**
79
+ * Field to filter on
80
+ */
81
+ field: string;
82
+
83
+ /**
84
+ * Filter operator
85
+ */
86
+ operator: 'equals' | 'not_equals' | 'contains' | 'greater_than' | 'less_than' | 'between' | 'in' | 'not_in';
87
+
88
+ /**
89
+ * Filter value
90
+ */
91
+ value?: any;
92
+
93
+ /**
94
+ * Multiple values (for 'in' operator)
95
+ */
96
+ values?: any[];
97
+ }
98
+
99
+ /**
100
+ * Report Group By Definition
101
+ */
102
+ export interface ReportGroupBy {
103
+ /**
104
+ * Field to group by
105
+ */
106
+ field: string;
107
+
108
+ /**
109
+ * Display label
110
+ */
111
+ label?: string;
112
+
113
+ /**
114
+ * Sort direction
115
+ */
116
+ sort?: 'asc' | 'desc';
117
+ }
118
+
119
+ /**
120
+ * Report Section Definition
121
+ */
122
+ export interface ReportSection {
123
+ /**
124
+ * Section type
125
+ */
126
+ type: 'header' | 'summary' | 'chart' | 'table' | 'text' | 'page-break';
127
+
128
+ /**
129
+ * Section title
130
+ */
131
+ title?: string;
132
+
133
+ /**
134
+ * Section content
135
+ */
136
+ content?: SchemaNode | SchemaNode[];
137
+
138
+ /**
139
+ * Chart configuration (for type='chart')
140
+ */
141
+ chart?: ChartSchema;
142
+
143
+ /**
144
+ * Columns to display (for type='table')
145
+ */
146
+ columns?: ReportField[];
147
+
148
+ /**
149
+ * Text content (for type='text')
150
+ */
151
+ text?: string;
152
+
153
+ /**
154
+ * Visibility condition
155
+ */
156
+ visible?: boolean | string;
157
+ }
158
+
159
+ /**
160
+ * Report Schedule Configuration
161
+ */
162
+ export interface ReportSchedule {
163
+ /**
164
+ * Schedule enabled
165
+ */
166
+ enabled?: boolean;
167
+
168
+ /**
169
+ * Frequency
170
+ */
171
+ frequency?: ReportScheduleFrequency;
172
+
173
+ /**
174
+ * Specific day of week (for weekly)
175
+ */
176
+ dayOfWeek?: number;
177
+
178
+ /**
179
+ * Specific day of month (for monthly)
180
+ */
181
+ dayOfMonth?: number;
182
+
183
+ /**
184
+ * Time to run (HH:mm format)
185
+ */
186
+ time?: string;
187
+
188
+ /**
189
+ * Timezone
190
+ */
191
+ timezone?: string;
192
+
193
+ /**
194
+ * Email recipients
195
+ */
196
+ recipients?: string[];
197
+
198
+ /**
199
+ * Email subject
200
+ */
201
+ subject?: string;
202
+
203
+ /**
204
+ * Email body
205
+ */
206
+ body?: string;
207
+
208
+ /**
209
+ * Export formats to attach
210
+ */
211
+ formats?: ReportExportFormat[];
212
+ }
213
+
214
+ /**
215
+ * Report Export Configuration
216
+ */
217
+ export interface ReportExportConfig {
218
+ /**
219
+ * Export format
220
+ */
221
+ format: ReportExportFormat;
222
+
223
+ /**
224
+ * Filename template
225
+ */
226
+ filename?: string;
227
+
228
+ /**
229
+ * Include headers
230
+ */
231
+ includeHeaders?: boolean;
232
+
233
+ /**
234
+ * Page orientation (for PDF)
235
+ */
236
+ orientation?: 'portrait' | 'landscape';
237
+
238
+ /**
239
+ * Page size (for PDF)
240
+ */
241
+ pageSize?: 'A4' | 'A3' | 'Letter' | 'Legal';
242
+
243
+ /**
244
+ * Custom options
245
+ */
246
+ options?: Record<string, any>;
247
+ }
248
+
249
+ /**
250
+ * Report Schema - Main report configuration
251
+ */
252
+ export interface ReportSchema extends BaseSchema {
253
+ type: 'report';
254
+
255
+ /**
256
+ * Report title
257
+ */
258
+ title?: string;
259
+
260
+ /**
261
+ * Report description
262
+ */
263
+ description?: string;
264
+
265
+ /**
266
+ * Data source configuration
267
+ */
268
+ dataSource?: DataSource;
269
+
270
+ /**
271
+ * Report fields
272
+ */
273
+ fields?: ReportField[];
274
+
275
+ /**
276
+ * Report filters
277
+ */
278
+ filters?: ReportFilter[];
279
+
280
+ /**
281
+ * Group by configuration
282
+ */
283
+ groupBy?: ReportGroupBy[];
284
+
285
+ /**
286
+ * Report sections
287
+ */
288
+ sections?: ReportSection[];
289
+
290
+ /**
291
+ * Schedule configuration
292
+ */
293
+ schedule?: ReportSchedule;
294
+
295
+ /**
296
+ * Default export format
297
+ */
298
+ defaultExportFormat?: ReportExportFormat;
299
+
300
+ /**
301
+ * Export configurations
302
+ */
303
+ exportConfigs?: Record<ReportExportFormat, ReportExportConfig>;
304
+
305
+ /**
306
+ * Show export buttons
307
+ */
308
+ showExportButtons?: boolean;
309
+
310
+ /**
311
+ * Show print button
312
+ */
313
+ showPrintButton?: boolean;
314
+
315
+ /**
316
+ * Show schedule button
317
+ */
318
+ showScheduleButton?: boolean;
319
+
320
+ /**
321
+ * Auto-refresh interval (in seconds)
322
+ */
323
+ refreshInterval?: number;
324
+
325
+ /**
326
+ * Loading state
327
+ */
328
+ loading?: boolean;
329
+
330
+ /**
331
+ * Report data
332
+ */
333
+ data?: any[];
334
+ }
335
+
336
+ /**
337
+ * Report Builder Schema - Interactive report builder component
338
+ */
339
+ export interface ReportBuilderSchema extends BaseSchema {
340
+ type: 'report-builder';
341
+
342
+ /**
343
+ * Initial report configuration
344
+ */
345
+ report?: ReportSchema;
346
+
347
+ /**
348
+ * Available data sources
349
+ */
350
+ dataSources?: DataSource[];
351
+
352
+ /**
353
+ * Available fields
354
+ */
355
+ availableFields?: ReportField[];
356
+
357
+ /**
358
+ * Show preview
359
+ */
360
+ showPreview?: boolean;
361
+
362
+ /**
363
+ * Save callback
364
+ */
365
+ onSave?: string;
366
+
367
+ /**
368
+ * Cancel callback
369
+ */
370
+ onCancel?: string;
371
+ }
372
+
373
+ /**
374
+ * Report Viewer Schema - Display a generated report
375
+ */
376
+ export interface ReportViewerSchema extends BaseSchema {
377
+ type: 'report-viewer';
378
+
379
+ /**
380
+ * Report to display
381
+ */
382
+ report?: ReportSchema;
383
+
384
+ /**
385
+ * Report data
386
+ */
387
+ data?: any[];
388
+
389
+ /**
390
+ * Show toolbar
391
+ */
392
+ showToolbar?: boolean;
393
+
394
+ /**
395
+ * Allow export
396
+ */
397
+ allowExport?: boolean;
398
+
399
+ /**
400
+ * Allow print
401
+ */
402
+ allowPrint?: boolean;
403
+
404
+ /**
405
+ * Loading state
406
+ */
407
+ loading?: boolean;
408
+ }
package/src/tenant.ts ADDED
@@ -0,0 +1,153 @@
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
+ /**
10
+ * @object-ui/types - Multi-Tenancy Types
11
+ *
12
+ * Type definitions for multi-tenant architecture support including
13
+ * tenant isolation, scoped queries, and custom branding.
14
+ *
15
+ * @module tenant
16
+ * @packageDocumentation
17
+ */
18
+
19
+ import type { Theme } from './theme';
20
+
21
+ // ============================================================================
22
+ // Tenant Configuration
23
+ // ============================================================================
24
+
25
+ /** Tenant isolation strategy */
26
+ export type TenantIsolationStrategy = 'database' | 'schema' | 'row' | 'hybrid';
27
+
28
+ /** Tenant status */
29
+ export type TenantStatus = 'active' | 'suspended' | 'pending' | 'archived';
30
+
31
+ /** Tenant plan/tier */
32
+ export type TenantPlan = 'free' | 'starter' | 'professional' | 'enterprise' | 'custom';
33
+
34
+ /** Tenant definition */
35
+ export interface TenantConfig {
36
+ /** Unique tenant identifier */
37
+ id: string;
38
+ /** Tenant display name */
39
+ name: string;
40
+ /** Tenant slug (URL-friendly identifier) */
41
+ slug: string;
42
+ /** Tenant status */
43
+ status: TenantStatus;
44
+ /** Subscription plan */
45
+ plan?: TenantPlan;
46
+ /** Tenant domain (for custom domain support) */
47
+ domain?: string;
48
+ /** Data isolation strategy */
49
+ isolation: TenantIsolationStrategy;
50
+ /** Custom branding */
51
+ branding?: TenantBranding;
52
+ /** Feature flags */
53
+ features?: Record<string, boolean>;
54
+ /** Usage limits */
55
+ limits?: TenantLimits;
56
+ /** Tenant metadata */
57
+ metadata?: Record<string, unknown>;
58
+ /** Created timestamp */
59
+ createdAt?: string;
60
+ /** Updated timestamp */
61
+ updatedAt?: string;
62
+ }
63
+
64
+ /** Tenant branding configuration */
65
+ export interface TenantBranding {
66
+ /** Company logo URL */
67
+ logo?: string;
68
+ /** Favicon URL */
69
+ favicon?: string;
70
+ /** Primary brand color */
71
+ primaryColor?: string;
72
+ /** Secondary brand color */
73
+ secondaryColor?: string;
74
+ /** Custom theme override */
75
+ theme?: Partial<Theme>;
76
+ /** Custom CSS */
77
+ customCSS?: string;
78
+ /** Company name displayed in UI */
79
+ companyName?: string;
80
+ /** Support email */
81
+ supportEmail?: string;
82
+ /** Custom login page background */
83
+ loginBackground?: string;
84
+ /** Email templates branding */
85
+ emailBranding?: {
86
+ headerLogo?: string;
87
+ footerText?: string;
88
+ primaryColor?: string;
89
+ };
90
+ }
91
+
92
+ /** Tenant usage limits */
93
+ export interface TenantLimits {
94
+ /** Maximum number of users */
95
+ maxUsers?: number;
96
+ /** Maximum storage in bytes */
97
+ maxStorage?: number;
98
+ /** Maximum API calls per day */
99
+ maxAPICallsPerDay?: number;
100
+ /** Maximum objects/tables */
101
+ maxObjects?: number;
102
+ /** Maximum records per object */
103
+ maxRecordsPerObject?: number;
104
+ /** Maximum file upload size in bytes */
105
+ maxFileSize?: number;
106
+ }
107
+
108
+ /** Tenant context for runtime use */
109
+ export interface TenantContext {
110
+ /** Current tenant configuration */
111
+ tenant: TenantConfig;
112
+ /** Whether the user is a tenant admin */
113
+ isTenantAdmin: boolean;
114
+ /** Resolved branding (merged with defaults) */
115
+ branding: TenantBranding;
116
+ /** Active feature flags */
117
+ features: Record<string, boolean>;
118
+ }
119
+
120
+ /** Tenant resolution strategy */
121
+ export type TenantResolutionStrategy = 'subdomain' | 'path' | 'header' | 'query' | 'cookie' | 'custom';
122
+
123
+ /** Tenant provider configuration */
124
+ export interface TenantProviderConfig {
125
+ /** How to resolve tenant from request */
126
+ resolution: TenantResolutionStrategy;
127
+ /** Custom resolution function name */
128
+ customResolver?: string;
129
+ /** Header name for 'header' strategy */
130
+ headerName?: string;
131
+ /** Query parameter name for 'query' strategy */
132
+ queryParam?: string;
133
+ /** Cookie name for 'cookie' strategy */
134
+ cookieName?: string;
135
+ /** Default tenant ID for fallback */
136
+ defaultTenantId?: string;
137
+ /** Enable tenant caching */
138
+ caching?: boolean;
139
+ /** Cache TTL in seconds */
140
+ cacheTTL?: number;
141
+ }
142
+
143
+ /** Scoped query configuration for tenant isolation */
144
+ export interface TenantScopedQueryConfig {
145
+ /** Tenant ID field name in records */
146
+ tenantField: string;
147
+ /** Whether to auto-inject tenant filter */
148
+ autoFilter: boolean;
149
+ /** Objects excluded from tenant scoping */
150
+ excludedObjects?: string[];
151
+ /** Whether to enforce tenant scope on writes */
152
+ enforceOnWrite: boolean;
153
+ }