@xh/hoist 76.0.0-SNAPSHOT.1758150416326 → 76.0.0-SNAPSHOT.1758209096583
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 +0 -4
- package/admin/tabs/userData/roles/graph/RoleGraph.ts +1 -2
- package/build/types/core/XH.d.ts +0 -13
- package/build/types/utils/js/LangUtils.d.ts +2 -2
- package/build/types/utils/{log → js}/LogUtils.d.ts +2 -29
- package/build/types/utils/js/index.d.ts +1 -0
- package/cmp/ag-grid/AgGrid.ts +1 -1
- package/cmp/chart/Chart.ts +1 -2
- package/cmp/chart/impl/ChartContextMenuItems.ts +1 -1
- package/cmp/grid/columns/Column.ts +1 -2
- package/cmp/grid/helpers/GridCountLabel.ts +1 -2
- package/cmp/grid/impl/ColumnWidthCalculator.ts +1 -2
- package/cmp/grid/impl/Utils.ts +1 -2
- package/cmp/relativetimestamp/RelativeTimestamp.ts +1 -2
- package/cmp/treemap/TreeMap.ts +1 -2
- package/core/HoistBase.ts +3 -2
- package/core/HoistBaseDecorators.ts +1 -2
- package/core/HoistComponent.ts +6 -9
- package/core/XH.ts +0 -19
- package/core/exception/ExceptionHandler.ts +2 -3
- package/core/load/LoadSupport.ts +2 -3
- package/core/persist/PersistenceProvider.ts +1 -2
- package/data/filter/Utils.ts +1 -2
- package/data/impl/RecordSet.ts +1 -2
- package/desktop/cmp/button/grid/ColAutosizeButton.ts +1 -2
- package/desktop/cmp/button/grid/ColChooserButton.ts +1 -2
- package/desktop/cmp/button/grid/ExpandToLevelButton.ts +1 -2
- package/desktop/cmp/button/grid/ExportButton.ts +1 -2
- package/desktop/cmp/button/panel/ModalToggleButton.ts +1 -2
- package/desktop/cmp/button/zoneGrid/ZoneMapperButton.ts +1 -2
- package/desktop/cmp/dash/container/impl/DashContainerUtils.ts +3 -4
- package/desktop/cmp/form/FormField.ts +1 -2
- package/desktop/cmp/grid/editors/BooleanEditor.ts +1 -1
- package/desktop/cmp/panel/Panel.ts +1 -1
- package/desktop/hooks/UseContextMenu.ts +1 -1
- package/inspector/instances/InstancesModel.ts +2 -2
- package/kit/ag-grid/index.ts +1 -2
- package/kit/highcharts/index.ts +1 -2
- package/mobile/cmp/button/grid/ColAutosizeButton.ts +1 -2
- package/mobile/cmp/button/grid/ColChooserButton.ts +1 -2
- package/mobile/cmp/button/grid/ExpandCollapseButton.ts +1 -2
- package/mobile/cmp/button/grid/ExpandToLevelButton.ts +1 -2
- package/mobile/cmp/button/zoneGrid/ZoneMapperButton.ts +1 -2
- package/mobile/cmp/panel/Panel.ts +1 -1
- package/mobx/overrides.ts +1 -1
- package/package.json +1 -1
- package/security/BaseOAuthClient.ts +1 -2
- package/security/msal/MsalClient.ts +1 -2
- package/svc/FetchService.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/utils/async/Timer.ts +1 -2
- package/utils/js/Decorators.ts +1 -1
- package/utils/js/LangUtils.ts +3 -3
- package/utils/{log → js}/LogUtils.ts +12 -74
- package/utils/js/index.ts +1 -0
- package/build/types/utils/log/index.d.ts +0 -1
- package/utils/log/index.ts +0 -8
package/utils/async/Timer.ts
CHANGED
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
import {XH} from '@xh/hoist/core';
|
|
8
8
|
import {wait} from '@xh/hoist/promise';
|
|
9
9
|
import {MILLISECONDS, MINUTES, olderThan} from '@xh/hoist/utils/datetime';
|
|
10
|
-
import {throwIf} from '@xh/hoist/utils/js';
|
|
11
|
-
import {logError, logWarn} from '@xh/hoist/utils/log';
|
|
10
|
+
import {logError, logWarn, throwIf} from '@xh/hoist/utils/js';
|
|
12
11
|
import {isBoolean, isFinite, isFunction, isNil, isString, pull} from 'lodash';
|
|
13
12
|
|
|
14
13
|
/**
|
package/utils/js/Decorators.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import {XH} from '@xh/hoist/core';
|
|
8
8
|
import {debounce, isFunction} from 'lodash';
|
|
9
9
|
import {getOrCreate, throwIf, warnIf} from './LangUtils';
|
|
10
|
-
import {withDebug, withInfo} from '
|
|
10
|
+
import {withDebug, withInfo} from './LogUtils';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Decorates a class method so that it is debounced by the specified duration.
|
package/utils/js/LangUtils.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import {PlainObject, Thunkable} from '@xh/hoist/core';
|
|
8
8
|
import {Exception} from '@xh/hoist/core/exception/Exception';
|
|
9
|
-
import {
|
|
9
|
+
import {LogSource, logWarn} from '@xh/hoist/utils/js/LogUtils';
|
|
10
10
|
import {
|
|
11
11
|
flatMap,
|
|
12
12
|
forOwn,
|
|
@@ -170,7 +170,7 @@ export interface APIWarnOptions {
|
|
|
170
170
|
/** An additional message. Can contain suggestions for alternatives. */
|
|
171
171
|
msg?: string;
|
|
172
172
|
|
|
173
|
-
/** Source of message for
|
|
173
|
+
/** Source of message for labelling log message. */
|
|
174
174
|
source?: LogSource;
|
|
175
175
|
}
|
|
176
176
|
|
|
@@ -198,7 +198,7 @@ export function apiDeprecated(name: string, opts: APIWarnOptions = {}) {
|
|
|
198
198
|
msg = opts.msg ?? '',
|
|
199
199
|
warn = `The use of '${name}' has been deprecated and will be removed in ${v}. ${msg}`;
|
|
200
200
|
if (!_seenWarnings[warn]) {
|
|
201
|
-
|
|
201
|
+
logWarn(warn, opts.source);
|
|
202
202
|
_seenWarnings[warn] = true;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -6,62 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import {Some} from '@xh/hoist/core';
|
|
8
8
|
import {castArray, isString} from 'lodash';
|
|
9
|
-
import
|
|
10
|
-
import {intersperse} from '../js/LangUtils';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Utility functions providing managed, structured logging to Hoist apps.
|
|
14
|
-
*
|
|
15
|
-
* Essentially a wrapper around the browser console supporting logging levels, timing, and
|
|
16
|
-
* miscellaneous Hoist display conventions.
|
|
17
|
-
*
|
|
18
|
-
* Objects extending `HoistBase` need not import these functions directly, as they are available
|
|
19
|
-
* via delegates on `HoistBase`.
|
|
20
|
-
*
|
|
21
|
-
* Hoist sets its minimum severity level to 'info' by default. This prevents performance or
|
|
22
|
-
* memory impacts that might result from verbose debug logging. This can be adjusted by calling
|
|
23
|
-
* XH.logLevel from the console.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/** Severity Level for log statement */
|
|
27
|
-
export type LogLevel = 'error' | 'warn' | 'info' | 'debug';
|
|
9
|
+
import {intersperse} from './LangUtils';
|
|
28
10
|
|
|
29
11
|
/** Object identifying the source of log statement. Typically, a javascript class */
|
|
30
12
|
export type LogSource = string | {displayName: string} | {constructor: {name: string}};
|
|
31
13
|
|
|
32
|
-
/**
|
|
33
|
-
* Current minimum severity for Hoist log utils (default 'info').
|
|
34
|
-
* Messages logged via managed Hoist log utils with lower severity will be ignored.
|
|
35
|
-
*
|
|
36
|
-
* @internal - use public `XH.logLevel`.
|
|
37
|
-
*/
|
|
38
|
-
export function getLogLevel() {
|
|
39
|
-
return _logLevel;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Set the minimum severity for Hoist log utils until the page is refreshed. Optionally persist
|
|
44
|
-
* this adjustment to sessionStorage to maintain for the lifetime of the browser tab.
|
|
45
|
-
*
|
|
46
|
-
* @internal - use public `XH.setLogLevel()`.
|
|
47
|
-
*/
|
|
48
|
-
export function setLogLevel(level: LogLevel, persistInSessionStorage: boolean = false) {
|
|
49
|
-
level = level.toLowerCase() as LogLevel;
|
|
50
|
-
|
|
51
|
-
const validLevels = ['error', 'warn', 'info', 'debug'];
|
|
52
|
-
if (!validLevels.includes(level)) {
|
|
53
|
-
console.error(`Ignored invalid log level '${level}' - must be one of ${validLevels}`);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
_logLevel = level;
|
|
57
|
-
if (persistInSessionStorage) {
|
|
58
|
-
store.session.set('xhLogLevel', level);
|
|
59
|
-
}
|
|
60
|
-
if (level != 'info') {
|
|
61
|
-
console.warn(`Client logging set to level '${level}'.`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
14
|
/**
|
|
66
15
|
* Time and log execution of a function to `console.info()`.
|
|
67
16
|
*
|
|
@@ -124,14 +73,19 @@ export function logWarn(msgs: Some<unknown>, source?: LogSource) {
|
|
|
124
73
|
return loggedDo(msgs, null, source, 'warn');
|
|
125
74
|
}
|
|
126
75
|
|
|
76
|
+
/** Parse a LogSource in to a canonical string label. */
|
|
77
|
+
export function parseSource(source: LogSource): string {
|
|
78
|
+
if (!source) return null;
|
|
79
|
+
if (isString(source)) return source;
|
|
80
|
+
if (source['displayName']) return source['displayName'];
|
|
81
|
+
if (source.constructor) return source.constructor.name;
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
127
85
|
//----------------------------------
|
|
128
86
|
// Implementation
|
|
129
87
|
//----------------------------------
|
|
130
|
-
function loggedDo<T>(messages: Some<unknown>, fn: () => T, source: LogSource, level: LogLevel)
|
|
131
|
-
if (_severity[level] < _severity[_logLevel]) {
|
|
132
|
-
return fn?.();
|
|
133
|
-
}
|
|
134
|
-
|
|
88
|
+
function loggedDo<T>(messages: Some<unknown>, fn: () => T, source: LogSource, level: LogLevel) {
|
|
135
89
|
let src = parseSource(source);
|
|
136
90
|
let msgs = castArray(messages);
|
|
137
91
|
|
|
@@ -194,20 +148,4 @@ function writeLog(msgs: unknown[], src: string, level: LogLevel) {
|
|
|
194
148
|
}
|
|
195
149
|
}
|
|
196
150
|
|
|
197
|
-
|
|
198
|
-
function parseSource(source: LogSource): string {
|
|
199
|
-
if (!source) return null;
|
|
200
|
-
if (isString(source)) return source;
|
|
201
|
-
if (source['displayName']) return source['displayName'];
|
|
202
|
-
if (source.constructor) return source.constructor.name;
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
//----------------------------------------------------------------
|
|
207
|
-
// Initialization + Level/Severity support.
|
|
208
|
-
// Initialize during parsing to make available immediately.
|
|
209
|
-
//----------------------------------------------------------------
|
|
210
|
-
let _logLevel: LogLevel = 'info';
|
|
211
|
-
const _severity: Record<LogLevel, number> = {error: 3, warn: 2, info: 1, debug: 0};
|
|
212
|
-
|
|
213
|
-
setLogLevel(store.session.get('xhLogLevel', 'info'));
|
|
151
|
+
type LogLevel = 'error' | 'warn' | 'info' | 'debug';
|
package/utils/js/index.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './LogUtils';
|
package/utils/log/index.ts
DELETED