@xh/hoist 75.0.0-SNAPSHOT.1753485410401 → 75.0.0-SNAPSHOT.1753487024547
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 +24 -8
- package/build/types/core/load/LoadSpec.d.ts +0 -2
- package/build/types/desktop/cmp/filechooser/FileChooserModel.d.ts +0 -2
- package/build/types/svc/FetchService.d.ts +0 -12
- package/build/types/svc/IdentityService.d.ts +0 -5
- package/build/types/utils/js/LangUtils.d.ts +3 -0
- package/build/types/utils/js/LogUtils.d.ts +2 -0
- package/cmp/relativetimestamp/RelativeTimestamp.ts +2 -1
- package/core/load/LoadSpec.ts +0 -7
- package/desktop/cmp/filechooser/FileChooserModel.ts +0 -7
- package/desktop/cmp/grouping/GroupingChooser.ts +3 -1
- package/package.json +1 -1
- package/svc/FetchService.ts +1 -27
- package/svc/IdentityService.ts +1 -10
- package/tsconfig.tsbuildinfo +1 -1
- package/utils/js/LangUtils.ts +8 -3
- package/utils/js/LogUtils.ts +9 -8
package/utils/js/LangUtils.ts
CHANGED
|
@@ -6,6 +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 {LogSource, logWarn} from '@xh/hoist/utils/js/LogUtils';
|
|
9
10
|
import {
|
|
10
11
|
flatMap,
|
|
11
12
|
forOwn,
|
|
@@ -168,6 +169,9 @@ export interface APIWarnOptions {
|
|
|
168
169
|
|
|
169
170
|
/** An additional message. Can contain suggestions for alternatives. */
|
|
170
171
|
msg?: string;
|
|
172
|
+
|
|
173
|
+
/** Source of message for labelling log message. */
|
|
174
|
+
source?: LogSource;
|
|
171
175
|
}
|
|
172
176
|
|
|
173
177
|
/**
|
|
@@ -176,8 +180,9 @@ export interface APIWarnOptions {
|
|
|
176
180
|
export function apiRemoved(name: string, opts: APIWarnOptions = {}) {
|
|
177
181
|
if ('test' in opts && isUndefined(opts.test)) return;
|
|
178
182
|
|
|
179
|
-
const
|
|
180
|
-
|
|
183
|
+
const src = opts.source ? `[${opts.source}] ` : '',
|
|
184
|
+
msg = opts.msg ? ` ${opts.msg}.` : '';
|
|
185
|
+
throw Exception.create(`${src}The use of '${name}' is no longer supported.${msg}`);
|
|
181
186
|
}
|
|
182
187
|
|
|
183
188
|
/**
|
|
@@ -193,7 +198,7 @@ export function apiDeprecated(name: string, opts: APIWarnOptions = {}) {
|
|
|
193
198
|
msg = opts.msg ? ` ${opts.msg}.` : '',
|
|
194
199
|
warn = `The use of '${name}' has been deprecated and will be removed in ${v}. ${msg}`;
|
|
195
200
|
if (!_seenWarnings[warn]) {
|
|
196
|
-
|
|
201
|
+
logWarn(warn, opts.source);
|
|
197
202
|
_seenWarnings[warn] = true;
|
|
198
203
|
}
|
|
199
204
|
}
|
package/utils/js/LogUtils.ts
CHANGED
|
@@ -72,6 +72,15 @@ export function logWarn(msgs: Some<unknown>, source?: LogSource) {
|
|
|
72
72
|
return loggedDo(msgs, null, source, 'warn');
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/** Parse a LogSource in to a canonical string label. */
|
|
76
|
+
export function parseSource(source: LogSource): string {
|
|
77
|
+
if (!source) return null;
|
|
78
|
+
if (isString(source)) return source;
|
|
79
|
+
if (source['displayName']) return source['displayName'];
|
|
80
|
+
if (source.constructor) return source.constructor.name;
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
75
84
|
//----------------------------------
|
|
76
85
|
// Implementation
|
|
77
86
|
//----------------------------------
|
|
@@ -117,14 +126,6 @@ function loggedDo<T>(messages: Some<unknown>, fn: () => T, source: LogSource, le
|
|
|
117
126
|
return ret;
|
|
118
127
|
}
|
|
119
128
|
|
|
120
|
-
function parseSource(source: LogSource): string {
|
|
121
|
-
if (!source) return null;
|
|
122
|
-
if (isString(source)) return source;
|
|
123
|
-
if (source['displayName']) return source['displayName'];
|
|
124
|
-
if (source.constructor) return source.constructor.name;
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
129
|
function writeLog(msgs: unknown[], src: string, level: LogLevel) {
|
|
129
130
|
if (src) msgs = [`[${src}]`, ...msgs];
|
|
130
131
|
|