@adaptabletools/adaptable 24.0.0-canary.4 → 24.0.0-canary.6

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 (104) hide show
  1. package/aql.d.ts +104 -0
  2. package/aql.js +212 -0
  3. package/devtools.d.ts +182 -1
  4. package/index.css +271 -102
  5. package/package.json +2 -1
  6. package/src/AdaptableInterfaces/IAdaptable.d.ts +4 -4
  7. package/src/AdaptableOptions/DefaultAdaptableOptions.js +5 -5
  8. package/src/AdaptableOptions/FlashingCellOptions.d.ts +3 -3
  9. package/src/AdaptableOptions/SettingsPanelOptions.d.ts +6 -4
  10. package/src/AdaptableOptions/StateOptions.d.ts +37 -13
  11. package/src/AdaptableState/AdaptableState.d.ts +2 -0
  12. package/src/AdaptableState/Common/AdaptableAlert.d.ts +15 -0
  13. package/src/AdaptableState/Common/AdaptableAlert.js +9 -0
  14. package/src/AdaptableState/QuickSearchState.d.ts +4 -0
  15. package/src/Api/Events/LayoutChanged.d.ts +5 -3
  16. package/src/Api/Implementation/AlertApiImpl.d.ts +5 -5
  17. package/src/Api/Implementation/AlertApiImpl.js +26 -19
  18. package/src/Api/Implementation/ColumnScopeApiImpl.js +3 -3
  19. package/src/Api/Implementation/StateApiImpl.d.ts +1 -1
  20. package/src/Api/Implementation/StateApiImpl.js +4 -3
  21. package/src/Api/Internal/AlertInternalApi.js +12 -7
  22. package/src/Api/Internal/CalculatedColumnInternalApi.js +1 -1
  23. package/src/Api/Internal/StateInternalApi.d.ts +1 -1
  24. package/src/Api/Internal/StateInternalApi.js +2 -2
  25. package/src/Api/StateApi.d.ts +2 -2
  26. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +3 -3
  27. package/src/Redux/ActionsReducers/QuickSearchRedux.d.ts +0 -4
  28. package/src/Redux/ActionsReducers/QuickSearchRedux.js +3 -7
  29. package/src/Redux/Store/AdaptableReduxLocalStorageEngine.d.ts +8 -0
  30. package/src/Redux/Store/AdaptableReduxLocalStorageEngine.js +12 -12
  31. package/src/Redux/Store/AdaptableStore.d.ts +8 -5
  32. package/src/Redux/Store/AdaptableStore.js +70 -38
  33. package/src/Redux/Store/Interface/IAdaptableStore.d.ts +5 -5
  34. package/src/Redux/Store/Interface/IStorageEngine.d.ts +4 -4
  35. package/src/Redux/Store/StateOptionsGuards.d.ts +58 -0
  36. package/src/Redux/Store/StateOptionsGuards.js +112 -0
  37. package/src/Redux/Store/isTransientReduxAction.d.ts +5 -0
  38. package/src/Redux/Store/isTransientReduxAction.js +19 -0
  39. package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
  40. package/src/Utilities/Constants/DocumentationLinkConstants.js +1 -0
  41. package/src/Utilities/Constants/ReduxConstants.d.ts +2 -2
  42. package/src/Utilities/Constants/ReduxConstants.js +5 -5
  43. package/src/Utilities/Helpers/AlertTypeHelper.d.ts +1 -1
  44. package/src/Utilities/Helpers/SettingsPanelHelper.d.ts +14 -0
  45. package/src/Utilities/Helpers/SettingsPanelHelper.js +37 -1
  46. package/src/Utilities/Helpers/UIHelper.d.ts +6 -3
  47. package/src/Utilities/Helpers/UIHelper.js +8 -4
  48. package/src/Utilities/ObjectFactory.js +3 -3
  49. package/src/View/Dashboard/DashboardPopupSections.js +1 -1
  50. package/src/View/GridInfo/GridInfoPopup.js +62 -25
  51. package/src/View/StyledColumn/RangesComponent.js +6 -6
  52. package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +2 -2
  53. package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +4 -4
  54. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardRangesSection.js +2 -2
  55. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +2 -2
  56. package/src/View/Wizard/CollapsibleWizardCard.d.ts +3 -1
  57. package/src/View/Wizard/CollapsibleWizardCard.js +17 -9
  58. package/src/agGrid/AdaptableAgGrid.d.ts +4 -4
  59. package/src/agGrid/AdaptableAgGrid.js +2 -0
  60. package/src/agGrid/AgGridColumnAdapter.d.ts +1 -1
  61. package/src/agGrid/AgGridColumnAdapter.js +7 -5
  62. package/src/components/aql/QueryBuilder/QueryBuilderInputs.js +12 -2
  63. package/src/env.js +2 -2
  64. package/src/layout-manager/src/normalizeLayoutModel.d.ts +1 -1
  65. package/src/layout-manager/src/simplifyLayoutModel.d.ts +1 -1
  66. package/src/migration/AdaptableUpgradeHelper.d.ts +7 -2
  67. package/src/migration/VersionUpgrade17.js +13 -8
  68. package/src/setupDevTools.js +442 -103
  69. package/src/types.d.ts +1 -1
  70. package/tsconfig.esm.tsbuildinfo +1 -1
  71. package/upgrade.d.ts +1 -0
  72. package/upgrade.js +1 -0
  73. package/vendor/components/Button/index.d.ts +1 -1
  74. package/vendor/components/Button/index.d.ts.map +1 -1
  75. package/vendor/components/Button/index.js.map +1 -1
  76. package/vendor/components/CheckBox/index.d.ts +1 -1
  77. package/vendor/components/CheckBox/index.d.ts.map +1 -1
  78. package/vendor/components/CheckBox/index.js.map +1 -1
  79. package/vendor/components/ColorPicker/colorPickerTab.d.ts +4 -0
  80. package/vendor/components/ColorPicker/colorPickerTab.d.ts.map +1 -0
  81. package/vendor/components/ColorPicker/colorPickerTab.js +50 -0
  82. package/vendor/components/ColorPicker/colorPickerTab.js.map +1 -0
  83. package/vendor/components/ColorPicker/index.d.ts +31 -0
  84. package/vendor/components/ColorPicker/index.d.ts.map +1 -0
  85. package/vendor/components/ColorPicker/index.js +132 -0
  86. package/vendor/components/ColorPicker/index.js.map +1 -0
  87. package/vendor/components/ColorPicker/themeColors.d.ts +24 -0
  88. package/vendor/components/ColorPicker/themeColors.d.ts.map +1 -0
  89. package/vendor/components/ColorPicker/themeColors.js +52 -0
  90. package/vendor/components/ColorPicker/themeColors.js.map +1 -0
  91. package/vendor/components/Combobox/VirtualizedList.d.ts +1 -1
  92. package/vendor/components/Combobox/VirtualizedList.d.ts.map +1 -1
  93. package/vendor/components/Combobox/VirtualizedList.js.map +1 -1
  94. package/vendor/components/Combobox/index.d.ts +1 -1
  95. package/vendor/components/Combobox/index.d.ts.map +1 -1
  96. package/vendor/components/Combobox/index.js.map +1 -1
  97. package/vendor/components/index.css +213 -0
  98. package/vendor/components/index.d.ts +2 -0
  99. package/vendor/components/index.d.ts.map +1 -1
  100. package/vendor/components/index.js +1 -0
  101. package/vendor/components/index.js.map +1 -1
  102. package/vendor/components/ui/combobox.d.ts.map +1 -1
  103. package/vendor/components/ui/combobox.js +1 -1
  104. package/vendor/components/ui/combobox.js.map +1 -1
package/aql.d.ts ADDED
@@ -0,0 +1,104 @@
1
+ import type { AdaptableColumnDataType } from './src/AdaptableState/Common/AdaptableColumn';
2
+ import type { AdaptableStandardExpressionModule } from './src/AdaptableState/Common/Types';
3
+ import { type LegacyExpressionKind } from './src/aql/legacyExpressionKinds';
4
+ /**
5
+ * What an Expression returns, and whether it is evaluated per row or across rows:
6
+ * - `boolean` - Standard boolean Expressions: Grid Filter, Column Filter, Format Column,
7
+ * Alert and Flashing Cell rules, Named Queries, Reports; also Relative Change
8
+ * (`ANY_CHANGE()`) and boolean Observable rules (`CHANGE_COUNT{[price], WITHIN(5m)} >= 2`)
9
+ * - `scalar` - Standard Expressions returning a value: Calculated Columns, scalar Named
10
+ * Queries; also Observable values (`MAX{[price], WITHIN(1d)}`)
11
+ * - `aggregatedScalar` - Aggregation Expressions in Calculated Columns (`SUM{[price]}`),
12
+ * including Cumulative, Quantile and Window Expressions (`LAG{[price], 1, OVER([date])}`)
13
+ * - `aggregatedBoolean` - Aggregation rules in Alerts (`SUM{[price]} > 100`)
14
+ *
15
+ * Which of these a Module accepts, and which Functions it offers, is checked
16
+ * when `module` is passed to {@link validateExpression}.
17
+ */
18
+ export type AdaptableQLExpressionKind = LegacyExpressionKind;
19
+ export interface ValidateExpressionOptions {
20
+ kind: AdaptableQLExpressionKind;
21
+ /**
22
+ * Module the Expression belongs to. Applies that Module's rules: Observable
23
+ * Functions only in Alert, Calculated Column, Format Column and Flashing
24
+ * Cell; Relative Change Functions only in Alert and Flashing Cell;
25
+ * Cumulative and Window Functions only in Calculated Columns; aggregated
26
+ * kinds only in the Modules that evaluate them. When omitted, every
27
+ * system Function is accepted.
28
+ */
29
+ module?: AdaptableStandardExpressionModule;
30
+ /**
31
+ * Column Id to AdapTable data type. When provided, references to other
32
+ * Columns are errors and Column types are checked against Function inputs.
33
+ */
34
+ columns?: Record<string, AdaptableColumnDataType | undefined>;
35
+ }
36
+ export interface ExpressionValidationIssue {
37
+ /** Stable identifier, e.g. `AQL_LEGACY_SPELLING`; absent for generic type errors */
38
+ code?: string;
39
+ message: string;
40
+ severity: 'error' | 'warning' | 'info';
41
+ /** Character range in the Expression `[start, end)` */
42
+ range?: [number, number];
43
+ /** Suggested rewrite, when one exists */
44
+ quickFix?: {
45
+ label: string;
46
+ replacement: string;
47
+ range?: [number, number];
48
+ };
49
+ }
50
+ export interface ExpressionValidationResult {
51
+ isValid: boolean;
52
+ issues: ExpressionValidationIssue[];
53
+ }
54
+ export interface MigrateExpressionResult {
55
+ /** Current-syntax Expression, or the input unchanged when it does not parse */
56
+ expression: string;
57
+ changed: boolean;
58
+ /** Set when the input does not parse */
59
+ error?: string;
60
+ /** How a rewritten legacy observable rule differs in meaning from the original */
61
+ notes?: string[];
62
+ }
63
+ export interface ExpressionFunctionDescription {
64
+ name: string;
65
+ /** `paren` is `NAME(...)`, `brace` is `NAME{...}` */
66
+ callForm: 'paren' | 'brace';
67
+ group: 'scalar' | 'aggregation' | 'observable' | 'clause';
68
+ returnType?: string;
69
+ description?: string;
70
+ signatures: string[];
71
+ examples: string[];
72
+ category?: string;
73
+ }
74
+ /**
75
+ * Validates an AdapTableQL Expression without a grid. Mirrors
76
+ * `ExpressionApi.isValidBooleanExpression` / `isValidScalarExpression` /
77
+ * `isValidAggregatedScalarExpression` / `isValidAggregatedBooleanExpression`,
78
+ * but reports every issue (with ranges and quick fixes) instead of the first.
79
+ *
80
+ * Pre-v24 spellings (`CUMUL(...)`, `TIMEFRAME(...)`, paren aggregations) are
81
+ * errors; convert them with {@link migrateExpression} first.
82
+ */
83
+ export declare function validateExpression(expressionInput: string, options: ValidateExpressionOptions): ExpressionValidationResult;
84
+ /**
85
+ * Converts a pre-v24 AdapTableQL Expression to the current syntax: brace
86
+ * aggregations (`SUM{[price]}`), named operands (`CUMULATIVE(...)`,
87
+ * `WITHIN(5m)`), no `CUMUL(...)` / `TIMEFRAME(...)` wrappers. Same logic as
88
+ * `ExpressionApi.migratePreV24Expression`.
89
+ *
90
+ * Pass `kind` for single-argument dual names: `SUM([x])` is an aggregation
91
+ * in the aggregated kinds and a row-wise scalar elsewhere.
92
+ *
93
+ * Legacy observable rules (`ROW_CHANGE(COUNT([price], 3), TIMEFRAME('5m'))`)
94
+ * are rewritten to observable calls (`CHANGE_COUNT{[price], WITHIN(5m)} >= 3`),
95
+ * as the State upgrade does for Alerts.
96
+ */
97
+ export declare function migrateExpression(expression: string, options?: {
98
+ kind?: AdaptableQLExpressionKind;
99
+ }): MigrateExpressionResult;
100
+ /**
101
+ * Every system Expression Function, aggregation, observable function and
102
+ * clause, with its signatures and examples.
103
+ */
104
+ export declare function getExpressionFunctionCatalogue(): ExpressionFunctionDescription[];
package/aql.js ADDED
@@ -0,0 +1,212 @@
1
+ import { CLAUSE_DOCS, SYSTEM_AGGREGATION_CATALOGUE, compileValueExpression, isAST_Function, mapDataTypeToStaticType, migrateExpression as migrateAqlExpression, normalizeAst, parse, validateAqlExpression, validateExpressionTypes, } from "./vendor/aql/index.js";
2
+ import { AGGREGATED_BOOLEAN_MODULES, moduleAllowsObservableCalls, } from './src/aql/expressionFunctionAvailability';
3
+ import { getMissingColumnIssues } from './src/aql/getMissingColumnIssues';
4
+ import { mapLegacyKindToValidationRequest, toMigrateOptions, } from './src/aql/legacyExpressionKinds';
5
+ import { systemAggregatedExpressionFunctions, systemAggregationClauseFunctions, systemObservableExpressionFunctions, systemScalarExpressionFunctions, } from './src/aql/systemExpressionFunctions';
6
+ const scalarFunctions = {
7
+ ...systemObservableExpressionFunctions,
8
+ ...systemScalarExpressionFunctions,
9
+ };
10
+ const isAggregatedKind = (kind) => kind === 'aggregatedScalar' || kind === 'aggregatedBoolean';
11
+ const AGGREGATED_KIND_MODULES = {
12
+ aggregatedScalar: ['CalculatedColumn'],
13
+ aggregatedBoolean: AGGREGATED_BOOLEAN_MODULES,
14
+ };
15
+ const scalarPool = systemScalarExpressionFunctions;
16
+ const aggregationPool = {
17
+ ...systemAggregatedExpressionFunctions,
18
+ ...systemAggregationClauseFunctions,
19
+ };
20
+ function getModuleAvailabilityIssues(ast, module, aggregated) {
21
+ const issues = [];
22
+ const reported = new Set();
23
+ const visit = (node) => {
24
+ if (node == null || typeof node !== 'object') {
25
+ return;
26
+ }
27
+ if (Array.isArray(node)) {
28
+ node.forEach(visit);
29
+ return;
30
+ }
31
+ if (!isAST_Function(node)) {
32
+ Object.values(node).forEach(visit);
33
+ return;
34
+ }
35
+ const fn = node;
36
+ const kind = fn.kind ?? fn.metaInfo;
37
+ if (kind === 'OBSERVABLE_CALL') {
38
+ return;
39
+ }
40
+ const scalar = kind === 'FUNCTION' ? scalarPool[fn.type] : undefined;
41
+ const modules = (scalar ?? (aggregated ? aggregationPool[fn.type] : undefined))?.isAvailable;
42
+ if (Array.isArray(modules) && !modules.includes(module)) {
43
+ if (!reported.has(fn.type)) {
44
+ reported.add(fn.type);
45
+ issues.push({
46
+ code: 'AQL_NOT_AVAILABLE_IN_MODULE',
47
+ message: `${fn.type} is not available in ${module} Expressions (only in ${modules.join(', ')})`,
48
+ severity: scalar ? 'error' : 'warning',
49
+ range: fn.range,
50
+ });
51
+ }
52
+ return;
53
+ }
54
+ fn.args.forEach(visit);
55
+ };
56
+ visit(ast);
57
+ return issues;
58
+ }
59
+ const error = (message, code) => ({
60
+ code,
61
+ message,
62
+ severity: 'error',
63
+ });
64
+ const toResult = (issues) => {
65
+ const byKey = new Map();
66
+ for (const issue of issues) {
67
+ const key = `${issue.message}::${issue.range?.join(',') ?? ''}`;
68
+ if (!byKey.get(key)?.code) {
69
+ byKey.set(key, issue);
70
+ }
71
+ }
72
+ const unique = [...byKey.values()];
73
+ return {
74
+ isValid: !unique.some((issue) => issue.severity === 'error'),
75
+ issues: unique,
76
+ };
77
+ };
78
+ export function validateExpression(expressionInput, options) {
79
+ const expression = (expressionInput ?? '').trim();
80
+ if (expression === '') {
81
+ return toResult([error(`empty ${options.kind} expression`, 'AQL_EMPTY')]);
82
+ }
83
+ let ast;
84
+ try {
85
+ ast = parse(expression).ast;
86
+ }
87
+ catch (e) {
88
+ return toResult([error(e instanceof Error ? e.message : String(e), 'AQL_PARSE_ERROR')]);
89
+ }
90
+ const columns = options.columns;
91
+ const getColumnType = columns
92
+ ? (columnId) => mapDataTypeToStaticType(columns[columnId])
93
+ : undefined;
94
+ const issues = [];
95
+ if (!isAggregatedKind(options.kind)) {
96
+ const rootFn = ast[ast.length - 1];
97
+ if (rootFn?.type === undefined || scalarFunctions[rootFn.type] === undefined) {
98
+ return toResult([
99
+ error(`provided function ${rootFn?.type} cannot be handled`, 'AQL_UNKNOWN_FUNCTION'),
100
+ ]);
101
+ }
102
+ const typeCheck = validateExpressionTypes(ast, scalarFunctions, {
103
+ getBraceCallSpec: SYSTEM_AGGREGATION_CATALOGUE.getBraceCallSpec,
104
+ getColumnType,
105
+ });
106
+ issues.push(...typeCheck.issues);
107
+ }
108
+ const { module } = options;
109
+ let kindInModule = true;
110
+ if (module && isAggregatedKind(options.kind)) {
111
+ const modules = AGGREGATED_KIND_MODULES[options.kind];
112
+ kindInModule = modules.includes(module);
113
+ if (!kindInModule) {
114
+ issues.push(error(`${module} does not evaluate ${options.kind} Expressions (only ${modules.join(', ')} does)`, 'AQL_KIND_NOT_IN_MODULE'));
115
+ }
116
+ }
117
+ const structure = validateAqlExpression(ast, {
118
+ request: {
119
+ ...mapLegacyKindToValidationRequest(options.kind),
120
+ requiresAggCalls: false,
121
+ allowsObservableCalls: module ? moduleAllowsObservableCalls(module) : true,
122
+ },
123
+ scalarFunctions,
124
+ catalogue: SYSTEM_AGGREGATION_CATALOGUE,
125
+ getColumnType,
126
+ });
127
+ issues.push(...structure.issues);
128
+ if (module && kindInModule) {
129
+ issues.push(...getModuleAvailabilityIssues(structure.normalizedAst, module, isAggregatedKind(options.kind)));
130
+ }
131
+ if (columns) {
132
+ issues.push(...getMissingColumnIssues(ast, (columnId) => columnId in columns).map((issue) => ({
133
+ ...issue,
134
+ code: 'AQL_UNKNOWN_COLUMN',
135
+ })));
136
+ }
137
+ if (isAggregatedKind(options.kind) && !issues.some((issue) => issue.severity === 'error')) {
138
+ const mismatch = error(`provided ${options.kind} expression does not evaluate to a supported aggregation`, 'AQL_AGG_REQUIRED');
139
+ try {
140
+ const compiled = compileValueExpression(normalizeAst(ast), {
141
+ registry: SYSTEM_AGGREGATION_CATALOGUE,
142
+ getColumnType,
143
+ scalarFunctions: systemScalarExpressionFunctions,
144
+ });
145
+ const isBoolean = compiled.outputType === 'boolean';
146
+ if (compiled.aggregations.length === 0 ||
147
+ (options.kind === 'aggregatedBoolean' && !isBoolean) ||
148
+ (options.kind === 'aggregatedScalar' && isBoolean)) {
149
+ issues.push(mismatch);
150
+ }
151
+ }
152
+ catch (e) {
153
+ issues.push(error(e instanceof Error ? e.message : String(e)));
154
+ }
155
+ }
156
+ return toResult(issues);
157
+ }
158
+ export function migrateExpression(expression, options) {
159
+ const result = migrateAqlExpression((expression ?? '').trim(), {
160
+ ...toMigrateOptions(options?.kind),
161
+ rewriteLegacyObservables: true,
162
+ });
163
+ return {
164
+ expression: result.expression,
165
+ changed: result.changed,
166
+ ...(result.error !== undefined ? { error: result.error } : {}),
167
+ ...(result.notes?.length ? { notes: result.notes.map((note) => note.message) } : {}),
168
+ };
169
+ }
170
+ export function getExpressionFunctionCatalogue() {
171
+ const scalar = Object.entries(systemScalarExpressionFunctions).map(([name, fn]) => ({
172
+ name,
173
+ callForm: 'paren',
174
+ group: 'scalar',
175
+ returnType: fn.returnType,
176
+ description: fn.description,
177
+ signatures: fn.signatures ?? [],
178
+ examples: fn.examples ?? [],
179
+ category: fn.category,
180
+ }));
181
+ const aggregations = SYSTEM_AGGREGATION_CATALOGUE.callables()
182
+ .filter((callable) => callable.system)
183
+ .map((callable) => ({
184
+ name: callable.name,
185
+ callForm: callable.callForm,
186
+ group: 'aggregation',
187
+ description: callable.docs.description,
188
+ signatures: callable.docs.signatures ?? [],
189
+ examples: callable.docs.examples ?? [],
190
+ category: callable.docs.category,
191
+ }));
192
+ const observables = Object.entries(systemObservableExpressionFunctions).map(([name, fn]) => ({
193
+ name,
194
+ callForm: 'brace',
195
+ group: 'observable',
196
+ returnType: fn.returnType,
197
+ description: fn.description,
198
+ signatures: fn.signatures ?? [],
199
+ examples: fn.examples ?? [],
200
+ category: fn.category,
201
+ }));
202
+ const clauses = Object.entries(CLAUSE_DOCS).map(([name, docs]) => ({
203
+ name,
204
+ callForm: 'paren',
205
+ group: 'clause',
206
+ description: docs.description,
207
+ signatures: docs.signatures,
208
+ examples: docs.examples,
209
+ category: docs.category,
210
+ }));
211
+ return [...scalar, ...aggregations, ...observables, ...clauses];
212
+ }
package/devtools.d.ts CHANGED
@@ -1,4 +1,175 @@
1
- import { AdaptableApi } from './types';
1
+ import type { VisibleSettingsPanelNavigationGroup, VisibleSettingsPanelNavigationItem } from './src/Utilities/Helpers/SettingsPanelHelper';
2
+ import type { AdaptableApi, AdaptableColumnDataType, AdaptableModule, AdaptablePersistentState, AdaptableState } from './types';
3
+ /**
4
+ * One AdapTable instance as reported by `window.__ADAPTABLE_DEVTOOLS__.listInstances()`.
5
+ */
6
+ export type DevToolsInstanceInfo = {
7
+ adaptableId: string;
8
+ adaptableVersion: string;
9
+ agGridVersion: string;
10
+ adaptableStateKey: string;
11
+ primaryKey?: string;
12
+ userName?: string;
13
+ gridRuntime: DevToolsGridRuntime;
14
+ };
15
+ /**
16
+ * Column description returned by `window.__ADAPTABLE_DEVTOOLS__.getColumns()`.
17
+ *
18
+ * `id` and `dataType` match the `columns` input of the AdapTable MCP server's
19
+ * `check_state` and `check_expression` tools.
20
+ */
21
+ export type DevToolsColumnInfo = {
22
+ /** AdapTable column id (AG Grid `colId`) */
23
+ id: string;
24
+ friendlyName: string;
25
+ dataType: AdaptableColumnDataType;
26
+ field?: string;
27
+ columnTypes?: string[];
28
+ visible: boolean;
29
+ readOnly: boolean;
30
+ isPrimaryKey: boolean;
31
+ isGrouped: boolean;
32
+ pinned: 'left' | 'right' | false;
33
+ isGeneratedRowGroupColumn: boolean;
34
+ isGeneratedPivotResultColumn: boolean;
35
+ isCalculatedColumn: boolean;
36
+ isFreeTextColumn: boolean;
37
+ isActionColumn: boolean;
38
+ };
39
+ /**
40
+ * Snapshot of the facts shown in the Settings Panel `Grid Info` section,
41
+ * returned by `window.__ADAPTABLE_DEVTOOLS__.getGridInfo()`.
42
+ */
43
+ export type DevToolsGridInfo = {
44
+ adaptableId: string;
45
+ adaptableVersion: string;
46
+ agGridVersion: string;
47
+ adaptableStateKey: string;
48
+ userName?: string;
49
+ primaryKey?: string;
50
+ isAutogeneratedPrimaryKey: boolean;
51
+ licenseKey?: string;
52
+ layout: {
53
+ name: string;
54
+ type: 'Table' | 'Pivot';
55
+ rowGroups: string[];
56
+ pivotColumns: string[];
57
+ sorts: {
58
+ columnId: string;
59
+ sortOrder: string;
60
+ }[];
61
+ };
62
+ columnFilters: string;
63
+ gridFilter?: string;
64
+ rows: {
65
+ all: number;
66
+ visible: number;
67
+ selected: number;
68
+ };
69
+ columns: {
70
+ all: number;
71
+ visible: number;
72
+ calculated: string[];
73
+ freeText: string[];
74
+ action: string[];
75
+ };
76
+ modules: {
77
+ available: AdaptableModule[];
78
+ unavailable: AdaptableModule[];
79
+ };
80
+ };
81
+ export type DevToolsLogLevel = 'info' | 'success' | 'warn' | 'error' | 'perf';
82
+ /**
83
+ * A log message AdapTable wrote, kept in the in-page buffer regardless of
84
+ * `localStorage.debug`.
85
+ */
86
+ export type DevToolsLogEntry = {
87
+ timestamp: number;
88
+ adaptableId: string;
89
+ channel: string;
90
+ level: DevToolsLogLevel;
91
+ /** Message arguments, each formatted as a string (objects as JSON) */
92
+ args: string[];
93
+ };
94
+ /**
95
+ * A state-changing Redux action AdapTable dispatched (transient UI actions are skipped).
96
+ */
97
+ export type DevToolsActionEntry = {
98
+ timestamp: number;
99
+ actionName: string;
100
+ };
101
+ /**
102
+ * In-page API exposed as `window.__ADAPTABLE_DEVTOOLS__` as soon as AdapTable
103
+ * loads in a browser.
104
+ *
105
+ * Built for tools that evaluate JavaScript in the page (coding agents using
106
+ * Chrome DevTools MCP, Playwright `page.evaluate`, the browser console): every
107
+ * method returns plain JSON unless noted, so the result survives serialization.
108
+ *
109
+ * `adaptableId` can be omitted whenever exactly one AdapTable instance is
110
+ * mounted; with several instances, pass the id (see `listInstances()`).
111
+ * Unknown ids throw an `Error` naming the mounted instances.
112
+ *
113
+ * ```ts
114
+ * window.__ADAPTABLE_DEVTOOLS__.listInstances();
115
+ * window.__ADAPTABLE_DEVTOOLS__.getState('Trades', 'Layout');
116
+ * window.__ADAPTABLE_DEVTOOLS__.getLogs('Trades', { level: 'error' });
117
+ * ```
118
+ *
119
+ * The AdapTable DevTools Chrome extension uses the same functions.
120
+ */
121
+ export interface AdaptableDevToolsGlobal {
122
+ /** Short usage text for anyone who only has the global */
123
+ help(): string;
124
+ /** Every mounted AdapTable instance with versions, identity and row counts */
125
+ listInstances(): DevToolsInstanceInfo[];
126
+ /**
127
+ * Full AdapTable State (including the transient `Internal`, `Popup`, `Comment` and
128
+ * `Plugins` sections), serialized. Pass `section` (e.g. `'Layout'`, `'FormatColumn'`)
129
+ * for one section only.
130
+ */
131
+ getState(adaptableId?: string, section?: keyof AdaptableState | string): any;
132
+ /**
133
+ * Persistent (user) state: what AdapTable saves to storage. Use it as the `state`
134
+ * argument of the MCP `check_state` and `migrate_state` tools.
135
+ */
136
+ getPersistentState(adaptableId?: string): AdaptablePersistentState;
137
+ /** Columns AdapTable knows about, with data types and visibility */
138
+ getColumns(adaptableId?: string): DevToolsColumnInfo[];
139
+ /** The facts shown in the Settings Panel Grid Info section */
140
+ getGridInfo(adaptableId?: string): DevToolsGridInfo;
141
+ /**
142
+ * Most recent AdapTable log messages (default 100, newest last), optionally
143
+ * filtered by level or channel substring. Messages are buffered whether or not
144
+ * `localStorage.debug` is set.
145
+ */
146
+ getLogs(adaptableId?: string, options?: {
147
+ level?: DevToolsLogLevel | DevToolsLogLevel[];
148
+ channel?: string;
149
+ limit?: number;
150
+ }): DevToolsLogEntry[];
151
+ /** Most recent state-changing actions (default 50, newest last) */
152
+ getRecentActions(adaptableId?: string, limit?: number): DevToolsActionEntry[];
153
+ /** Restores a state snapshot (as returned by `getState` or `getPersistentState`) */
154
+ restoreState(adaptableId: string | undefined, state: AdaptablePersistentState): Promise<void>;
155
+ /** Opens the Settings Panel, at a Module section when given */
156
+ openSettingsPanel(adaptableId?: string, moduleName?: AdaptableModule): void;
157
+ /**
158
+ * Sets `localStorage.debug` (e.g. `'Adaptable:Trades:*'`, `'Adaptable:*:error'`),
159
+ * `null` removes it. Returns the previous value. Channels created after the call
160
+ * pick it up at once; reload the page to apply it to every channel.
161
+ */
162
+ setLogging(pattern: string | null): string | null;
163
+ /** Toggles `localStorage.adaptableProfileTracks` (Chrome Performance panel tracks) */
164
+ enableProfiling(enabled?: boolean): void;
165
+ /** The live `AdaptableApi` of an instance (not serializable; for in-page use) */
166
+ getApi(adaptableId?: string): AdaptableApi;
167
+ }
168
+ declare global {
169
+ interface Window {
170
+ __ADAPTABLE_DEVTOOLS__?: AdaptableDevToolsGlobal;
171
+ }
172
+ }
2
173
  export type DevToolsMessageAddress = 'adaptable-devtools-contentscript' | 'adaptable-devtools-contentscript-panel' | 'adaptable-devtools-background' | 'adaptable-page';
3
174
  export type DevToolsGenericMessage = {
4
175
  source: DevToolsMessageAddress;
@@ -25,11 +196,17 @@ export type DevToolsGridRuntime = {
25
196
  visibleRowsCount: number;
26
197
  selectedRowsCount: number;
27
198
  };
199
+ export type DevToolsSettingsPanelNavigationItem = VisibleSettingsPanelNavigationItem;
200
+ export type DevToolsSettingsPanelNavigationGroup = VisibleSettingsPanelNavigationGroup;
28
201
  export type DevToolsMountPayload = {
29
202
  adaptableId: string;
30
203
  adaptableVersion: string;
31
204
  agGridVersion: string;
32
205
  licenseKey?: string;
206
+ userName?: string;
207
+ primaryKey?: string;
208
+ /** Grouped modules visible in the Settings Panel sidebar for this instance. */
209
+ settingsPanelNavigation?: DevToolsSettingsPanelNavigationGroup[];
33
210
  };
34
211
  export type DevToolsHostPageLogMessage = {
35
212
  type: Extract<DevToolsHostPageMessageType, 'log'>;
@@ -65,6 +242,10 @@ export type DevToolsHostPageMessage = {
65
242
  state: any;
66
243
  actionName?: string;
67
244
  gridRuntime?: DevToolsGridRuntime;
245
+ licenseKey?: string;
246
+ userName?: string;
247
+ primaryKey?: string;
248
+ settingsPanelNavigation?: DevToolsSettingsPanelNavigationGroup[];
68
249
  };
69
250
  } | DevToolsHostPageLogMessage);
70
251
  export type DevToolsHookFn = (adaptableId: string, options: null | DevToolsFnOptions) => void;