@naturalcycles/js-lib 15.54.0 → 15.55.1
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/topbar.js +1 -1
- package/dist/decorators/asyncMemo.decorator.js +1 -1
- package/dist/decorators/swarmSafe.decorator.js +1 -1
- package/dist/http/fetcher.js +2 -1
- package/dist/promise/pDefer.js +1 -1
- package/dist/promise/pDelay.js +1 -1
- package/dist/string/lodash/unicodeWords.js +1 -1
- package/dist/typeFest.d.ts +3 -14
- package/dist/types.d.ts +15 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/src/browser/topbar.ts +1 -1
- package/src/decorators/asyncMemo.decorator.ts +1 -1
- package/src/decorators/swarmSafe.decorator.ts +1 -1
- package/src/http/fetcher.ts +2 -1
- package/src/promise/pDefer.ts +1 -1
- package/src/promise/pDelay.ts +1 -1
- package/src/string/lodash/unicodeWords.ts +1 -1
- package/src/typeFest.ts +4 -15
- package/src/types.ts +19 -2
package/dist/browser/topbar.js
CHANGED
|
@@ -24,7 +24,7 @@ export const _AsyncMemo = (opt) => (target, key, descriptor) => {
|
|
|
24
24
|
const { logger = console, cacheFactory, cacheKeyFn = jsonMemoSerializer } = opt;
|
|
25
25
|
const keyStr = String(key);
|
|
26
26
|
const methodSignature = _getTargetMethodSignature(target, keyStr);
|
|
27
|
-
//
|
|
27
|
+
// oxlint-disable-next-line @typescript-eslint/promise-function-async
|
|
28
28
|
descriptor.value = function (...args) {
|
|
29
29
|
const ctx = this;
|
|
30
30
|
const cacheKey = cacheKeyFn(args);
|
|
@@ -17,7 +17,7 @@ export const _SwarmSafe = () => (target, key, descriptor) => {
|
|
|
17
17
|
const methodSignature = _getTargetMethodSignature(target, keyStr);
|
|
18
18
|
const instanceCache = new Map();
|
|
19
19
|
console.log('SwarmSafe constructor called', { key, methodSignature });
|
|
20
|
-
//
|
|
20
|
+
// oxlint-disable-next-line @typescript-eslint/promise-function-async
|
|
21
21
|
descriptor.value = function (...args) {
|
|
22
22
|
console.log('SwarmSafe method called', { key, methodSignature, args });
|
|
23
23
|
const ctx = this;
|
package/dist/http/fetcher.js
CHANGED
|
@@ -9,6 +9,7 @@ import { _clamp } from '../number/number.util.js';
|
|
|
9
9
|
import { _filterFalsyValues, _filterNullishValues, _filterUndefinedValues, _mapKeys, _merge, _omit, _pick, } from '../object/object.util.js';
|
|
10
10
|
import { pDelay } from '../promise/pDelay.js';
|
|
11
11
|
import { pTimeout } from '../promise/pTimeout.js';
|
|
12
|
+
import { _toUrlOrNull } from '../string/index.js';
|
|
12
13
|
import { _jsonParse, _jsonParseIfPossible } from '../string/json.util.js';
|
|
13
14
|
import { _stringify } from '../string/stringify.js';
|
|
14
15
|
import { HTTP_METHODS } from './http.model.js';
|
|
@@ -630,7 +631,7 @@ export class Fetcher {
|
|
|
630
631
|
let { name } = cfg;
|
|
631
632
|
if (!name && cfg.baseUrl) {
|
|
632
633
|
// derive FetcherName from baseUrl
|
|
633
|
-
const url =
|
|
634
|
+
const url = _toUrlOrNull(cfg.baseUrl);
|
|
634
635
|
if (url) {
|
|
635
636
|
name = url.hostname;
|
|
636
637
|
}
|
package/dist/promise/pDefer.js
CHANGED
package/dist/promise/pDelay.js
CHANGED
|
@@ -8,7 +8,7 @@ import { pDefer } from './pDefer.js';
|
|
|
8
8
|
export async function pDelay(ms = 0, value) {
|
|
9
9
|
return await new Promise((resolve, reject) => setTimeout(value instanceof Error ? reject : resolve, ms, value));
|
|
10
10
|
}
|
|
11
|
-
/*
|
|
11
|
+
/* oxlint-disable @typescript-eslint/promise-function-async */
|
|
12
12
|
/**
|
|
13
13
|
* Promisified version of setTimeout.
|
|
14
14
|
*
|
package/dist/typeFest.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Old inclusion of 3rd party `type-fest` lib inlined here.
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
Flatten the type output to improve type hints shown in editors.
|
|
3
6
|
*/
|
|
@@ -167,20 +170,6 @@ export type ConditionalExcept<Base, Condition> = Except<Base, ConditionalKeys<Ba
|
|
|
167
170
|
```
|
|
168
171
|
*/
|
|
169
172
|
export type ConditionalPick<Base, Condition> = Pick<Base, ConditionalKeys<Base, Condition>>;
|
|
170
|
-
/**
|
|
171
|
-
Makes one property of T required instead of optional.
|
|
172
|
-
@example
|
|
173
|
-
```
|
|
174
|
-
import {RequireProp} from 'type-fest';
|
|
175
|
-
interface Example {
|
|
176
|
-
a?: string
|
|
177
|
-
b?: string
|
|
178
|
-
};
|
|
179
|
-
type ExampleA = RequireProp<Example, 'a'>;
|
|
180
|
-
//=> {a: string; b?: string};
|
|
181
|
-
```
|
|
182
|
-
*/
|
|
183
|
-
export type RequireProp<T, K extends keyof T> = Required<Pick<T, K>> & T;
|
|
184
173
|
/**
|
|
185
174
|
Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
|
186
175
|
*/
|
package/dist/types.d.ts
CHANGED
|
@@ -403,4 +403,18 @@ interface ReadonlySetDeep<ItemType> extends ReadonlySet<ReadonlyDeep<ItemType>>
|
|
|
403
403
|
type ReadonlyObjectDeep<ObjectType extends object> = {
|
|
404
404
|
readonly [KeyType in keyof ObjectType]: ReadonlyDeep<ObjectType[KeyType]>;
|
|
405
405
|
};
|
|
406
|
-
|
|
406
|
+
/**
|
|
407
|
+
Makes one property of T required instead of optional.
|
|
408
|
+
@example
|
|
409
|
+
```
|
|
410
|
+
import { RequiredProp } from '@naturalcycles/js-lib/types'
|
|
411
|
+
interface Example {
|
|
412
|
+
a?: string
|
|
413
|
+
b?: string
|
|
414
|
+
};
|
|
415
|
+
type ExampleA = RequiredProp<Example, 'a'>;
|
|
416
|
+
//=> {a: string; b?: string};
|
|
417
|
+
```
|
|
418
|
+
*/
|
|
419
|
+
export type RequiredProp<T, K extends keyof T> = Required<Pick<T, K>> & T;
|
|
420
|
+
export * from './typeFest.js';
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
package/src/browser/topbar.ts
CHANGED
|
@@ -69,7 +69,7 @@ export const _AsyncMemo =
|
|
|
69
69
|
const keyStr = String(key)
|
|
70
70
|
const methodSignature = _getTargetMethodSignature(target, keyStr)
|
|
71
71
|
|
|
72
|
-
//
|
|
72
|
+
// oxlint-disable-next-line @typescript-eslint/promise-function-async
|
|
73
73
|
descriptor.value = function (this: typeof target, ...args: MaybeParameters<FN>): Promise<any> {
|
|
74
74
|
const ctx = this
|
|
75
75
|
const cacheKey = cacheKeyFn(args)
|
|
@@ -22,7 +22,7 @@ export const _SwarmSafe = (): MethodDecorator => (target, key, descriptor) => {
|
|
|
22
22
|
|
|
23
23
|
console.log('SwarmSafe constructor called', { key, methodSignature })
|
|
24
24
|
|
|
25
|
-
//
|
|
25
|
+
// oxlint-disable-next-line @typescript-eslint/promise-function-async
|
|
26
26
|
descriptor.value = function (this: typeof target, ...args: any[]): Promise<any> {
|
|
27
27
|
console.log('SwarmSafe method called', { key, methodSignature, args })
|
|
28
28
|
const ctx = this
|
package/src/http/fetcher.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
} from '../object/object.util.js'
|
|
29
29
|
import { pDelay } from '../promise/pDelay.js'
|
|
30
30
|
import { pTimeout } from '../promise/pTimeout.js'
|
|
31
|
+
import { _toUrlOrNull } from '../string/index.js'
|
|
31
32
|
import { _jsonParse, _jsonParseIfPossible } from '../string/json.util.js'
|
|
32
33
|
import { _stringify } from '../string/stringify.js'
|
|
33
34
|
import type {
|
|
@@ -770,7 +771,7 @@ export class Fetcher {
|
|
|
770
771
|
let { name } = cfg
|
|
771
772
|
if (!name && cfg.baseUrl) {
|
|
772
773
|
// derive FetcherName from baseUrl
|
|
773
|
-
const url =
|
|
774
|
+
const url = _toUrlOrNull(cfg.baseUrl)
|
|
774
775
|
if (url) {
|
|
775
776
|
name = url.hostname
|
|
776
777
|
}
|
package/src/promise/pDefer.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface DeferredPromise<T = void> extends Promise<T> {
|
|
|
21
21
|
rejectAborted: (reason?: string) => void
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
/*
|
|
24
|
+
/* oxlint-disable @typescript-eslint/promise-function-async */
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Returns DeferredPromise - a Promise that has .resolve() and .reject() methods.
|
package/src/promise/pDelay.ts
CHANGED
|
@@ -14,7 +14,7 @@ export async function pDelay<T>(ms: NumberOfMilliseconds = 0, value?: T): Promis
|
|
|
14
14
|
)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
/*
|
|
17
|
+
/* oxlint-disable @typescript-eslint/promise-function-async */
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Promisified version of setTimeout.
|
package/src/typeFest.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @file Old inclusion of 3rd party `type-fest` lib inlined here.
|
|
5
|
+
*/
|
|
6
|
+
|
|
3
7
|
/**
|
|
4
8
|
Flatten the type output to improve type hints shown in editors.
|
|
5
9
|
*/
|
|
@@ -197,21 +201,6 @@ export type ConditionalExcept<Base, Condition> = Except<Base, ConditionalKeys<Ba
|
|
|
197
201
|
*/
|
|
198
202
|
export type ConditionalPick<Base, Condition> = Pick<Base, ConditionalKeys<Base, Condition>>
|
|
199
203
|
|
|
200
|
-
/**
|
|
201
|
-
Makes one property of T required instead of optional.
|
|
202
|
-
@example
|
|
203
|
-
```
|
|
204
|
-
import {RequireProp} from 'type-fest';
|
|
205
|
-
interface Example {
|
|
206
|
-
a?: string
|
|
207
|
-
b?: string
|
|
208
|
-
};
|
|
209
|
-
type ExampleA = RequireProp<Example, 'a'>;
|
|
210
|
-
//=> {a: string; b?: string};
|
|
211
|
-
```
|
|
212
|
-
*/
|
|
213
|
-
export type RequireProp<T, K extends keyof T> = Required<Pick<T, K>> & T
|
|
214
|
-
|
|
215
204
|
/**
|
|
216
205
|
Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
|
217
206
|
*/
|
package/src/types.ts
CHANGED
|
@@ -478,7 +478,7 @@ export type Class<T = any> = new (...args: any[]) => T
|
|
|
478
478
|
//=> error TS2339: Property 'push' does not exist on type 'readonly string[]'
|
|
479
479
|
```
|
|
480
480
|
*/
|
|
481
|
-
/*
|
|
481
|
+
/* oxlint-disable @typescript-eslint/no-restricted-types */
|
|
482
482
|
export type ReadonlyDeep<T> = T extends Primitive | ((...args: any[]) => unknown)
|
|
483
483
|
? T
|
|
484
484
|
: T extends ReadonlyMap<infer KeyType, infer ValueType>
|
|
@@ -509,4 +509,21 @@ type ReadonlyObjectDeep<ObjectType extends object> = {
|
|
|
509
509
|
readonly [KeyType in keyof ObjectType]: ReadonlyDeep<ObjectType[KeyType]>
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
-
|
|
512
|
+
// oxlint-enable
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
Makes one property of T required instead of optional.
|
|
516
|
+
@example
|
|
517
|
+
```
|
|
518
|
+
import { RequiredProp } from '@naturalcycles/js-lib/types'
|
|
519
|
+
interface Example {
|
|
520
|
+
a?: string
|
|
521
|
+
b?: string
|
|
522
|
+
};
|
|
523
|
+
type ExampleA = RequiredProp<Example, 'a'>;
|
|
524
|
+
//=> {a: string; b?: string};
|
|
525
|
+
```
|
|
526
|
+
*/
|
|
527
|
+
export type RequiredProp<T, K extends keyof T> = Required<Pick<T, K>> & T
|
|
528
|
+
|
|
529
|
+
export * from './typeFest.js'
|