@objectql/types 1.8.3 → 1.9.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.
@@ -0,0 +1,308 @@
1
+ /**
2
+ * Formula Engine Types
3
+ *
4
+ * Type definitions for the ObjectQL Formula Engine.
5
+ * Formulas are read-only calculated fields that derive values from other fields,
6
+ * related records, or system variables using JavaScript-style expressions.
7
+ *
8
+ * @see docs/spec/formula.md for complete specification
9
+ */
10
+ import { ObjectQLError } from './api';
11
+ /**
12
+ * Data types that formula expressions can return
13
+ */
14
+ export type FormulaDataType = 'number' | 'text' | 'date' | 'datetime' | 'boolean' | 'currency' | 'percent';
15
+ /**
16
+ * Valid formula return values based on data type
17
+ */
18
+ export type FormulaValue = number | string | boolean | Date | null | undefined;
19
+ /**
20
+ * Valid field values that can be used in formula expressions
21
+ */
22
+ export type FormulaFieldValue = string | number | boolean | Date | null | undefined | FormulaFieldValue[] | {
23
+ [key: string]: FormulaFieldValue;
24
+ };
25
+ /**
26
+ * Configuration for a formula field
27
+ *
28
+ * Formula fields are defined in object metadata and evaluated at query time.
29
+ * They are never stored in the database.
30
+ */
31
+ export interface FormulaFieldConfig {
32
+ /** Field type - must be 'formula' */
33
+ type: 'formula';
34
+ /** JavaScript expression to evaluate */
35
+ expression: string;
36
+ /** Expected return data type of the expression */
37
+ data_type: FormulaDataType;
38
+ /** Display label for UI */
39
+ label?: string;
40
+ /** Help text explaining the formula's purpose */
41
+ description?: string;
42
+ /** Display format for numbers/dates (e.g., "0.00", "YYYY-MM-DD") */
43
+ format?: string;
44
+ /** Decimal precision for numeric results */
45
+ precision?: number;
46
+ /** Treat blank/null as zero in calculations (default: false) */
47
+ blank_as_zero?: boolean;
48
+ /** Default value to use when referenced fields are null/undefined */
49
+ treat_blank_as?: FormulaValue;
50
+ /** AI-friendly context for understanding business intent */
51
+ ai_context?: FormulaAiContext;
52
+ }
53
+ /**
54
+ * AI context for formula fields
55
+ *
56
+ * Provides semantic information to help AI tools understand the
57
+ * business purpose and validation requirements of the formula.
58
+ */
59
+ export interface FormulaAiContext {
60
+ /** Business intent behind the formula */
61
+ intent?: string;
62
+ /** Business rule description in natural language */
63
+ business_rule?: string;
64
+ /** Algorithm description for complex formulas */
65
+ algorithm?: string;
66
+ /** Example calculations with inputs and expected results */
67
+ examples?: FormulaExample[];
68
+ /** Test cases for validation */
69
+ test_cases?: FormulaTestCase[];
70
+ /** Validation notes or constraints */
71
+ validation_notes?: string;
72
+ /** References to external documentation */
73
+ references?: string[];
74
+ }
75
+ /**
76
+ * Example demonstrating formula behavior
77
+ */
78
+ export interface FormulaExample {
79
+ /** Description of this example */
80
+ description: string;
81
+ /** Input field values */
82
+ inputs: Record<string, FormulaFieldValue>;
83
+ /** Expected result */
84
+ result: FormulaValue;
85
+ /** Optional explanation of the calculation */
86
+ explanation?: string;
87
+ }
88
+ /**
89
+ * Test case for formula validation
90
+ */
91
+ export interface FormulaTestCase {
92
+ /** Test case description */
93
+ description?: string;
94
+ /** Input values for the test */
95
+ input: Record<string, FormulaFieldValue>;
96
+ /** Expected output value */
97
+ expected: FormulaValue;
98
+ /** Whether this test should pass or fail */
99
+ should_pass?: boolean;
100
+ }
101
+ /**
102
+ * Runtime context for formula evaluation
103
+ *
104
+ * Provides access to record data, system variables, and user context
105
+ * during formula expression evaluation.
106
+ */
107
+ export interface FormulaContext {
108
+ /** Current record data with all field values */
109
+ record: Record<string, FormulaFieldValue>;
110
+ /** System date/time variables */
111
+ system: FormulaSystemVariables;
112
+ /** Current user context */
113
+ current_user: FormulaUserContext;
114
+ /** Record context flags */
115
+ is_new: boolean;
116
+ /** Record ID (if exists) */
117
+ record_id?: string;
118
+ }
119
+ /**
120
+ * System variables available in formula expressions
121
+ */
122
+ export interface FormulaSystemVariables {
123
+ /** Current date (YYYY-MM-DD) */
124
+ today: Date;
125
+ /** Current timestamp */
126
+ now: Date;
127
+ /** Current year */
128
+ year: number;
129
+ /** Current month (1-12) */
130
+ month: number;
131
+ /** Current day of month (1-31) */
132
+ day: number;
133
+ /** Current hour (0-23) */
134
+ hour: number;
135
+ /** Current minute (0-59) */
136
+ minute?: number;
137
+ /** Current second (0-59) */
138
+ second?: number;
139
+ }
140
+ /**
141
+ * Current user context available in formula expressions
142
+ */
143
+ export interface FormulaUserContext {
144
+ /** User ID */
145
+ id: string;
146
+ /** User's display name */
147
+ name?: string;
148
+ /** User's email address */
149
+ email?: string;
150
+ /** User's role */
151
+ role?: string;
152
+ /** Additional user properties */
153
+ [key: string]: unknown;
154
+ }
155
+ /**
156
+ * Result of formula evaluation
157
+ */
158
+ export interface FormulaEvaluationResult {
159
+ /** Computed value */
160
+ value: FormulaValue;
161
+ /** Data type of the result */
162
+ type: FormulaDataType;
163
+ /** Whether evaluation was successful */
164
+ success: boolean;
165
+ /** Error message if evaluation failed */
166
+ error?: string;
167
+ /** Stack trace for debugging (if error occurred) */
168
+ stack?: string;
169
+ /** Execution time in milliseconds */
170
+ execution_time?: number;
171
+ }
172
+ /**
173
+ * Error types that can occur during formula evaluation
174
+ */
175
+ export declare enum FormulaErrorType {
176
+ /** Syntax error in the expression */
177
+ SYNTAX_ERROR = "SYNTAX_ERROR",
178
+ /** Referenced field does not exist */
179
+ FIELD_NOT_FOUND = "FIELD_NOT_FOUND",
180
+ /** Type mismatch in operation */
181
+ TYPE_ERROR = "TYPE_ERROR",
182
+ /** Division by zero */
183
+ DIVISION_BY_ZERO = "DIVISION_BY_ZERO",
184
+ /** Null or undefined value in operation */
185
+ NULL_REFERENCE = "NULL_REFERENCE",
186
+ /** Evaluation timeout */
187
+ TIMEOUT = "TIMEOUT",
188
+ /** Security violation (restricted operation) */
189
+ SECURITY_VIOLATION = "SECURITY_VIOLATION",
190
+ /** Generic runtime error */
191
+ RUNTIME_ERROR = "RUNTIME_ERROR"
192
+ }
193
+ /**
194
+ * Context information for formula errors
195
+ */
196
+ export interface FormulaErrorContext {
197
+ /** The formula expression that caused the error */
198
+ expression?: string;
199
+ /** Field name if applicable */
200
+ field?: string;
201
+ /** Record data at time of error */
202
+ record?: Record<string, FormulaFieldValue>;
203
+ /** Additional context information */
204
+ [key: string]: unknown;
205
+ }
206
+ /**
207
+ * Custom error for formula evaluation failures
208
+ * Extends ObjectQLError to maintain consistency with ObjectQL error handling
209
+ */
210
+ export declare class FormulaError extends ObjectQLError {
211
+ readonly errorType: FormulaErrorType;
212
+ readonly expression?: string;
213
+ readonly errorContext?: FormulaErrorContext;
214
+ constructor(type: FormulaErrorType, message: string, expression?: string, context?: FormulaErrorContext);
215
+ }
216
+ /**
217
+ * Options for formula evaluation
218
+ */
219
+ export interface FormulaEvaluationOptions {
220
+ /** Maximum execution time in milliseconds (default: 1000) */
221
+ timeout?: number;
222
+ /** Enable strict mode (default: true) */
223
+ strict?: boolean;
224
+ /** Enable debug mode with detailed logging */
225
+ debug?: boolean;
226
+ /** Allow async operations (default: false) */
227
+ allow_async?: boolean;
228
+ /** Sandbox restrictions */
229
+ sandbox?: {
230
+ /** Allowed global variables */
231
+ allowed_globals?: string[];
232
+ /** Blocked operations/methods */
233
+ blocked_operations?: string[];
234
+ };
235
+ }
236
+ /**
237
+ * Metadata about a formula field for introspection
238
+ */
239
+ export interface FormulaMetadata {
240
+ /** Formula field name */
241
+ field_name: string;
242
+ /** The formula expression */
243
+ expression: string;
244
+ /** Expected return type */
245
+ data_type: FormulaDataType;
246
+ /** Fields referenced in the expression */
247
+ dependencies: string[];
248
+ /** Lookup chains used (e.g., ["account.owner.name"]) */
249
+ lookup_chains: string[];
250
+ /** System variables used */
251
+ system_variables: string[];
252
+ /** Whether the formula is valid */
253
+ is_valid: boolean;
254
+ /** Validation errors if invalid */
255
+ validation_errors?: string[];
256
+ /** Estimated complexity (simple, medium, complex) */
257
+ complexity?: 'simple' | 'medium' | 'complex';
258
+ }
259
+ /**
260
+ * Statistics about formula execution
261
+ */
262
+ export interface FormulaExecutionStats {
263
+ /** Formula field name */
264
+ field_name: string;
265
+ /** Total number of evaluations */
266
+ evaluation_count: number;
267
+ /** Number of successful evaluations */
268
+ success_count: number;
269
+ /** Number of failed evaluations */
270
+ error_count: number;
271
+ /** Average execution time in milliseconds */
272
+ avg_execution_time: number;
273
+ /** Maximum execution time in milliseconds */
274
+ max_execution_time: number;
275
+ /** Minimum execution time in milliseconds */
276
+ min_execution_time: number;
277
+ /** Most common error types */
278
+ common_errors?: Record<FormulaErrorType, number>;
279
+ }
280
+ /**
281
+ * Type for custom formula functions
282
+ * These functions can be registered in the formula engine for use in expressions
283
+ */
284
+ export type FormulaCustomFunction = (...args: FormulaFieldValue[]) => FormulaValue;
285
+ /**
286
+ * Configuration for formula engine
287
+ */
288
+ export interface FormulaEngineConfig {
289
+ /** Enable formula caching */
290
+ enable_cache?: boolean;
291
+ /** Cache TTL in seconds */
292
+ cache_ttl?: number;
293
+ /** Maximum formula execution time in milliseconds */
294
+ max_execution_time?: number;
295
+ /** Enable performance monitoring */
296
+ enable_monitoring?: boolean;
297
+ /** Custom function library */
298
+ custom_functions?: Record<string, FormulaCustomFunction>;
299
+ /** Sandbox configuration */
300
+ sandbox?: {
301
+ /** Enable sandbox mode */
302
+ enabled?: boolean;
303
+ /** Allowed global objects */
304
+ allowed_globals?: string[];
305
+ /** Blocked operations */
306
+ blocked_operations?: string[];
307
+ };
308
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ /**
3
+ * Formula Engine Types
4
+ *
5
+ * Type definitions for the ObjectQL Formula Engine.
6
+ * Formulas are read-only calculated fields that derive values from other fields,
7
+ * related records, or system variables using JavaScript-style expressions.
8
+ *
9
+ * @see docs/spec/formula.md for complete specification
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.FormulaError = exports.FormulaErrorType = void 0;
13
+ const api_1 = require("./api");
14
+ /**
15
+ * Error types that can occur during formula evaluation
16
+ */
17
+ var FormulaErrorType;
18
+ (function (FormulaErrorType) {
19
+ /** Syntax error in the expression */
20
+ FormulaErrorType["SYNTAX_ERROR"] = "SYNTAX_ERROR";
21
+ /** Referenced field does not exist */
22
+ FormulaErrorType["FIELD_NOT_FOUND"] = "FIELD_NOT_FOUND";
23
+ /** Type mismatch in operation */
24
+ FormulaErrorType["TYPE_ERROR"] = "TYPE_ERROR";
25
+ /** Division by zero */
26
+ FormulaErrorType["DIVISION_BY_ZERO"] = "DIVISION_BY_ZERO";
27
+ /** Null or undefined value in operation */
28
+ FormulaErrorType["NULL_REFERENCE"] = "NULL_REFERENCE";
29
+ /** Evaluation timeout */
30
+ FormulaErrorType["TIMEOUT"] = "TIMEOUT";
31
+ /** Security violation (restricted operation) */
32
+ FormulaErrorType["SECURITY_VIOLATION"] = "SECURITY_VIOLATION";
33
+ /** Generic runtime error */
34
+ FormulaErrorType["RUNTIME_ERROR"] = "RUNTIME_ERROR";
35
+ })(FormulaErrorType || (exports.FormulaErrorType = FormulaErrorType = {}));
36
+ /**
37
+ * Custom error for formula evaluation failures
38
+ * Extends ObjectQLError to maintain consistency with ObjectQL error handling
39
+ */
40
+ class FormulaError extends api_1.ObjectQLError {
41
+ constructor(type, message, expression, context) {
42
+ super({
43
+ code: type,
44
+ message,
45
+ details: {
46
+ formula_error_type: type,
47
+ expression,
48
+ ...context
49
+ }
50
+ });
51
+ this.name = 'FormulaError';
52
+ this.errorType = type;
53
+ this.expression = expression;
54
+ this.errorContext = context;
55
+ }
56
+ }
57
+ exports.FormulaError = FormulaError;
58
+ //# sourceMappingURL=formula.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formula.js","sourceRoot":"","sources":["../src/formula.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,+BAAoD;AA0OpD;;GAEG;AACH,IAAY,gBAwBX;AAxBD,WAAY,gBAAgB;IACxB,qCAAqC;IACrC,iDAA6B,CAAA;IAE7B,sCAAsC;IACtC,uDAAmC,CAAA;IAEnC,iCAAiC;IACjC,6CAAyB,CAAA;IAEzB,uBAAuB;IACvB,yDAAqC,CAAA;IAErC,2CAA2C;IAC3C,qDAAiC,CAAA;IAEjC,yBAAyB;IACzB,uCAAmB,CAAA;IAEnB,gDAAgD;IAChD,6DAAyC,CAAA;IAEzC,4BAA4B;IAC5B,mDAA+B,CAAA;AACnC,CAAC,EAxBW,gBAAgB,gCAAhB,gBAAgB,QAwB3B;AAmBD;;;GAGG;AACH,MAAa,YAAa,SAAQ,mBAAa;IAK3C,YACI,IAAsB,EACtB,OAAe,EACf,UAAmB,EACnB,OAA6B;QAE7B,KAAK,CAAC;YACF,IAAI,EAAE,IAAc;YACpB,OAAO;YACP,OAAO,EAAE;gBACL,kBAAkB,EAAE,IAAI;gBACxB,UAAU;gBACV,GAAG,OAAO;aACb;SACJ,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;IAChC,CAAC;CACJ;AAzBD,oCAyBC"}
package/dist/index.d.ts CHANGED
@@ -18,3 +18,8 @@ export * from './application';
18
18
  export * from './menu';
19
19
  export * from './migration';
20
20
  export * from './api';
21
+ export * from './view';
22
+ export * from './workflow';
23
+ export * from './report';
24
+ export * from './form';
25
+ export * from './formula';
package/dist/index.js CHANGED
@@ -34,4 +34,9 @@ __exportStar(require("./application"), exports);
34
34
  __exportStar(require("./menu"), exports);
35
35
  __exportStar(require("./migration"), exports);
36
36
  __exportStar(require("./api"), exports);
37
+ __exportStar(require("./view"), exports);
38
+ __exportStar(require("./workflow"), exports);
39
+ __exportStar(require("./report"), exports);
40
+ __exportStar(require("./form"), exports);
41
+ __exportStar(require("./formula"), exports);
37
42
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,6CAA2B;AAC3B,yCAAuB;AACvB,2CAAyB;AACzB,+CAA6B;AAC7B,wCAAsB;AACtB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,+CAA6B;AAC7B,yCAAuB;AACvB,2CAAyB;AACzB,gDAA8B;AAC9B,yCAAuB;AACvB,8CAA4B;AAC5B,wCAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,6CAA2B;AAC3B,yCAAuB;AACvB,2CAAyB;AACzB,+CAA6B;AAC7B,wCAAsB;AACtB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,+CAA6B;AAC7B,yCAAuB;AACvB,2CAAyB;AACzB,gDAA8B;AAC9B,yCAAuB;AACvB,8CAA4B;AAC5B,wCAAsB;AACtB,yCAAuB;AACvB,6CAA2B;AAC3B,2CAAyB;AACzB,yCAAuB;AACvB,4CAA0B"}
@@ -0,0 +1,276 @@
1
+ /**
2
+ * Report Metadata Definition
3
+ *
4
+ * Defines the structure for reports, data summaries, and analytics in ObjectQL.
5
+ * Reports aggregate and visualize data from objects with grouping, filtering, and calculations.
6
+ *
7
+ * Based on patterns from Salesforce Reports, Tableau, and similar BI platforms.
8
+ */
9
+ import { ViewFilter, ViewFilterGroup, ViewColumn } from './view';
10
+ /**
11
+ * Types of reports supported by ObjectQL
12
+ */
13
+ export type ReportType = 'tabular' | 'summary' | 'matrix' | 'chart' | 'dashboard' | 'custom';
14
+ /**
15
+ * Chart types for visualization
16
+ */
17
+ export type ChartType = 'bar' | 'column' | 'line' | 'area' | 'pie' | 'donut' | 'scatter' | 'bubble' | 'funnel' | 'gauge' | 'radar' | 'heatmap' | 'treemap' | 'waterfall' | 'custom';
18
+ /**
19
+ * Aggregation functions for report calculations
20
+ */
21
+ export type AggregationFunction = 'count' | 'sum' | 'avg' | 'min' | 'max' | 'median' | 'mode' | 'stddev' | 'variance' | 'distinct_count' | 'first' | 'last' | 'custom';
22
+ /**
23
+ * Grouping configuration for reports
24
+ */
25
+ export interface ReportGrouping {
26
+ /** Field to group by */
27
+ field: string;
28
+ /** Display label */
29
+ label?: string;
30
+ /** Sort order for groups */
31
+ sort?: 'asc' | 'desc';
32
+ /** Group by date interval (for date fields) */
33
+ date_interval?: 'day' | 'week' | 'month' | 'quarter' | 'year';
34
+ /** Group by numeric range (for numeric fields) */
35
+ numeric_range?: {
36
+ /** Range size */
37
+ size: number;
38
+ /** Starting value */
39
+ start?: number;
40
+ };
41
+ /** Show subtotals for this grouping */
42
+ show_subtotals?: boolean;
43
+ /** Limit number of groups */
44
+ limit?: number;
45
+ }
46
+ /**
47
+ * Aggregation/calculation configuration
48
+ */
49
+ export interface ReportAggregation {
50
+ /** Field to aggregate */
51
+ field: string;
52
+ /** Aggregation function */
53
+ function: AggregationFunction;
54
+ /** Display label */
55
+ label?: string;
56
+ /** Display format */
57
+ format?: string;
58
+ /** Custom aggregation expression */
59
+ expression?: string;
60
+ /** Show in totals row */
61
+ show_in_total?: boolean;
62
+ }
63
+ /**
64
+ * Formula field for calculated columns
65
+ */
66
+ export interface ReportFormula {
67
+ /** Formula name */
68
+ name: string;
69
+ /** Display label */
70
+ label?: string;
71
+ /** Formula expression */
72
+ expression: string;
73
+ /** Data type of result */
74
+ type?: 'number' | 'text' | 'date' | 'boolean';
75
+ /** Display format */
76
+ format?: string;
77
+ /** Description of what this formula calculates */
78
+ description?: string;
79
+ }
80
+ /**
81
+ * Chart configuration for report visualization
82
+ */
83
+ export interface ReportChartConfig {
84
+ /** Chart type */
85
+ type: ChartType;
86
+ /** Chart title */
87
+ title?: string;
88
+ /** Field for X-axis */
89
+ x_axis?: string;
90
+ /** Field(s) for Y-axis */
91
+ y_axis?: string | string[];
92
+ /** Field for chart series/legend */
93
+ series_field?: string;
94
+ /** Chart colors */
95
+ colors?: string[];
96
+ /** Show legend */
97
+ show_legend?: boolean;
98
+ /** Legend position */
99
+ legend_position?: 'top' | 'bottom' | 'left' | 'right';
100
+ /** Show data labels */
101
+ show_data_labels?: boolean;
102
+ /** Chart height in pixels */
103
+ height?: number;
104
+ /** Chart width in pixels */
105
+ width?: number;
106
+ /** Enable drill-down */
107
+ enable_drill_down?: boolean;
108
+ /** Custom chart configuration */
109
+ custom_config?: Record<string, any>;
110
+ }
111
+ /**
112
+ * Matrix report dimension configuration
113
+ */
114
+ export interface MatrixDimension {
115
+ /** Field for this dimension */
116
+ field: string;
117
+ /** Display label */
118
+ label?: string;
119
+ /** Sort order */
120
+ sort?: 'asc' | 'desc';
121
+ /** Show totals */
122
+ show_totals?: boolean;
123
+ }
124
+ /**
125
+ * Export configuration for reports
126
+ */
127
+ export interface ReportExportConfig {
128
+ /** Enabled export formats */
129
+ formats?: ('pdf' | 'xlsx' | 'csv' | 'json' | 'html')[];
130
+ /** Include charts in export */
131
+ include_charts?: boolean;
132
+ /** Export filename template */
133
+ filename_template?: string;
134
+ /** Page orientation for PDF */
135
+ page_orientation?: 'portrait' | 'landscape';
136
+ /** Paper size for PDF */
137
+ paper_size?: 'A4' | 'Letter' | 'Legal';
138
+ }
139
+ /**
140
+ * Scheduling configuration for automated reports
141
+ */
142
+ export interface ReportScheduleConfig {
143
+ /** Enable scheduled execution */
144
+ enabled: boolean;
145
+ /** Cron expression for schedule */
146
+ cron?: string;
147
+ /** Timezone for schedule */
148
+ timezone?: string;
149
+ /** Email recipients for scheduled reports */
150
+ recipients?: string[];
151
+ /** Email subject template */
152
+ email_subject?: string;
153
+ /** Email body template */
154
+ email_body?: string;
155
+ /** Export format for scheduled report */
156
+ format?: 'pdf' | 'xlsx' | 'csv';
157
+ }
158
+ /**
159
+ * Complete report configuration
160
+ */
161
+ export interface ReportConfig {
162
+ /** Unique report identifier */
163
+ name: string;
164
+ /** Display label */
165
+ label: string;
166
+ /** Report type */
167
+ type: ReportType;
168
+ /** Primary object for the report */
169
+ object: string;
170
+ /** Report description */
171
+ description?: string;
172
+ /** Icon for the report */
173
+ icon?: string;
174
+ /** Columns to display */
175
+ columns?: ViewColumn[];
176
+ /** Filters to apply */
177
+ filters?: (ViewFilter | ViewFilterGroup)[];
178
+ /** Grouping configuration */
179
+ groupings?: ReportGrouping[];
180
+ /** Aggregations/calculations */
181
+ aggregations?: ReportAggregation[];
182
+ /** Formula fields */
183
+ formulas?: ReportFormula[];
184
+ /** Chart configuration */
185
+ chart?: ReportChartConfig;
186
+ /** Matrix report row dimension */
187
+ row_dimension?: MatrixDimension;
188
+ /** Matrix report column dimension */
189
+ column_dimension?: MatrixDimension;
190
+ /** Limit number of rows */
191
+ limit?: number;
192
+ /** Enable drill-down to records */
193
+ enable_drill_down?: boolean;
194
+ /** Show record count */
195
+ show_record_count?: boolean;
196
+ /** Show grand totals */
197
+ show_grand_total?: boolean;
198
+ /** Export configuration */
199
+ export?: ReportExportConfig;
200
+ /** Scheduling configuration */
201
+ schedule?: ReportScheduleConfig;
202
+ /** Cache configuration */
203
+ cache?: {
204
+ /** Enable caching */
205
+ enabled?: boolean;
206
+ /** Cache duration in seconds */
207
+ duration?: number;
208
+ };
209
+ /** Access control */
210
+ permissions?: {
211
+ /** Roles that can view this report */
212
+ view?: string[];
213
+ /** Roles that can edit report configuration */
214
+ edit?: string[];
215
+ /** Roles that can export */
216
+ export?: string[];
217
+ };
218
+ /** Whether this report is shared with all users */
219
+ is_public?: boolean;
220
+ /** Owner of the report (for personal reports) */
221
+ owner?: string;
222
+ /** Folder/category for organization */
223
+ folder?: string;
224
+ /** Custom report configuration */
225
+ config?: Record<string, any>;
226
+ /** AI context for report generation */
227
+ ai_context?: {
228
+ /** Business question this report answers */
229
+ intent?: string;
230
+ /** Target audience */
231
+ audience?: string;
232
+ /** Key insights to highlight */
233
+ insights?: string[];
234
+ /** Recommended visualizations */
235
+ visualizations?: string[];
236
+ };
237
+ }
238
+ /**
239
+ * Report execution result
240
+ */
241
+ export interface ReportResult {
242
+ /** Report name */
243
+ report_name: string;
244
+ /** Execution timestamp */
245
+ executed_at: string;
246
+ /** Data rows */
247
+ rows: any[];
248
+ /** Total record count */
249
+ total_count: number;
250
+ /** Aggregation results */
251
+ aggregations?: Record<string, any>;
252
+ /** Grand totals */
253
+ grand_total?: Record<string, any>;
254
+ /** Chart data */
255
+ chart_data?: any;
256
+ /** Execution time in milliseconds */
257
+ execution_time?: number;
258
+ /** Whether result was from cache */
259
+ from_cache?: boolean;
260
+ }
261
+ /**
262
+ * Lightweight report reference
263
+ * Used in navigation, dropdowns, and report selectors
264
+ */
265
+ export interface ReportReference {
266
+ /** Report name/identifier */
267
+ name: string;
268
+ /** Display label */
269
+ label?: string;
270
+ /** Icon */
271
+ icon?: string;
272
+ /** Report type */
273
+ type?: ReportType;
274
+ /** Folder/category */
275
+ folder?: string;
276
+ }
package/dist/report.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Report Metadata Definition
4
+ *
5
+ * Defines the structure for reports, data summaries, and analytics in ObjectQL.
6
+ * Reports aggregate and visualize data from objects with grouping, filtering, and calculations.
7
+ *
8
+ * Based on patterns from Salesforce Reports, Tableau, and similar BI platforms.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"}