@xh/hoist 76.0.0-SNAPSHOT.1758206730608 → 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 -79
- 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,66 +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
|
-
try {
|
|
40
|
-
return _logLevel;
|
|
41
|
-
} catch (e) {
|
|
42
|
-
return 'info';
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Set the minimum severity for Hoist log utils until the page is refreshed. Optionally persist
|
|
48
|
-
* this adjustment to sessionStorage to maintain for the lifetime of the browser tab.
|
|
49
|
-
*
|
|
50
|
-
* @internal - use public `XH.setLogLevel()`.
|
|
51
|
-
*/
|
|
52
|
-
export function setLogLevel(level: LogLevel, persistInSessionStorage: boolean = false) {
|
|
53
|
-
level = level.toLowerCase() as LogLevel;
|
|
54
|
-
|
|
55
|
-
const validLevels = ['error', 'warn', 'info', 'debug'];
|
|
56
|
-
if (!validLevels.includes(level)) {
|
|
57
|
-
console.error(`Ignored invalid log level '${level}' - must be one of ${validLevels}`);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
_logLevel = level;
|
|
61
|
-
if (persistInSessionStorage) {
|
|
62
|
-
store.session.set('xhLogLevel', level);
|
|
63
|
-
}
|
|
64
|
-
if (level != 'info') {
|
|
65
|
-
console.warn(`Client logging set to level '${level}'.`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
14
|
/**
|
|
70
15
|
* Time and log execution of a function to `console.info()`.
|
|
71
16
|
*
|
|
@@ -128,16 +73,19 @@ export function logWarn(msgs: Some<unknown>, source?: LogSource) {
|
|
|
128
73
|
return loggedDo(msgs, null, source, 'warn');
|
|
129
74
|
}
|
|
130
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
|
+
|
|
131
85
|
//----------------------------------
|
|
132
86
|
// Implementation
|
|
133
87
|
//----------------------------------
|
|
134
|
-
function loggedDo<T>(messages: Some<unknown>, fn: () => T, source: LogSource, level: LogLevel)
|
|
135
|
-
const _severity: Record<LogLevel, number> = {error: 3, warn: 2, info: 1, debug: 0};
|
|
136
|
-
|
|
137
|
-
if (_severity[level] < _severity[getLogLevel()]) {
|
|
138
|
-
return fn?.();
|
|
139
|
-
}
|
|
140
|
-
|
|
88
|
+
function loggedDo<T>(messages: Some<unknown>, fn: () => T, source: LogSource, level: LogLevel) {
|
|
141
89
|
let src = parseSource(source);
|
|
142
90
|
let msgs = castArray(messages);
|
|
143
91
|
|
|
@@ -200,19 +148,4 @@ function writeLog(msgs: unknown[], src: string, level: LogLevel) {
|
|
|
200
148
|
}
|
|
201
149
|
}
|
|
202
150
|
|
|
203
|
-
|
|
204
|
-
function parseSource(source: LogSource): string {
|
|
205
|
-
if (!source) return null;
|
|
206
|
-
if (isString(source)) return source;
|
|
207
|
-
if (source['displayName']) return source['displayName'];
|
|
208
|
-
if (source.constructor) return source.constructor.name;
|
|
209
|
-
return null;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
//----------------------------------------------------------------
|
|
213
|
-
// Initialization + Level/Severity support.
|
|
214
|
-
// Initialize during parsing to make available immediately.
|
|
215
|
-
//----------------------------------------------------------------
|
|
216
|
-
let _logLevel: LogLevel = 'info';
|
|
217
|
-
|
|
218
|
-
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