@naturalcycles/js-lib 15.40.0 → 15.40.2
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/browser/bot.js +0 -2
- package/dist/env.js +1 -1
- package/dist/error/error.util.d.ts +1 -1
- package/dist/error/error.util.js +4 -8
- package/dist/http/fetcher.d.ts +1 -1
- package/dist/iter/iterable2.js +1 -1
- package/dist/number/number.util.js +1 -1
- package/dist/string/hash.util.js +1 -1
- package/dist/string/leven.js +1 -2
- package/dist/string/lodash/words.js +1 -2
- package/dist/string/slugify.js +1 -0
- package/package.json +1 -1
- package/src/browser/bot.ts +0 -2
- package/src/env.ts +1 -1
- package/src/error/error.util.ts +9 -10
- package/src/http/fetcher.ts +1 -1
- package/src/iter/iterable2.ts +1 -1
- package/src/json-schema/jsonSchemaBuilder.ts +1 -1
- package/src/number/number.util.ts +1 -1
- package/src/string/hash.util.ts +1 -1
- package/src/string/leven.ts +1 -2
- package/src/string/lodash/words.ts +2 -3
- package/src/string/slugify.ts +1 -0
package/dist/browser/bot.js
CHANGED
|
@@ -99,12 +99,10 @@ export class BotDetectionService {
|
|
|
99
99
|
let cdpCheck1 = false;
|
|
100
100
|
try {
|
|
101
101
|
/* eslint-disable */
|
|
102
|
-
// biome-ignore lint/suspicious/useErrorMessage: ok
|
|
103
102
|
const e = new window.Error();
|
|
104
103
|
window.Object.defineProperty(e, 'stack', {
|
|
105
104
|
configurable: false,
|
|
106
105
|
enumerable: false,
|
|
107
|
-
// biome-ignore lint/complexity/useArrowFunction: ok
|
|
108
106
|
get: function () {
|
|
109
107
|
cdpCheck1 = true;
|
|
110
108
|
return '';
|
package/dist/env.js
CHANGED
|
@@ -14,6 +14,6 @@ export function isServerSide() {
|
|
|
14
14
|
* Will return `false` in Node.js.
|
|
15
15
|
*/
|
|
16
16
|
export function isClientSide() {
|
|
17
|
-
//
|
|
17
|
+
// oxlint-disable-next-line unicorn/prefer-global-this
|
|
18
18
|
return typeof window !== 'undefined' && !!window?.document;
|
|
19
19
|
}
|
|
@@ -55,7 +55,7 @@ export declare function _isErrorLike(o: any): o is ErrorLike;
|
|
|
55
55
|
* })
|
|
56
56
|
* }
|
|
57
57
|
*/
|
|
58
|
-
export declare function _errorDataAppend<ERR>(err: ERR, data?: ErrorData):
|
|
58
|
+
export declare function _errorDataAppend<ERR, OUT extends Error = ERR extends Error ? ERR : Error>(err: ERR, data?: ErrorData): OUT;
|
|
59
59
|
export interface AppErrorComponents<DATA_TYPE extends ErrorData = ErrorData> {
|
|
60
60
|
message: string;
|
|
61
61
|
name?: string;
|
package/dist/error/error.util.js
CHANGED
|
@@ -22,10 +22,9 @@ export function _anyToError(o, errorClass = Error, errorData) {
|
|
|
22
22
|
}
|
|
23
23
|
if (errorData) {
|
|
24
24
|
;
|
|
25
|
-
e.data
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
25
|
+
e.data ||= {};
|
|
26
|
+
// Using Object.assign instead of ...data to not override err.data's non-enumerable properties
|
|
27
|
+
Object.assign(e.data, errorData);
|
|
29
28
|
}
|
|
30
29
|
return e;
|
|
31
30
|
}
|
|
@@ -209,10 +208,7 @@ export function _isErrorLike(o) {
|
|
|
209
208
|
export function _errorDataAppend(err, data) {
|
|
210
209
|
if (!data)
|
|
211
210
|
return err;
|
|
212
|
-
err
|
|
213
|
-
// Using Object.assign instead of ...data to not override err.data's non-enumerable properties
|
|
214
|
-
Object.assign(err.data, data);
|
|
215
|
-
return err;
|
|
211
|
+
return _anyToError(err, undefined, data);
|
|
216
212
|
}
|
|
217
213
|
/**
|
|
218
214
|
* Base class for all our (not system) errors.
|
package/dist/http/fetcher.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare class Fetcher {
|
|
|
16
16
|
*
|
|
17
17
|
* Version is to be incremented every time a difference in behaviour (or a bugfix) is done.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
static readonly VERSION = 3;
|
|
20
20
|
/**
|
|
21
21
|
* userAgent is statically exposed as Fetcher.userAgent.
|
|
22
22
|
* It can be modified globally, and will be used (read) at the start of every request.
|
package/dist/iter/iterable2.js
CHANGED
|
@@ -40,7 +40,7 @@ export function _isBetween(x, min, max, incl) {
|
|
|
40
40
|
return true;
|
|
41
41
|
}
|
|
42
42
|
export function _clamp(x, minIncl, maxIncl) {
|
|
43
|
-
//
|
|
43
|
+
// oxlint-disable-next-line unicorn/prefer-math-min-max
|
|
44
44
|
return x <= minIncl ? minIncl : x >= maxIncl ? maxIncl : x;
|
|
45
45
|
}
|
|
46
46
|
/**
|
package/dist/string/hash.util.js
CHANGED
|
@@ -49,7 +49,7 @@ export function hashCode(s) {
|
|
|
49
49
|
let i = 0;
|
|
50
50
|
const len = s.length;
|
|
51
51
|
while (i < len) {
|
|
52
|
-
//
|
|
52
|
+
// oxlint-disable-next-line unicorn/prefer-math-trunc, unicorn/prefer-code-point
|
|
53
53
|
hash = ((hash << 5) - hash + s.charCodeAt(i++)) << 0;
|
|
54
54
|
}
|
|
55
55
|
return hash + 2147483647 + 1;
|
package/dist/string/leven.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// from: https://github.com/lodash/lodash/blob/master/words.js
|
|
2
|
-
/* eslint-disable */
|
|
3
2
|
import { unicodeWords } from './unicodeWords.js';
|
|
3
|
+
// oxlint-disable
|
|
4
4
|
const hasUnicodeWord = RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);
|
|
5
5
|
/** Used to match words composed of alphanumeric characters. */
|
|
6
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: ok
|
|
7
6
|
const reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
8
7
|
function asciiWords(s) {
|
|
9
8
|
return s.match(reAsciiWord);
|
package/dist/string/slugify.js
CHANGED
|
@@ -61,5 +61,6 @@ function decamelize(s) {
|
|
|
61
61
|
function escapeStringRegexp(s) {
|
|
62
62
|
// Escape characters with special meaning either inside or outside character sets.
|
|
63
63
|
// Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
|
64
|
+
// oxlint-disable-next-line unicorn/escape-case, unicorn/no-hex-escape
|
|
64
65
|
return s.replaceAll(/[|\\{}()[\]^$+*?.]/g, String.raw `\$&`).replaceAll('-', String.raw `\x2d`);
|
|
65
66
|
}
|
package/package.json
CHANGED
package/src/browser/bot.ts
CHANGED
|
@@ -132,12 +132,10 @@ export class BotDetectionService {
|
|
|
132
132
|
let cdpCheck1 = false
|
|
133
133
|
try {
|
|
134
134
|
/* eslint-disable */
|
|
135
|
-
// biome-ignore lint/suspicious/useErrorMessage: ok
|
|
136
135
|
const e = new window.Error()
|
|
137
136
|
window.Object.defineProperty(e, 'stack', {
|
|
138
137
|
configurable: false,
|
|
139
138
|
enumerable: false,
|
|
140
|
-
// biome-ignore lint/complexity/useArrowFunction: ok
|
|
141
139
|
get: function () {
|
|
142
140
|
cdpCheck1 = true
|
|
143
141
|
return ''
|
package/src/env.ts
CHANGED
|
@@ -15,6 +15,6 @@ export function isServerSide(): boolean {
|
|
|
15
15
|
* Will return `false` in Node.js.
|
|
16
16
|
*/
|
|
17
17
|
export function isClientSide(): boolean {
|
|
18
|
-
//
|
|
18
|
+
// oxlint-disable-next-line unicorn/prefer-global-this
|
|
19
19
|
return typeof window !== 'undefined' && !!window?.document
|
|
20
20
|
}
|
package/src/error/error.util.ts
CHANGED
|
@@ -36,10 +36,9 @@ export function _anyToError<ERROR_TYPE extends Error = Error>(
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
if (errorData) {
|
|
39
|
-
;(e as any).data
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
39
|
+
;(e as any).data ||= {}
|
|
40
|
+
// Using Object.assign instead of ...data to not override err.data's non-enumerable properties
|
|
41
|
+
Object.assign((e as any).data, errorData)
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
return e
|
|
@@ -266,12 +265,12 @@ export function _isErrorLike(o: any): o is ErrorLike {
|
|
|
266
265
|
* })
|
|
267
266
|
* }
|
|
268
267
|
*/
|
|
269
|
-
export function _errorDataAppend<ERR
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return err
|
|
268
|
+
export function _errorDataAppend<ERR, OUT extends Error = ERR extends Error ? ERR : Error>(
|
|
269
|
+
err: ERR,
|
|
270
|
+
data?: ErrorData,
|
|
271
|
+
): OUT {
|
|
272
|
+
if (!data) return err as any
|
|
273
|
+
return _anyToError<OUT>(err, undefined, data)
|
|
275
274
|
}
|
|
276
275
|
|
|
277
276
|
export interface AppErrorComponents<DATA_TYPE extends ErrorData = ErrorData> {
|
package/src/http/fetcher.ts
CHANGED
|
@@ -67,7 +67,7 @@ export class Fetcher {
|
|
|
67
67
|
*
|
|
68
68
|
* Version is to be incremented every time a difference in behaviour (or a bugfix) is done.
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
static readonly VERSION = 3
|
|
71
71
|
/**
|
|
72
72
|
* userAgent is statically exposed as Fetcher.userAgent.
|
|
73
73
|
* It can be modified globally, and will be used (read) at the start of every request.
|
package/src/iter/iterable2.ts
CHANGED
|
@@ -33,7 +33,7 @@ import type {
|
|
|
33
33
|
} from './jsonSchema.model.js'
|
|
34
34
|
import { mergeJsonSchemaObjects } from './jsonSchema.util.js'
|
|
35
35
|
|
|
36
|
-
/* eslint-disable id-
|
|
36
|
+
/* eslint-disable id-denylist, @typescript-eslint/explicit-module-boundary-types */
|
|
37
37
|
|
|
38
38
|
export interface JsonSchemaBuilder<T = unknown> {
|
|
39
39
|
build: () => JsonSchema<T>
|
|
@@ -51,7 +51,7 @@ export function _isBetween<T extends number | string>(
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export function _clamp(x: number, minIncl: number, maxIncl: number): number {
|
|
54
|
-
//
|
|
54
|
+
// oxlint-disable-next-line unicorn/prefer-math-min-max
|
|
55
55
|
return x <= minIncl ? minIncl : x >= maxIncl ? maxIncl : x
|
|
56
56
|
}
|
|
57
57
|
|
package/src/string/hash.util.ts
CHANGED
|
@@ -56,7 +56,7 @@ export function hashCode(s: string): Integer {
|
|
|
56
56
|
let i = 0
|
|
57
57
|
const len = s.length
|
|
58
58
|
while (i < len) {
|
|
59
|
-
//
|
|
59
|
+
// oxlint-disable-next-line unicorn/prefer-math-trunc, unicorn/prefer-code-point
|
|
60
60
|
hash = ((hash << 5) - hash + s.charCodeAt(i++)) << 0
|
|
61
61
|
}
|
|
62
62
|
return hash + 2147483647 + 1
|
package/src/string/leven.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const array: number[] = []
|
|
2
2
|
const characterCodeCache: number[] = []
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
// oxlint-disable no-bitwise
|
|
4
|
+
// oxlint-disable no-bitwise, unicorn/prefer-code-point
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Modified version of: https://github.com/sindresorhus/leven/
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// from: https://github.com/lodash/lodash/blob/master/words.js
|
|
2
2
|
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
|
|
5
3
|
import { unicodeWords } from './unicodeWords.js'
|
|
6
4
|
|
|
5
|
+
// oxlint-disable
|
|
6
|
+
|
|
7
7
|
const hasUnicodeWord = RegExp.prototype.test.bind(
|
|
8
8
|
/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
/** Used to match words composed of alphanumeric characters. */
|
|
12
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: ok
|
|
13
12
|
const reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g
|
|
14
13
|
|
|
15
14
|
function asciiWords(s: string): RegExpMatchArray | null {
|
package/src/string/slugify.ts
CHANGED
|
@@ -102,5 +102,6 @@ function decamelize(s: string): string {
|
|
|
102
102
|
function escapeStringRegexp(s: string): string {
|
|
103
103
|
// Escape characters with special meaning either inside or outside character sets.
|
|
104
104
|
// Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
|
105
|
+
// oxlint-disable-next-line unicorn/escape-case, unicorn/no-hex-escape
|
|
105
106
|
return s.replaceAll(/[|\\{}()[\]^$+*?.]/g, String.raw`\$&`).replaceAll('-', String.raw`\x2d`)
|
|
106
107
|
}
|