@telicent-oss/ds 0.25.1 → 0.26.0
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/dist/ds.js +47 -0
- package/dist/ds.umd.cjs +47 -0
- package/dist/logout-syncer/sw.js +1 -1
- package/dist/src/candidate-packages/utils-lib/src/Logger/Logger.d.ts +58 -0
- package/dist/src/candidate-packages/utils-lib/src/Logger/Logger.test.d.ts +1 -0
- package/dist/src/candidate-packages/utils-lib/src/index.d.ts +1 -0
- package/dist/src/export.d.ts +1 -1
- package/package.json +1 -1
package/dist/ds.js
CHANGED
|
@@ -81451,6 +81451,51 @@ function useViewTransitionState(to, opts) {
|
|
|
81451
81451
|
return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
|
|
81452
81452
|
}
|
|
81453
81453
|
const toStringEncoded = (params, codec) => `${codec.param}=${codec.encode(`${createSearchParams(params)}`)}`;
|
|
81454
|
+
const loggerLevelOrder = {
|
|
81455
|
+
debug: 0,
|
|
81456
|
+
info: 1,
|
|
81457
|
+
warn: 2,
|
|
81458
|
+
error: 3
|
|
81459
|
+
};
|
|
81460
|
+
class Logger {
|
|
81461
|
+
constructor(level) {
|
|
81462
|
+
this.buffer = [];
|
|
81463
|
+
this.currentLevelNum = loggerLevelOrder.info;
|
|
81464
|
+
this.ready = false;
|
|
81465
|
+
this.debug = (...args) => this.record("debug", ...args);
|
|
81466
|
+
this.info = (...args) => this.record("info", ...args);
|
|
81467
|
+
this.warn = (...args) => this.record("warn", ...args);
|
|
81468
|
+
this.error = (...args) => this.record("error", ...args);
|
|
81469
|
+
if (level !== void 0) this.init(level);
|
|
81470
|
+
}
|
|
81471
|
+
init(level) {
|
|
81472
|
+
this.currentLevelNum = typeof level === "number" ? level : loggerLevelOrder[level] ?? this.currentLevelNum;
|
|
81473
|
+
this.ready = true;
|
|
81474
|
+
this.flush();
|
|
81475
|
+
}
|
|
81476
|
+
shouldLog(lvl) {
|
|
81477
|
+
return loggerLevelOrder[lvl] >= this.currentLevelNum;
|
|
81478
|
+
}
|
|
81479
|
+
flush() {
|
|
81480
|
+
for (const {
|
|
81481
|
+
level,
|
|
81482
|
+
args
|
|
81483
|
+
} of this.buffer) {
|
|
81484
|
+
if (this.shouldLog(level)) console[level](...args);
|
|
81485
|
+
}
|
|
81486
|
+
this.buffer = [];
|
|
81487
|
+
}
|
|
81488
|
+
record(lvl, ...args) {
|
|
81489
|
+
if (!this.ready) {
|
|
81490
|
+
this.buffer.push({
|
|
81491
|
+
level: lvl,
|
|
81492
|
+
args
|
|
81493
|
+
});
|
|
81494
|
+
} else if (this.shouldLog(lvl)) {
|
|
81495
|
+
console[lvl](...args);
|
|
81496
|
+
}
|
|
81497
|
+
}
|
|
81498
|
+
}
|
|
81454
81499
|
const GRAPH_APP = {
|
|
81455
81500
|
QUERY_PARAM: {
|
|
81456
81501
|
NODES: `nodes[]`
|
|
@@ -81789,6 +81834,7 @@ export {
|
|
|
81789
81834
|
ListItemButton2 as ListItemButton,
|
|
81790
81835
|
ListItemIcon2 as ListItemIcon,
|
|
81791
81836
|
ListItemText2 as ListItemText,
|
|
81837
|
+
Logger,
|
|
81792
81838
|
MapIcon,
|
|
81793
81839
|
MiniSearchAutocomplete,
|
|
81794
81840
|
MinusCircleIcon,
|
|
@@ -81866,6 +81912,7 @@ export {
|
|
|
81866
81912
|
base64Codec,
|
|
81867
81913
|
checkOntology,
|
|
81868
81914
|
getCodec,
|
|
81915
|
+
loggerLevelOrder,
|
|
81869
81916
|
parseOrThrowWithInput,
|
|
81870
81917
|
renderErrorToHtml,
|
|
81871
81918
|
requestWipe,
|
package/dist/ds.umd.cjs
CHANGED
|
@@ -81469,6 +81469,51 @@ uniform ${i3} ${s4} u_${a3};
|
|
|
81469
81469
|
return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
|
|
81470
81470
|
}
|
|
81471
81471
|
const toStringEncoded = (params, codec) => `${codec.param}=${codec.encode(`${createSearchParams(params)}`)}`;
|
|
81472
|
+
const loggerLevelOrder = {
|
|
81473
|
+
debug: 0,
|
|
81474
|
+
info: 1,
|
|
81475
|
+
warn: 2,
|
|
81476
|
+
error: 3
|
|
81477
|
+
};
|
|
81478
|
+
class Logger {
|
|
81479
|
+
constructor(level) {
|
|
81480
|
+
this.buffer = [];
|
|
81481
|
+
this.currentLevelNum = loggerLevelOrder.info;
|
|
81482
|
+
this.ready = false;
|
|
81483
|
+
this.debug = (...args) => this.record("debug", ...args);
|
|
81484
|
+
this.info = (...args) => this.record("info", ...args);
|
|
81485
|
+
this.warn = (...args) => this.record("warn", ...args);
|
|
81486
|
+
this.error = (...args) => this.record("error", ...args);
|
|
81487
|
+
if (level !== void 0) this.init(level);
|
|
81488
|
+
}
|
|
81489
|
+
init(level) {
|
|
81490
|
+
this.currentLevelNum = typeof level === "number" ? level : loggerLevelOrder[level] ?? this.currentLevelNum;
|
|
81491
|
+
this.ready = true;
|
|
81492
|
+
this.flush();
|
|
81493
|
+
}
|
|
81494
|
+
shouldLog(lvl) {
|
|
81495
|
+
return loggerLevelOrder[lvl] >= this.currentLevelNum;
|
|
81496
|
+
}
|
|
81497
|
+
flush() {
|
|
81498
|
+
for (const {
|
|
81499
|
+
level,
|
|
81500
|
+
args
|
|
81501
|
+
} of this.buffer) {
|
|
81502
|
+
if (this.shouldLog(level)) console[level](...args);
|
|
81503
|
+
}
|
|
81504
|
+
this.buffer = [];
|
|
81505
|
+
}
|
|
81506
|
+
record(lvl, ...args) {
|
|
81507
|
+
if (!this.ready) {
|
|
81508
|
+
this.buffer.push({
|
|
81509
|
+
level: lvl,
|
|
81510
|
+
args
|
|
81511
|
+
});
|
|
81512
|
+
} else if (this.shouldLog(lvl)) {
|
|
81513
|
+
console[lvl](...args);
|
|
81514
|
+
}
|
|
81515
|
+
}
|
|
81516
|
+
}
|
|
81472
81517
|
const GRAPH_APP = {
|
|
81473
81518
|
QUERY_PARAM: {
|
|
81474
81519
|
NODES: `nodes[]`
|
|
@@ -81811,6 +81856,7 @@ uniform ${i3} ${s4} u_${a3};
|
|
|
81811
81856
|
exports2.ListItemButton = ListItemButton;
|
|
81812
81857
|
exports2.ListItemIcon = ListItemIcon;
|
|
81813
81858
|
exports2.ListItemText = ListItemText;
|
|
81859
|
+
exports2.Logger = Logger;
|
|
81814
81860
|
exports2.MapIcon = MapIcon;
|
|
81815
81861
|
exports2.MiniSearchAutocomplete = MiniSearchAutocomplete;
|
|
81816
81862
|
exports2.MinusCircleIcon = MinusCircleIcon;
|
|
@@ -81888,6 +81934,7 @@ uniform ${i3} ${s4} u_${a3};
|
|
|
81888
81934
|
exports2.base64Codec = base64Codec;
|
|
81889
81935
|
exports2.checkOntology = checkOntology;
|
|
81890
81936
|
exports2.getCodec = getCodec;
|
|
81937
|
+
exports2.loggerLevelOrder = loggerLevelOrder;
|
|
81891
81938
|
exports2.parseOrThrowWithInput = parseOrThrowWithInput;
|
|
81892
81939
|
exports2.renderErrorToHtml = renderErrorToHtml;
|
|
81893
81940
|
exports2.requestWipe = requestWipe;
|
package/dist/logout-syncer/sw.js
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type LoggerLevelString = "debug" | "info" | "warn" | "error";
|
|
2
|
+
export type LoggerLevel = LoggerLevelString | number;
|
|
3
|
+
export declare const loggerLevelOrder: Record<LoggerLevelString, number>;
|
|
4
|
+
/**
|
|
5
|
+
* BufferedLogger
|
|
6
|
+
*
|
|
7
|
+
* Buffers log calls until a level is set, then flushes buffered messages
|
|
8
|
+
* at or above that level and logs subsequent calls immediately.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { BufferedLogger } from './buffered-logger';
|
|
13
|
+
*
|
|
14
|
+
* const logger = new BufferedLogger();
|
|
15
|
+
*
|
|
16
|
+
* // These calls are buffered
|
|
17
|
+
* logger.debug('debug before init');
|
|
18
|
+
* logger.info('info before init');
|
|
19
|
+
*
|
|
20
|
+
* // Initialize log level and flush buffer
|
|
21
|
+
* logger.setLevel('info');
|
|
22
|
+
*
|
|
23
|
+
* // Only "info" and above were flushed; debug was dropped
|
|
24
|
+
*
|
|
25
|
+
* // Subsequent calls log immediately
|
|
26
|
+
* logger.debug('this won’t show');
|
|
27
|
+
* logger.warn('this will show as warning');
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @method setLevel
|
|
31
|
+
* @param {'debug'|'info'|'warn'|'error'} level — minimum level to log
|
|
32
|
+
*
|
|
33
|
+
* @method debug
|
|
34
|
+
* @param {...any} args — arguments forwarded to console.debug
|
|
35
|
+
*
|
|
36
|
+
* @method info
|
|
37
|
+
* @param {...any} args — arguments forwarded to console.info
|
|
38
|
+
*
|
|
39
|
+
* @method warn
|
|
40
|
+
* @param {...any} args — arguments forwarded to console.warn
|
|
41
|
+
*
|
|
42
|
+
* @method error
|
|
43
|
+
* @param {...any} args — arguments forwarded to console.error
|
|
44
|
+
*/
|
|
45
|
+
export declare class Logger {
|
|
46
|
+
private buffer;
|
|
47
|
+
private currentLevelNum;
|
|
48
|
+
private ready;
|
|
49
|
+
constructor(level?: LoggerLevel);
|
|
50
|
+
init(level: LoggerLevel): void;
|
|
51
|
+
private shouldLog;
|
|
52
|
+
private flush;
|
|
53
|
+
private record;
|
|
54
|
+
debug: (...args: unknown[]) => void;
|
|
55
|
+
info: (...args: unknown[]) => void;
|
|
56
|
+
warn: (...args: unknown[]) => void;
|
|
57
|
+
error: (...args: unknown[]) => void;
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { getCodec, type Codec, base64Codec, uriComponentCodec, } from './getCodec/getCodec';
|
|
2
2
|
export { ENCODE_SEARCH_PARAMS_MODES_Schema, type ENCODE_SEARCH_PARAMS_MODES_Type, } from './getCodec/schemaAndTypes';
|
|
3
3
|
export { toStringEncoded, type URLSearchParamsInit, } from './getCodec/toStringEncoded';
|
|
4
|
+
export { type LoggerLevelString, type LoggerLevel, loggerLevelOrder, Logger } from './Logger/Logger';
|
|
4
5
|
export { GRAPH_APP } from './GraphApp/constants';
|
package/dist/src/export.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export * from './v1/components/surfaces';
|
|
|
13
13
|
export * from './v1/theme';
|
|
14
14
|
export * from './v1/components/utils/index';
|
|
15
15
|
export * from './component-library/Map';
|
|
16
|
-
export { getCodec, type Codec, base64Codec, uriComponentCodec, ENCODE_SEARCH_PARAMS_MODES_Schema, type ENCODE_SEARCH_PARAMS_MODES_Type, toStringEncoded, type URLSearchParamsInit, GRAPH_APP, } from './candidate-packages/utils-lib/src/index';
|
|
16
|
+
export { getCodec, type Codec, base64Codec, uriComponentCodec, ENCODE_SEARCH_PARAMS_MODES_Schema, type ENCODE_SEARCH_PARAMS_MODES_Type, toStringEncoded, type URLSearchParamsInit, GRAPH_APP, type LoggerLevelString, type LoggerLevel, loggerLevelOrder, Logger } from './candidate-packages/utils-lib/src/index';
|
|
17
17
|
export { setupWipe, WipeConfigSchema, type WipeConfig, } from './candidate-packages/logout-syncer/setupWipe';
|
|
18
18
|
export { requestWipe } from './candidate-packages/logout-syncer/requestWipe';
|
|
19
19
|
export { renderErrorToHtml } from './candidate-packages/renderErrorToHtml/renderErrorToHtml';
|