@xh/hoist 83.1.0 → 84.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +76 -0
- package/admin/tabs/cluster/instances/logs/levels/LogLevelDialogModel.ts +106 -10
- package/admin/tabs/cluster/metrics/MetricsModel.ts +3 -3
- package/appcontainer/AppContainerModel.ts +1 -1
- package/appcontainer/README.md +20 -0
- package/assets.d.ts +34 -0
- package/build/types/cmp/ag-grid/AgGrid.d.ts +8 -19
- package/build/types/cmp/ag-grid/AgGridModel.d.ts +18 -5
- package/build/types/cmp/card/Card.d.ts +9 -4
- package/build/types/cmp/card/CardModel.d.ts +15 -2
- package/build/types/cmp/chart/Chart.d.ts +2 -2
- package/build/types/cmp/chart/ChartModel.d.ts +11 -1
- package/build/types/cmp/dataview/DataView.d.ts +4 -2
- package/build/types/cmp/dataview/DataViewModel.d.ts +16 -4
- package/build/types/cmp/filter/FilterChooserModel.d.ts +7 -1
- package/build/types/cmp/form/Form.d.ts +2 -1
- package/build/types/cmp/form/FormModel.d.ts +12 -0
- package/build/types/cmp/form/field/BaseFieldModel.d.ts +7 -0
- package/build/types/cmp/form/formfieldset/FormFieldSetModel.d.ts +7 -1
- package/build/types/cmp/grid/GridModel.d.ts +16 -1
- package/build/types/cmp/grid/GridSorter.d.ts +14 -0
- package/build/types/cmp/grid/Types.d.ts +18 -0
- package/build/types/cmp/grid/columns/Column.d.ts +40 -2
- package/build/types/cmp/grid/columns/ColumnGroup.d.ts +10 -0
- package/build/types/cmp/grouping/GroupingChooserModel.d.ts +9 -2
- package/build/types/cmp/layout/Box.d.ts +19 -7
- package/build/types/cmp/layout/Frame.d.ts +17 -5
- package/build/types/cmp/loadingindicator/LoadingIndicator.d.ts +6 -4
- package/build/types/cmp/pinpad/PinPadModel.d.ts +6 -1
- package/build/types/cmp/spinner/Spinner.d.ts +31 -10
- package/build/types/cmp/tab/TabContainerModel.d.ts +11 -0
- package/build/types/cmp/tab/TabModel.d.ts +7 -0
- package/build/types/cmp/tab/Types.d.ts +4 -0
- package/build/types/cmp/treemap/TreeMapModel.d.ts +3 -3
- package/build/types/cmp/viewmanager/ViewManagerModel.d.ts +9 -0
- package/build/types/cmp/zoneGrid/ZoneGridModel.d.ts +22 -3
- package/build/types/cmp/zoneGrid/impl/ZoneMapperModel.d.ts +6 -0
- package/build/types/core/HoistComponent.d.ts +29 -8
- package/build/types/core/HoistProps.d.ts +9 -3
- package/build/types/core/load/LoadSpec.d.ts +1 -1
- package/build/types/core/persist/provider/ViewManagerProvider.d.ts +7 -0
- package/build/types/data/Store.d.ts +35 -1
- package/build/types/data/StoreSelectionModel.d.ts +18 -2
- package/build/types/data/cube/Cube.d.ts +26 -6
- package/build/types/data/cube/Query.d.ts +10 -0
- package/build/types/data/cube/View.d.ts +21 -2
- package/build/types/data/cube/aggregate/Aggregator.d.ts +13 -0
- package/build/types/data/cube/aggregate/AverageAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/AverageStrictAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/ChildCountAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/LeafCountAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/MaxAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/MinAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/NullAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/SingleAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/SumAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/SumStrictAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/UniqueAggregator.d.ts +1 -0
- package/build/types/data/filter/BaseFilterFieldSpec.d.ts +9 -0
- package/build/types/data/filter/Types.d.ts +12 -0
- package/build/types/desktop/cmp/button/AppMenuButton.d.ts +5 -0
- package/build/types/desktop/cmp/button/Button.d.ts +5 -1
- package/build/types/desktop/cmp/dash/canvas/DashCanvasModel.d.ts +12 -3
- package/build/types/desktop/cmp/dash/container/DashContainerModel.d.ts +9 -0
- package/build/types/desktop/cmp/dock/DockViewModel.d.ts +7 -0
- package/build/types/desktop/cmp/filechooser/FileChooserModel.d.ts +8 -0
- package/build/types/desktop/cmp/grid/editors/BooleanEditor.d.ts +1 -0
- package/build/types/desktop/cmp/grid/editors/DateEditor.d.ts +1 -0
- package/build/types/desktop/cmp/grid/editors/NumberEditor.d.ts +1 -0
- package/build/types/desktop/cmp/grid/editors/SelectEditor.d.ts +1 -0
- package/build/types/desktop/cmp/grid/editors/TextAreaEditor.d.ts +1 -0
- package/build/types/desktop/cmp/grid/editors/TextEditor.d.ts +1 -0
- package/build/types/desktop/cmp/input/Picker.d.ts +1 -1
- package/build/types/desktop/cmp/input/SegmentedControl.d.ts +16 -2
- package/build/types/desktop/cmp/leftrightchooser/LeftRightChooserModel.d.ts +7 -0
- package/build/types/desktop/cmp/modalsupport/ModalSupportModel.d.ts +28 -2
- package/build/types/desktop/cmp/panel/Panel.d.ts +5 -2
- package/build/types/desktop/cmp/panel/PanelModel.d.ts +12 -2
- package/build/types/desktop/cmp/rest/RestGrid.d.ts +10 -0
- package/build/types/desktop/cmp/rest/RestGridModel.d.ts +9 -1
- package/build/types/desktop/cmp/toolbar/Toolbar.d.ts +4 -1
- package/build/types/format/FormatDate.d.ts +4 -4
- package/build/types/icon/Icon.d.ts +3 -0
- package/build/types/kit/blueprint/Wrappers.d.ts +12 -1
- package/build/types/mobile/cmp/navigator/NavigatorModel.d.ts +8 -0
- package/build/types/mobile/cmp/navigator/PageModel.d.ts +7 -0
- package/build/types/mobile/cmp/panel/DialogPanel.d.ts +0 -2
- package/build/types/security/BaseOAuthClient.d.ts +9 -0
- package/build/types/security/authzero/AuthZeroClient.d.ts +6 -0
- package/build/types/security/msal/MsalClient.d.ts +6 -0
- package/build/types/svc/FetchService.d.ts +10 -7
- package/build/types/svc/TraceService.d.ts +17 -2
- package/build/types/utils/async/Timer.d.ts +6 -0
- package/build/types/utils/js/LangUtils.d.ts +1 -1
- package/build/types/utils/js/TestUtils.d.ts +1 -1
- package/build/types/utils/react/index.d.ts +0 -1
- package/build/types/utils/telemetry/Span.d.ts +12 -2
- package/cmp/ag-grid/AgGrid.ts +8 -19
- package/cmp/ag-grid/AgGridModel.ts +18 -5
- package/cmp/card/Card.ts +9 -4
- package/cmp/card/CardModel.ts +15 -2
- package/cmp/chart/Chart.ts +2 -2
- package/cmp/chart/ChartModel.ts +11 -1
- package/cmp/dataview/DataView.ts +4 -2
- package/cmp/dataview/DataViewModel.ts +16 -4
- package/cmp/filter/FilterChooserModel.ts +7 -1
- package/cmp/form/Form.ts +2 -1
- package/cmp/form/FormModel.ts +12 -0
- package/cmp/form/README.md +13 -0
- package/cmp/form/field/BaseFieldModel.ts +7 -0
- package/cmp/form/formfieldset/FormFieldSetModel.ts +7 -1
- package/cmp/grid/Grid.scss +14 -8
- package/cmp/grid/GridModel.ts +16 -1
- package/cmp/grid/GridSorter.ts +14 -0
- package/cmp/grid/README.md +12 -0
- package/cmp/grid/Types.ts +18 -0
- package/cmp/grid/columns/Column.ts +40 -2
- package/cmp/grid/columns/ColumnGroup.ts +10 -0
- package/cmp/grouping/GroupingChooserModel.ts +9 -2
- package/cmp/layout/Box.ts +19 -7
- package/cmp/layout/Frame.ts +17 -5
- package/cmp/layout/README.md +16 -21
- package/cmp/loadingindicator/LoadingIndicator.scss +1 -1
- package/cmp/loadingindicator/LoadingIndicator.ts +11 -9
- package/cmp/pinpad/PinPadModel.ts +6 -1
- package/cmp/spinner/Spinner.scss +13 -0
- package/cmp/spinner/Spinner.ts +58 -20
- package/cmp/tab/TabContainerModel.ts +11 -0
- package/cmp/tab/TabModel.ts +7 -0
- package/cmp/tab/Types.ts +4 -0
- package/cmp/treemap/TreeMapModel.ts +3 -3
- package/cmp/viewmanager/ViewManagerModel.ts +9 -0
- package/cmp/zoneGrid/ZoneGridModel.ts +22 -3
- package/cmp/zoneGrid/impl/ZoneMapperModel.ts +6 -0
- package/core/ExceptionHandler.ts +1 -1
- package/core/HoistComponent.ts +36 -11
- package/core/HoistProps.ts +9 -3
- package/core/README.md +68 -6
- package/core/impl/InstanceManager.ts +1 -0
- package/core/load/LoadSpec.ts +1 -1
- package/core/persist/provider/ViewManagerProvider.ts +7 -0
- package/data/README.md +48 -124
- package/data/Store.ts +35 -1
- package/data/StoreSelectionModel.ts +18 -2
- package/data/cube/Cube.ts +26 -6
- package/data/cube/Query.ts +10 -0
- package/data/cube/README.md +236 -0
- package/data/cube/View.ts +21 -2
- package/data/cube/aggregate/Aggregator.ts +13 -0
- package/data/cube/aggregate/AverageAggregator.ts +1 -0
- package/data/cube/aggregate/AverageStrictAggregator.ts +1 -0
- package/data/cube/aggregate/ChildCountAggregator.ts +1 -0
- package/data/cube/aggregate/LeafCountAggregator.ts +1 -0
- package/data/cube/aggregate/MaxAggregator.ts +1 -0
- package/data/cube/aggregate/MinAggregator.ts +1 -0
- package/data/cube/aggregate/NullAggregator.ts +1 -0
- package/data/cube/aggregate/SingleAggregator.ts +1 -0
- package/data/cube/aggregate/SumAggregator.ts +1 -0
- package/data/cube/aggregate/SumStrictAggregator.ts +1 -0
- package/data/cube/aggregate/UniqueAggregator.ts +1 -0
- package/data/filter/BaseFilterFieldSpec.ts +9 -0
- package/data/filter/Types.ts +12 -0
- package/desktop/README.md +131 -9
- package/desktop/appcontainer/AboutDialog.ts +2 -0
- package/desktop/appcontainer/Banner.ts +5 -2
- package/desktop/appcontainer/ChangelogDialog.ts +1 -0
- package/desktop/appcontainer/ExceptionDialog.ts +4 -0
- package/desktop/appcontainer/ExceptionDialogDetails.ts +4 -1
- package/desktop/appcontainer/FeedbackDialog.ts +4 -1
- package/desktop/appcontainer/ImpersonationBar.ts +4 -0
- package/desktop/appcontainer/LockoutPanel.ts +4 -1
- package/desktop/appcontainer/LoginPanel.ts +7 -3
- package/desktop/appcontainer/Message.ts +9 -3
- package/desktop/appcontainer/OptionsDialog.ts +3 -1
- package/desktop/appcontainer/VersionBar.ts +1 -0
- package/desktop/appcontainer/suspend/IdlePanel.ts +4 -4
- package/desktop/appcontainer/suspend/SuspendPanel.ts +3 -0
- package/desktop/cmp/button/AppMenuButton.ts +5 -0
- package/desktop/cmp/button/Button.ts +14 -4
- package/desktop/cmp/dash/README.md +14 -0
- package/desktop/cmp/dash/canvas/DashCanvasModel.ts +12 -3
- package/desktop/cmp/dash/container/DashContainerModel.ts +9 -0
- package/desktop/cmp/dock/DockViewModel.ts +7 -0
- package/desktop/cmp/filechooser/FileChooserModel.ts +9 -2
- package/desktop/cmp/grid/editors/BooleanEditor.ts +1 -0
- package/desktop/cmp/grid/editors/DateEditor.ts +1 -0
- package/desktop/cmp/grid/editors/NumberEditor.ts +1 -0
- package/desktop/cmp/grid/editors/SelectEditor.ts +1 -0
- package/desktop/cmp/grid/editors/TextAreaEditor.ts +1 -0
- package/desktop/cmp/grid/editors/TextEditor.ts +1 -0
- package/desktop/cmp/input/Picker.ts +2 -2
- package/desktop/cmp/input/SegmentedControl.ts +20 -2
- package/desktop/cmp/leftrightchooser/LeftRightChooserModel.ts +7 -0
- package/desktop/cmp/modalsupport/ModalSupportModel.ts +31 -2
- package/desktop/cmp/panel/Panel.ts +29 -21
- package/desktop/cmp/panel/PanelModel.ts +12 -2
- package/desktop/cmp/panel/README.md +20 -0
- package/desktop/cmp/rest/RestGrid.ts +10 -0
- package/desktop/cmp/rest/RestGridModel.ts +9 -1
- package/desktop/cmp/toolbar/Toolbar.ts +9 -2
- package/desktop/cmp/viewmanager/ViewManager.ts +1 -1
- package/docs/README.md +9 -4
- package/docs/coding-conventions.md +29 -21
- package/docs/doc-registry.json +31 -15
- package/docs/planning/docs-roadmap-log.md +11 -0
- package/docs/planning/docs-roadmap.md +1 -0
- package/docs/upgrade-notes/v84-upgrade-notes.md +136 -0
- package/docs/version-compatibility.md +2 -0
- package/format/FormatDate.ts +4 -4
- package/icon/Icon.ts +9 -0
- package/icon/README.md +62 -22
- package/icon/index.ts +24 -0
- package/kit/README.md +8 -2
- package/kit/blueprint/Wrappers.ts +12 -1
- package/mcp/README.md +47 -26
- package/mcp/cli/ts.ts +39 -4
- package/mcp/data/ts-registry.ts +57 -17
- package/mcp/tools/typescript.ts +32 -4
- package/mobile/appcontainer/AboutDialog.ts +3 -0
- package/mobile/appcontainer/Banner.ts +2 -0
- package/mobile/appcontainer/ExceptionDialog.ts +4 -0
- package/mobile/appcontainer/ExceptionDialogDetails.ts +1 -0
- package/mobile/appcontainer/FeedbackDialog.ts +4 -1
- package/mobile/appcontainer/ImpersonationBar.ts +2 -0
- package/mobile/appcontainer/LockoutPanel.ts +2 -0
- package/mobile/appcontainer/LoginPanel.ts +7 -3
- package/mobile/appcontainer/Message.ts +9 -3
- package/mobile/appcontainer/OptionsDialog.ts +5 -1
- package/mobile/appcontainer/VersionBar.ts +1 -0
- package/mobile/appcontainer/suspend/IdlePanel.ts +5 -6
- package/mobile/appcontainer/suspend/SuspendPanel.ts +3 -0
- package/mobile/cmp/navigator/NavigatorModel.ts +8 -0
- package/mobile/cmp/navigator/PageModel.ts +7 -0
- package/mobile/cmp/panel/DialogPanel.ts +0 -2
- package/package.json +11 -11
- package/security/BaseOAuthClient.ts +9 -0
- package/security/authzero/AuthZeroClient.ts +6 -0
- package/security/msal/MsalClient.ts +6 -0
- package/styles/vars.scss +14 -0
- package/svc/FetchService.ts +25 -15
- package/svc/README.md +39 -9
- package/svc/TraceService.ts +69 -11
- package/utils/README.md +0 -1
- package/utils/async/Timer.ts +6 -0
- package/utils/js/LangUtils.ts +1 -1
- package/utils/js/TestUtils.ts +1 -1
- package/utils/react/index.ts +0 -1
- package/utils/telemetry/Span.ts +21 -4
- package/build/types/utils/react/ClassName.d.ts +0 -14
- package/utils/react/ClassName.ts +0 -24
package/svc/TraceService.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Copyright © 2026 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
|
-
import {HoistService, XH} from '@xh/hoist/core';
|
|
7
|
+
import {HoistService, PlainObject, XH} from '@xh/hoist/core';
|
|
8
8
|
import {SECONDS} from '@xh/hoist/utils/datetime';
|
|
9
9
|
import {debounced, parseNameSource} from '@xh/hoist/utils/js';
|
|
10
|
-
import {isEmpty, isString} from 'lodash';
|
|
10
|
+
import {every, isEmpty, isString} from 'lodash';
|
|
11
11
|
import {Span, SpanConfig} from '@xh/hoist/utils/telemetry';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -18,7 +18,7 @@ import {Span, SpanConfig} from '@xh/hoist/utils/telemetry';
|
|
|
18
18
|
* end-to-end traces from user interaction through server processing and back.
|
|
19
19
|
*
|
|
20
20
|
* Controlled by the `xhTraceConfig` soft config. When disabled (the default), all
|
|
21
|
-
* span-creation methods are no-ops
|
|
21
|
+
* span-creation methods are no-ops - the wrapped function still executes normally.
|
|
22
22
|
*
|
|
23
23
|
* Completed spans are batched and exported to the Hoist server endpoint `xh/submitSpans`,
|
|
24
24
|
* which relays them to the configured collector.
|
|
@@ -111,7 +111,10 @@ export class TraceService extends HoistService {
|
|
|
111
111
|
* Create a new span, or return null if tracing is disabled.
|
|
112
112
|
* Inherits the parent's `source` tag if not specified.
|
|
113
113
|
*
|
|
114
|
-
*
|
|
114
|
+
* Sampling rules from `xhTraceConfig.sampleRules` are evaluated against the span's tags
|
|
115
|
+
* at creation time (head-based). Child spans inherit their parent's sampling decision.
|
|
116
|
+
* Unsampled spans may still be exported if they end in error and `alwaysSampleErrors` is
|
|
117
|
+
* enabled — see {@link exportSpan}.
|
|
115
118
|
*
|
|
116
119
|
* @param config - span name string, or a SpanConfig with name and optional tags.
|
|
117
120
|
*/
|
|
@@ -122,14 +125,17 @@ export class TraceService extends HoistService {
|
|
|
122
125
|
|
|
123
126
|
// Apply default tags.
|
|
124
127
|
ret.tags = {
|
|
125
|
-
clientApp: XH.clientAppCode,
|
|
126
|
-
loadId: XH.loadId,
|
|
127
|
-
tabId: XH.tabId,
|
|
128
|
-
source: ret.parent?.tags?.source ?? 'app',
|
|
128
|
+
'xh.clientApp': XH.clientAppCode,
|
|
129
|
+
'xh.loadId': XH.loadId,
|
|
130
|
+
'xh.tabId': XH.tabId,
|
|
131
|
+
'xh.source': ret.parent?.tags?.['xh.source'] ?? 'app',
|
|
129
132
|
...(ret.caller ? {'code.namespace': parseNameSource(ret.caller)} : {}),
|
|
130
133
|
...ret.tags
|
|
131
134
|
};
|
|
132
135
|
|
|
136
|
+
// Sampling: children inherit parent decision; root spans evaluate rules.
|
|
137
|
+
ret.sampled = ret.parent ? ret.parent.sampled : this.shouldSample(ret.tags);
|
|
138
|
+
|
|
133
139
|
return new Span(ret);
|
|
134
140
|
}
|
|
135
141
|
|
|
@@ -138,8 +144,15 @@ export class TraceService extends HoistService {
|
|
|
138
144
|
//------------------
|
|
139
145
|
/** Submit a completed span for export. */
|
|
140
146
|
exportSpan(span: Span) {
|
|
141
|
-
this.
|
|
142
|
-
|
|
147
|
+
if (span.sampled || (this.conf.alwaysSampleErrors && span.status === 'error')) {
|
|
148
|
+
this._pending.push(span);
|
|
149
|
+
|
|
150
|
+
// Queue the span, but if this is the submitSpans export itself, don't schedule
|
|
151
|
+
// another flush or we'll loop forever.
|
|
152
|
+
if (!span.tags['url.path']?.endsWith('xh/submitSpans')) {
|
|
153
|
+
this.pushPendingBuffered();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
143
156
|
}
|
|
144
157
|
|
|
145
158
|
/**
|
|
@@ -169,10 +182,55 @@ export class TraceService extends HoistService {
|
|
|
169
182
|
//------------------
|
|
170
183
|
@debounced(5 * SECONDS)
|
|
171
184
|
private pushPendingBuffered() {
|
|
172
|
-
this.pushPendingAsync();
|
|
185
|
+
void this.pushPendingAsync();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Evaluate sampling rules against a span's tags. */
|
|
189
|
+
private shouldSample(tags: PlainObject): boolean {
|
|
190
|
+
try {
|
|
191
|
+
return Math.random() < this.getSampleRate(tags);
|
|
192
|
+
} catch (e) {
|
|
193
|
+
this.logError('Failed to compute sample rate', e);
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private getSampleRate(tags: PlainObject): number {
|
|
199
|
+
const {conf} = this;
|
|
200
|
+
for (const rule of conf.sampleRules ?? []) {
|
|
201
|
+
if (every(rule.match, (v, k) => this.matchesValue(tags[k], v))) {
|
|
202
|
+
return rule.sampleRate;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return conf.sampleRate;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** For strings, simple glob matching: `*` = any, `foo*` = prefix, `*foo` = suffix, `*foo*` = contains. */
|
|
209
|
+
private matchesValue(actual: any, pattern: any): boolean {
|
|
210
|
+
if (!isString(actual) || !isString(pattern)) {
|
|
211
|
+
return actual === pattern;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (pattern === '*') return true;
|
|
215
|
+
const startsWithWild = pattern.startsWith('*'),
|
|
216
|
+
endsWithWild = pattern.endsWith('*'),
|
|
217
|
+
core = pattern.replace(/^\*|\*$/g, '');
|
|
218
|
+
|
|
219
|
+
if (startsWithWild && endsWithWild) return actual.includes(core);
|
|
220
|
+
if (startsWithWild) return actual.endsWith(core);
|
|
221
|
+
if (endsWithWild) return actual.startsWith(core);
|
|
222
|
+
return actual === pattern;
|
|
173
223
|
}
|
|
174
224
|
}
|
|
175
225
|
|
|
176
226
|
interface TraceConfig {
|
|
177
227
|
enabled: boolean;
|
|
228
|
+
sampleRules?: SamplingRule[];
|
|
229
|
+
sampleRate?: number;
|
|
230
|
+
alwaysSampleErrors?: boolean;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
interface SamplingRule {
|
|
234
|
+
match: Record<string, string>;
|
|
235
|
+
sampleRate: number;
|
|
178
236
|
}
|
package/utils/README.md
CHANGED
|
@@ -472,7 +472,6 @@ for the full list of supported props and conversion details.
|
|
|
472
472
|
|
|
473
473
|
| Function | Description |
|
|
474
474
|
|----------|-------------|
|
|
475
|
-
| `getClassName(baseName, props, ...extras)` | Combine a base CSS class with `props.className` and additional class names |
|
|
476
475
|
| `createObservableRef()` | Create a ref that works as both a React ref object and callback ref, with a MobX-observable `current` property |
|
|
477
476
|
| `elementFromContent(content, addProps?)` | Create a React element from a `Content` value (element, HoistComponent, or render function) |
|
|
478
477
|
|
package/utils/async/Timer.ts
CHANGED
|
@@ -172,6 +172,12 @@ export class Timer {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Configuration for a {@link Timer} - a managed interval that runs a function repeatedly
|
|
177
|
+
* with configurable delay, timeout, and app-config-driven intervals.
|
|
178
|
+
*
|
|
179
|
+
* @see Timer
|
|
180
|
+
*/
|
|
175
181
|
export interface TimerSpec {
|
|
176
182
|
/**
|
|
177
183
|
* Function to run.
|
package/utils/js/LangUtils.ts
CHANGED
|
@@ -282,7 +282,7 @@ export function mergeDeep(target: PlainObject, ...sources: PlainObject[]): Plain
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
/**
|
|
285
|
-
* A string, or an object from which a name can be derived
|
|
285
|
+
* A string, or an object from which a name can be derived - via `displayName` (e.g. React
|
|
286
286
|
* components) or `constructor.name` (e.g. class instances). Used for logging and tracing.
|
|
287
287
|
*/
|
|
288
288
|
export type NameSource = string | {displayName: string} | {constructor: {name: string}};
|
package/utils/js/TestUtils.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {isString} from 'lodash';
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* HTML attribute name used to tag elements with stable test identifiers. Use as a computed
|
|
12
|
-
* property key on element specs
|
|
12
|
+
* property key on element specs - e.g. `{[TEST_ID]: 'my-grid'}` - to emit a `data-testid`
|
|
13
13
|
* attribute that automated test drivers can locate reliably.
|
|
14
14
|
*/
|
|
15
15
|
export const TEST_ID = 'data-testid';
|
package/utils/react/index.ts
CHANGED
package/utils/telemetry/Span.ts
CHANGED
|
@@ -29,7 +29,7 @@ export class Span {
|
|
|
29
29
|
/** Epoch ms (Date.now()-based). */
|
|
30
30
|
startTime: number;
|
|
31
31
|
|
|
32
|
-
/** Epoch ms
|
|
32
|
+
/** Epoch ms - set when span ends. */
|
|
33
33
|
endTime: number;
|
|
34
34
|
|
|
35
35
|
/** Duration in ms (endTime - startTime). */
|
|
@@ -42,6 +42,9 @@ export class Span {
|
|
|
42
42
|
tags: PlainObject;
|
|
43
43
|
events: SpanEvent[] = [];
|
|
44
44
|
|
|
45
|
+
/** Whether this span was selected by client-side sampling rules. */
|
|
46
|
+
sampled: boolean;
|
|
47
|
+
|
|
45
48
|
constructor(config: SpanConfig) {
|
|
46
49
|
const parent = config.parent;
|
|
47
50
|
this.traceId = parent?.traceId ?? genTraceId();
|
|
@@ -51,6 +54,7 @@ export class Span {
|
|
|
51
54
|
this.kind = config.kind ?? 'internal';
|
|
52
55
|
this.startTime = config.startTime ?? Date.now();
|
|
53
56
|
this.tags = {...config.tags};
|
|
57
|
+
this.sampled = config.sampled ?? true;
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
/** End this span, recording status and computing duration. */
|
|
@@ -83,11 +87,19 @@ export class Span {
|
|
|
83
87
|
duration: this.duration,
|
|
84
88
|
status: this.status,
|
|
85
89
|
tags: this.tags,
|
|
86
|
-
events: this.events
|
|
90
|
+
events: this.events,
|
|
91
|
+
sampled: this.sampled
|
|
87
92
|
};
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Configuration for a {@link Span} - a lightweight trace span for distributed tracing.
|
|
98
|
+
* Create via {@link TraceService} rather than directly.
|
|
99
|
+
*
|
|
100
|
+
* @see Span
|
|
101
|
+
* @see TraceService
|
|
102
|
+
*/
|
|
91
103
|
export interface SpanConfig {
|
|
92
104
|
name: string;
|
|
93
105
|
kind?: SpanKind;
|
|
@@ -95,6 +107,7 @@ export interface SpanConfig {
|
|
|
95
107
|
parent?: Span;
|
|
96
108
|
startTime?: number;
|
|
97
109
|
caller?: NameSource;
|
|
110
|
+
sampled?: boolean;
|
|
98
111
|
}
|
|
99
112
|
|
|
100
113
|
export interface SpanEvent {
|
|
@@ -110,8 +123,12 @@ export type SpanStatus = 'ok' | 'error' | 'unset';
|
|
|
110
123
|
* Format a W3C traceparent header value.
|
|
111
124
|
* @see https://www.w3.org/TR/trace-context/#traceparent-header
|
|
112
125
|
*/
|
|
113
|
-
export function formatTraceparent(
|
|
114
|
-
|
|
126
|
+
export function formatTraceparent(
|
|
127
|
+
traceId: string,
|
|
128
|
+
spanId: string,
|
|
129
|
+
sampled: boolean = true
|
|
130
|
+
): string {
|
|
131
|
+
return `00-${traceId}-${spanId}-${sampled ? '01' : '00'}`;
|
|
115
132
|
}
|
|
116
133
|
|
|
117
134
|
/** Generate a 32-hex-char (128-bit) trace ID. */
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate a string with one or more CSS classes to apply to a component, typically concatenating a
|
|
3
|
-
* standardized base className with any instance-specific getClassName(s) provided via props and any
|
|
4
|
-
* optional / conditional class names determined at render-time.
|
|
5
|
-
*
|
|
6
|
-
* Components should call this to produce a combined class list and apply it to their outermost
|
|
7
|
-
* (or otherwise most appropriate) rendered component.
|
|
8
|
-
*
|
|
9
|
-
* @param baseName - base class name for the component.
|
|
10
|
-
* @param props - component props.
|
|
11
|
-
* @param extraNames - optional, additional class names to append.
|
|
12
|
-
* @returns concatenated, space-delimited class name appropriate for html className attribute.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getClassName(baseName: string, props: any, ...extraNames: string[]): string;
|
package/utils/react/ClassName.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2026 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
import classNames from 'classnames';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Generate a string with one or more CSS classes to apply to a component, typically concatenating a
|
|
11
|
-
* standardized base className with any instance-specific getClassName(s) provided via props and any
|
|
12
|
-
* optional / conditional class names determined at render-time.
|
|
13
|
-
*
|
|
14
|
-
* Components should call this to produce a combined class list and apply it to their outermost
|
|
15
|
-
* (or otherwise most appropriate) rendered component.
|
|
16
|
-
*
|
|
17
|
-
* @param baseName - base class name for the component.
|
|
18
|
-
* @param props - component props.
|
|
19
|
-
* @param extraNames - optional, additional class names to append.
|
|
20
|
-
* @returns concatenated, space-delimited class name appropriate for html className attribute.
|
|
21
|
-
*/
|
|
22
|
-
export function getClassName(baseName: string, props: any, ...extraNames: string[]): string {
|
|
23
|
-
return classNames(baseName, props.className, ...extraNames);
|
|
24
|
-
}
|