@naturalcycles/js-lib 15.71.3 → 15.72.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/bot.model.js CHANGED
@@ -1,5 +1,4 @@
1
- export { BotReason };
2
- var BotReason;
1
+ export var BotReason;
3
2
  (function (BotReason) {
4
3
  BotReason[BotReason["NoNavigator"] = 1] = "NoNavigator";
5
4
  BotReason[BotReason["NoUserAgent"] = 2] = "NoUserAgent";
@@ -35,7 +35,7 @@ export class TranslationService {
35
35
  */
36
36
  async loadLocale(locale) {
37
37
  const locales = Array.isArray(locale) ? locale : [locale];
38
- await pMap(locales, async locale => {
38
+ await pMap(locales, async (locale) => {
39
39
  if (this.locales[locale])
40
40
  return; // already loaded
41
41
  this.locales[locale] = await this.cfg.translationLoader.load(locale);
@@ -16,8 +16,8 @@ export interface TopBarOptions {
16
16
  }
17
17
  export declare const topbar: {
18
18
  config(opts: TopBarOptions): void;
19
- set(show: boolean, opts?: TopBarOptions | undefined): void;
20
- show(opts?: TopBarOptions | undefined): void;
21
- progress(to: string | number): any;
19
+ set(show: boolean, opts?: TopBarOptions): void;
20
+ show(opts?: TopBarOptions): void;
21
+ progress(to: number | string): any;
22
22
  hide(): void;
23
23
  };
@@ -2,8 +2,7 @@ import { _assert } from '../error/assert.js';
2
2
  import { localDate } from './localDate.js';
3
3
  import { _ms } from './time.util.js';
4
4
  import { WallTime } from './wallTime.js';
5
- export { ISODayOfWeek };
6
- var ISODayOfWeek;
5
+ export var ISODayOfWeek;
7
6
  (function (ISODayOfWeek) {
8
7
  ISODayOfWeek[ISODayOfWeek["MONDAY"] = 1] = "MONDAY";
9
8
  ISODayOfWeek[ISODayOfWeek["TUESDAY"] = 2] = "TUESDAY";
@@ -763,6 +762,7 @@ class LocalTimeFactory {
763
762
  * Allows to input IsoDate, will set h:m:s to zeros.
764
763
  */
765
764
  parse(s) {
765
+ // oxlint-disable-next-line typescript/no-unnecessary-type-conversion
766
766
  const d = this.parseLooselyOrUndefined(String(s));
767
767
  _assert(d, `Cannot parse "${s}" into LocalTime`);
768
768
  return new LocalTime(d);
@@ -45,7 +45,7 @@ export const _AsyncMemo = (opt) => (target, key, descriptor) => {
45
45
  // console.log('return promise', promiseCache.size)
46
46
  return promise;
47
47
  }
48
- promise = cache.get(cacheKey).then(async value => {
48
+ promise = cache.get(cacheKey).then(async (value) => {
49
49
  if (value !== MISS) {
50
50
  // console.log('hit', promiseCache.size)
51
51
  promiseCache.delete(cacheKey);
@@ -54,7 +54,7 @@ export const _AsyncMemo = (opt) => (target, key, descriptor) => {
54
54
  // Miss
55
55
  // console.log('miss', promiseCache.size)
56
56
  return await onMiss();
57
- }, async err => {
57
+ }, async (err) => {
58
58
  // Log the cache error and proceed "as cache Miss"
59
59
  logger.error(err);
60
60
  return await onMiss();
@@ -16,7 +16,8 @@ import type { BackendErrorResponseObject, ErrorData, ErrorObject } from './error
16
16
  *
17
17
  * Since 2024-07-10 it no longer sets `userFriendly: true` by default.
18
18
  */
19
- export declare function _assert(condition: any, message?: string, errorData?: ErrorData): asserts condition;
19
+ export declare function _assert(condition: any, // will be evaluated as Boolean
20
+ message?: string, errorData?: ErrorData): asserts condition;
20
21
  /**
21
22
  * Like _assert(), but prints more helpful error message.
22
23
  * API is similar to Node's assert.equals().
@@ -1,10 +1,9 @@
1
- export { ErrorMode };
2
1
  /**
3
2
  * Allows to define error-controlling behaviour for batch operations.
4
3
  *
5
4
  * @default is THROW_IMMEDIATELY in most cases
6
5
  */
7
- var ErrorMode;
6
+ export var ErrorMode;
8
7
  (function (ErrorMode) {
9
8
  /**
10
9
  * Usually a default behaviour, similar as "exit early".
@@ -77,7 +77,7 @@ export async function pMap(iterable, mapper, opt = {}) {
77
77
  }
78
78
  resolvingCount++;
79
79
  Promise.resolve(nextItem)
80
- .then(async element => await mapper(element, i))
80
+ .then(async (element) => await mapper(element, i))
81
81
  .then(value => {
82
82
  if (value === END) {
83
83
  isSettled = true;
package/dist/web.js CHANGED
@@ -24,6 +24,7 @@ export class InMemoryWebStorage {
24
24
  return this.data[key] ?? null;
25
25
  }
26
26
  setItem(key, value) {
27
+ // oxlint-disable-next-line typescript/no-unnecessary-type-conversion
27
28
  this.data[key] = String(value);
28
29
  }
29
30
  removeItem(key) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
3
  "type": "module",
4
- "version": "15.71.3",
4
+ "version": "15.72.0",
5
5
  "dependencies": {
6
6
  "tslib": "^2"
7
7
  },
@@ -17,10 +17,10 @@
17
17
  "@types/crypto-js": "^4",
18
18
  "@types/node": "^25",
19
19
  "@types/semver": "^7",
20
- "@typescript/native-preview": "7.0.0-dev.20260301.1",
20
+ "@typescript/native-preview": "7.0.0-dev.20260401.1",
21
21
  "crypto-js": "^4",
22
22
  "dayjs": "^1",
23
- "@naturalcycles/dev-lib": "18.4.2"
23
+ "@naturalcycles/dev-lib": "20.42.0"
24
24
  },
25
25
  "exports": {
26
26
  ".": "./dist/index.js",
@@ -899,6 +899,7 @@ class LocalTimeFactory {
899
899
  * Allows to input IsoDate, will set h:m:s to zeros.
900
900
  */
901
901
  parse(s: string): LocalTime {
902
+ // oxlint-disable-next-line typescript/no-unnecessary-type-conversion
902
903
  const d = this.parseLooselyOrUndefined(String(s))
903
904
  _assert(d, `Cannot parse "${s}" into LocalTime`)
904
905
  return new LocalTime(d)
package/src/web.ts CHANGED
@@ -27,6 +27,7 @@ export class InMemoryWebStorage implements Storage {
27
27
  }
28
28
 
29
29
  setItem(key: string, value: string): void {
30
+ // oxlint-disable-next-line typescript/no-unnecessary-type-conversion
30
31
  this.data[key] = String(value)
31
32
  }
32
33