@naturalcycles/js-lib 15.15.2 → 15.16.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.
Files changed (99) hide show
  1. package/dist/array/range.d.ts +1 -2
  2. package/dist/bot.model.d.ts +12 -0
  3. package/dist/bot.model.js +15 -0
  4. package/dist/browser/adminService.d.ts +1 -1
  5. package/dist/{bot.d.ts → browser/bot.d.ts} +1 -12
  6. package/dist/{bot.js → browser/bot.js} +2 -16
  7. package/dist/browser/index.d.ts +8 -0
  8. package/dist/browser/index.js +8 -0
  9. package/dist/datetime/index.d.ts +6 -0
  10. package/dist/datetime/index.js +6 -0
  11. package/dist/datetime/localTime.js +1 -1
  12. package/dist/decorators/decorator.util.d.ts +1 -1
  13. package/dist/decorators/index.d.ts +12 -0
  14. package/dist/decorators/index.js +12 -0
  15. package/dist/decorators/logMethod.decorator.d.ts +1 -1
  16. package/dist/decorators/logMethod.decorator.js +4 -2
  17. package/dist/decorators/retry.decorator.d.ts +1 -1
  18. package/dist/decorators/retry.decorator.js +1 -1
  19. package/dist/error/assert.d.ts +1 -2
  20. package/dist/error/error.util.d.ts +2 -1
  21. package/dist/error/index.d.ts +6 -0
  22. package/dist/error/index.js +6 -0
  23. package/dist/error/try.d.ts +1 -2
  24. package/dist/error/tryCatch.d.ts +1 -1
  25. package/dist/error/tryCatch.js +2 -1
  26. package/dist/http/fetcher.js +1 -1
  27. package/dist/http/fetcher.model.d.ts +1 -2
  28. package/dist/http/index.d.ts +3 -0
  29. package/dist/http/index.js +2 -0
  30. package/dist/index.d.ts +0 -80
  31. package/dist/index.js +0 -80
  32. package/dist/is.util.d.ts +1 -2
  33. package/dist/iter/asyncIterable2.d.ts +1 -2
  34. package/dist/json-schema/from-data/generateJsonSchemaFromData.d.ts +2 -1
  35. package/dist/json-schema/from-data/generateJsonSchemaFromData.js +2 -1
  36. package/dist/json-schema/index.d.ts +5 -0
  37. package/dist/json-schema/index.js +5 -0
  38. package/dist/json-schema/jsonSchema.util.d.ts +1 -1
  39. package/dist/json-schema/jsonSchemaBuilder.d.ts +2 -1
  40. package/dist/json-schema/jsonSchemaBuilder.js +2 -1
  41. package/dist/log/index.d.ts +1 -0
  42. package/dist/log/index.js +1 -0
  43. package/dist/math/index.d.ts +4 -0
  44. package/dist/math/index.js +4 -0
  45. package/dist/math/stack.util.js +2 -1
  46. package/dist/object/index.d.ts +6 -0
  47. package/dist/object/index.js +6 -0
  48. package/dist/object/sortObject.d.ts +1 -1
  49. package/dist/promise/index.d.ts +11 -0
  50. package/dist/promise/index.js +11 -0
  51. package/dist/promise/pMap.d.ts +3 -2
  52. package/dist/promise/pMap.js +2 -1
  53. package/dist/promise/pRetry.d.ts +3 -1
  54. package/dist/promise/pRetry.js +4 -1
  55. package/dist/string/index.d.ts +13 -0
  56. package/dist/string/index.js +13 -0
  57. package/dist/typeFest.d.ts +1 -36
  58. package/dist/types.d.ts +6 -1
  59. package/package.json +16 -1
  60. package/src/array/range.ts +1 -2
  61. package/src/bot.model.ts +14 -0
  62. package/src/browser/adminService.ts +1 -1
  63. package/src/{bot.ts → browser/bot.ts} +2 -16
  64. package/src/browser/index.ts +8 -0
  65. package/src/datetime/index.ts +6 -0
  66. package/src/datetime/localTime.ts +1 -1
  67. package/src/decorators/decorator.util.ts +1 -1
  68. package/src/decorators/index.ts +12 -0
  69. package/src/decorators/logMethod.decorator.ts +5 -3
  70. package/src/decorators/retry.decorator.ts +2 -2
  71. package/src/error/assert.ts +1 -2
  72. package/src/error/error.util.ts +5 -5
  73. package/src/error/index.ts +6 -0
  74. package/src/error/try.ts +1 -2
  75. package/src/error/tryCatch.ts +4 -3
  76. package/src/http/fetcher.model.ts +7 -2
  77. package/src/http/fetcher.ts +1 -1
  78. package/src/http/index.ts +3 -0
  79. package/src/index.ts +0 -80
  80. package/src/is.util.ts +1 -2
  81. package/src/iter/asyncIterable2.ts +1 -2
  82. package/src/json-schema/from-data/generateJsonSchemaFromData.ts +3 -4
  83. package/src/json-schema/index.ts +5 -0
  84. package/src/json-schema/jsonSchema.util.ts +1 -1
  85. package/src/json-schema/jsonSchemaBuilder.ts +9 -9
  86. package/src/log/index.ts +1 -0
  87. package/src/math/index.ts +4 -0
  88. package/src/math/stack.util.ts +2 -1
  89. package/src/object/index.ts +6 -0
  90. package/src/object/sortObject.ts +1 -1
  91. package/src/promise/index.ts +11 -0
  92. package/src/promise/pMap.ts +3 -2
  93. package/src/promise/pRetry.ts +6 -2
  94. package/src/string/index.ts +13 -0
  95. package/src/typeFest.ts +1 -38
  96. package/src/types.ts +9 -1
  97. /package/dist/{time → datetime}/time.util.d.ts +0 -0
  98. /package/dist/{time → datetime}/time.util.js +0 -0
  99. /package/src/{time → datetime}/time.util.ts +0 -0
@@ -0,0 +1,11 @@
1
+ export * from './abortable.js'
2
+ export * from './pDefer.js'
3
+ export * from './pDelay.js'
4
+ export * from './pFilter.js'
5
+ export * from './pHang.js'
6
+ export * from './pMap.js'
7
+ export * from './pProps.js'
8
+ export * from './pQueue.js'
9
+ export * from './pRetry.js'
10
+ export * from './pState.js'
11
+ export * from './pTimeout.js'
@@ -1,5 +1,6 @@
1
- import type { AbortableAsyncMapper, CommonLogger } from '../index.js'
2
- import { END, ErrorMode, SKIP } from '../index.js'
1
+ import { ErrorMode } from '../error/index.js'
2
+ import type { CommonLogger } from '../log/index.js'
3
+ import { type AbortableAsyncMapper, END, SKIP } from '../types.js'
3
4
 
4
5
  export interface PMapOptions {
5
6
  /**
@@ -1,5 +1,9 @@
1
- import type { AnyFunction, CommonLogger, ErrorData, UnixTimestampMillis } from '../index.js'
2
- import { _errorDataAppend, _since, pDelay, pTimeout } from '../index.js'
1
+ import { _since } from '../datetime/index.js'
2
+ import { _errorDataAppend, type ErrorData } from '../error/index.js'
3
+ import type { CommonLogger } from '../log/index.js'
4
+ import type { AnyFunction, UnixTimestampMillis } from '../types.js'
5
+ import { pDelay } from './pDelay.js'
6
+ import { pTimeout } from './pTimeout.js'
3
7
 
4
8
  export interface PRetryOptions {
5
9
  /**
@@ -0,0 +1,13 @@
1
+ export * from './case.js'
2
+ export * from './escape.js'
3
+ export * from './hash.util.js'
4
+ export * from './json.util.js'
5
+ export * from './leven.js'
6
+ export * from './pupa.js'
7
+ export * from './readingTime.js'
8
+ export * from './regex.js'
9
+ export * from './safeJsonStringify.js'
10
+ export * from './slugify.js'
11
+ export * from './string.util.js'
12
+ export * from './stringify.js'
13
+ export * from './url.util.js'
package/src/typeFest.ts CHANGED
@@ -1,11 +1,6 @@
1
1
  /* eslint-disable */
2
2
 
3
- /**
4
- Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
5
-
6
- @category Basic
7
- */
8
- export type Primitive = null | undefined | string | number | boolean | symbol | bigint
3
+ import type { Primitive } from './types.js'
9
4
 
10
5
  /**
11
6
  Flatten the type output to improve type hints shown in editors.
@@ -171,32 +166,6 @@ export type Merge<Destination, Source> = {
171
166
  : never
172
167
  } & PickIndexSignature<Destination & Source>
173
168
 
174
- /**
175
- Create a type that represents either the value or the value wrapped in `PromiseLike`.
176
-
177
- Use-cases:
178
- - A function accepts a callback that may either return a value synchronously or may return a promised value.
179
- - This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks.
180
-
181
- Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript.
182
-
183
- @example
184
- ```
185
- import {Promisable} from 'type-fest';
186
-
187
- async function logger(getLogEntry: () => Promisable<string>): Promise<void> {
188
- const entry = await getLogEntry();
189
- console.log(entry);
190
- }
191
-
192
- logger(() => 'foo');
193
- logger(() => Promise.resolve('bar'));
194
-
195
- @category Utilities
196
- ```
197
- */
198
- export type Promisable<T> = T | PromiseLike<T>
199
-
200
169
  /**
201
170
  Extract the keys from a type where the value type of the key extends the given `Condition`.
202
171
  Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
@@ -296,12 +265,6 @@ export type ConditionalExcept<Base, Condition> = Except<Base, ConditionalKeys<Ba
296
265
  */
297
266
  export type ConditionalPick<Base, Condition> = Pick<Base, ConditionalKeys<Base, Condition>>
298
267
 
299
- /**
300
- Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
301
- @category Basic
302
- */
303
- export type Class<T = any> = new (...args: any[]) => T
304
-
305
268
  /**
306
269
  Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
307
270
  */
package/src/types.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { _sortBy } from './array/array.util.js'
2
- import type { Promisable } from './typeFest.js'
3
2
 
4
3
  declare const __brand: unique symbol
5
4
 
@@ -435,3 +434,12 @@ export interface CommonClient extends AsyncDisposable {
435
434
  disconnect: () => Promise<void>
436
435
  ping: () => Promise<void>
437
436
  }
437
+
438
+ export type Primitive = null | undefined | string | number | boolean | symbol | bigint
439
+
440
+ export type Promisable<T> = T | PromiseLike<T>
441
+
442
+ /**
443
+ Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
444
+ */
445
+ export type Class<T = any> = new (...args: any[]) => T
File without changes
File without changes
File without changes