@oscarpalmer/atoms 0.166.3 → 0.167.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/index.d.mts +172 -140
- package/dist/index.mjs +29 -29
- package/dist/promise/index.d.mts +2 -7
- package/dist/promise/index.mjs +5 -7
- package/dist/promise/misc.d.mts +3 -1
- package/dist/promise/misc.mjs +3 -2
- package/dist/result/index.d.mts +2 -5
- package/dist/result/index.mjs +2 -4
- package/dist/result/misc.d.mts +2 -1
- package/dist/result/misc.mjs +2 -2
- package/package.json +30 -2
- package/src/index.ts +9 -0
- package/src/promise/index.ts +0 -22
- package/src/promise/misc.ts +7 -0
- package/src/result/index.ts +0 -9
- package/src/result/misc.ts +6 -0
package/dist/index.d.mts
CHANGED
|
@@ -3265,6 +3265,14 @@ type FulfilledPromise<Value> = {
|
|
|
3265
3265
|
status: typeof PROMISE_TYPE_FULFILLED;
|
|
3266
3266
|
value: Awaited<Value>;
|
|
3267
3267
|
};
|
|
3268
|
+
type PromiseData = {
|
|
3269
|
+
last: number;
|
|
3270
|
+
result: unknown[];
|
|
3271
|
+
};
|
|
3272
|
+
type PromiseHandlers = {
|
|
3273
|
+
resolve: (value: unknown[]) => void;
|
|
3274
|
+
reject: (reason: unknown) => void;
|
|
3275
|
+
};
|
|
3268
3276
|
type PromiseOptions = {
|
|
3269
3277
|
/**
|
|
3270
3278
|
* AbortSignal for aborting the promise; when aborted, the promise will reject with the reason of the signal
|
|
@@ -3275,6 +3283,15 @@ type PromiseOptions = {
|
|
|
3275
3283
|
*/
|
|
3276
3284
|
time?: number;
|
|
3277
3285
|
};
|
|
3286
|
+
type PromiseParameters = {
|
|
3287
|
+
abort: () => void;
|
|
3288
|
+
complete: boolean;
|
|
3289
|
+
data: PromiseData;
|
|
3290
|
+
handlers: PromiseHandlers;
|
|
3291
|
+
index: number;
|
|
3292
|
+
signal?: AbortSignal;
|
|
3293
|
+
value?: unknown;
|
|
3294
|
+
};
|
|
3278
3295
|
/**
|
|
3279
3296
|
* Promise handling strategy
|
|
3280
3297
|
*
|
|
@@ -3300,60 +3317,20 @@ type RejectedPromise = {
|
|
|
3300
3317
|
status: typeof PROMISE_TYPE_REJECTED;
|
|
3301
3318
|
reason: unknown;
|
|
3302
3319
|
};
|
|
3320
|
+
declare const PROMISE_ABORT_EVENT = "abort";
|
|
3321
|
+
declare const PROMISE_ABORT_OPTIONS: {
|
|
3322
|
+
once: boolean;
|
|
3323
|
+
};
|
|
3324
|
+
declare const PROMISE_ERROR_NAME = "PromiseTimeoutError";
|
|
3325
|
+
declare const PROMISE_MESSAGE_EXPECTATION_ATTEMPT = "Attempt expected a function or a promise";
|
|
3326
|
+
declare const PROMISE_MESSAGE_EXPECTATION_RESULT = "toResult expected a Promise";
|
|
3327
|
+
declare const PROMISE_MESSAGE_EXPECTATION_TIMED = "Timed function expected a Promise";
|
|
3328
|
+
declare const PROMISE_MESSAGE_TIMEOUT = "Promise timed out";
|
|
3329
|
+
declare const PROMISE_STRATEGY_ALL: Set<PromiseStrategy>;
|
|
3330
|
+
declare const PROMISE_STRATEGY_DEFAULT: PromiseStrategy;
|
|
3303
3331
|
declare const PROMISE_TYPE_FULFILLED = "fulfilled";
|
|
3304
3332
|
declare const PROMISE_TYPE_REJECTED = "rejected";
|
|
3305
3333
|
//#endregion
|
|
3306
|
-
//#region src/result/misc.d.ts
|
|
3307
|
-
/**
|
|
3308
|
-
* Creates an extended error result
|
|
3309
|
-
* @param error Error value
|
|
3310
|
-
* @param original Original error
|
|
3311
|
-
* @returns Error result
|
|
3312
|
-
*/
|
|
3313
|
-
declare function error<E>(value: E, original: Error): ExtendedErr<E>;
|
|
3314
|
-
/**
|
|
3315
|
-
* Creates an error result
|
|
3316
|
-
* @param error Error value
|
|
3317
|
-
* @returns Error result
|
|
3318
|
-
*/
|
|
3319
|
-
declare function error<E>(value: E): Err<E>;
|
|
3320
|
-
/**
|
|
3321
|
-
* Creates an ok result
|
|
3322
|
-
* @param value Value
|
|
3323
|
-
* @returns Ok result
|
|
3324
|
-
*/
|
|
3325
|
-
declare function ok<Value>(value: Value): Ok<Value>;
|
|
3326
|
-
/**
|
|
3327
|
-
* Converts a result to a promise
|
|
3328
|
-
*
|
|
3329
|
-
* Resolves if ok, rejects for error
|
|
3330
|
-
* @param result Result to convert
|
|
3331
|
-
* @returns Promised result
|
|
3332
|
-
*/
|
|
3333
|
-
declare function toPromise<Value, E = Error>(callback: () => AnyResult<Value, E>): Promise<Value>;
|
|
3334
|
-
/**
|
|
3335
|
-
* Converts a result to a promise
|
|
3336
|
-
*
|
|
3337
|
-
* Resolves if ok, rejects for error
|
|
3338
|
-
* @param result Result to convert
|
|
3339
|
-
* @returns Promised result
|
|
3340
|
-
*/
|
|
3341
|
-
declare function toPromise<Value, E = Error>(result: AnyResult<Value, E>): Promise<Value>;
|
|
3342
|
-
/**
|
|
3343
|
-
* Gets the value of an ok result _(or a default value)_
|
|
3344
|
-
* @param value Result to unwrap
|
|
3345
|
-
* @param defaultValue Default value
|
|
3346
|
-
* @returns Value of the result _(or the default value)_
|
|
3347
|
-
*/
|
|
3348
|
-
declare function unwrap<Value, E = Error>(value: Result<Value, E>, defaultValue: Value): Value;
|
|
3349
|
-
/**
|
|
3350
|
-
* Gets the value of an ok result _(or a default value)_
|
|
3351
|
-
* @param value Result to unwrap
|
|
3352
|
-
* @param defaultValue Default value
|
|
3353
|
-
* @returns Value of the result _(or the default value)_
|
|
3354
|
-
*/
|
|
3355
|
-
declare function unwrap(value: unknown, defaultValue: unknown): unknown;
|
|
3356
|
-
//#endregion
|
|
3357
3334
|
//#region src/promise/delay.d.ts
|
|
3358
3335
|
/**
|
|
3359
3336
|
* Create a delayed promise that resolves after a certain amount of time, or rejects if aborted
|
|
@@ -3368,56 +3345,6 @@ declare function delay(options?: PromiseOptions): Promise<void>;
|
|
|
3368
3345
|
*/
|
|
3369
3346
|
declare function delay(time?: number): Promise<void>;
|
|
3370
3347
|
//#endregion
|
|
3371
|
-
//#region src/promise/helpers.d.ts
|
|
3372
|
-
/**
|
|
3373
|
-
* Is the value a fulfilled promise result?
|
|
3374
|
-
* @param value Value to check
|
|
3375
|
-
* @returns `true` if the value is a fulfilled promise result, `false` otherwise
|
|
3376
|
-
*/
|
|
3377
|
-
declare function isFulfilled<Value>(value: unknown): value is FulfilledPromise<Value>;
|
|
3378
|
-
/**
|
|
3379
|
-
* Is the value a rejected promise result?
|
|
3380
|
-
* @param value Value to check
|
|
3381
|
-
* @returns `true` if the value is a rejected promise result, `false` otherwise
|
|
3382
|
-
*/
|
|
3383
|
-
declare function isRejected(value: unknown): value is RejectedPromise;
|
|
3384
|
-
//#endregion
|
|
3385
|
-
//#region src/promise/misc.d.ts
|
|
3386
|
-
/**
|
|
3387
|
-
* Create a cancelable promise
|
|
3388
|
-
* @param executor Executor function for the promise
|
|
3389
|
-
* @returns Cancelable promise
|
|
3390
|
-
*/
|
|
3391
|
-
declare function cancelable<Value>(executor: (resolve: (value: Value) => void, reject: (reason: unknown) => void) => void): CancelablePromise<Value>;
|
|
3392
|
-
/**
|
|
3393
|
-
* Converts a promise to a promised result
|
|
3394
|
-
* @param callback Promise callback
|
|
3395
|
-
* @returns Promised result
|
|
3396
|
-
*/
|
|
3397
|
-
declare function toResult<Value>(callback: () => Promise<Value>): Promise<Result<Value>>;
|
|
3398
|
-
/**
|
|
3399
|
-
* Converts a promise to a promised result
|
|
3400
|
-
* @param promise Promise to convert
|
|
3401
|
-
* @returns Promised result
|
|
3402
|
-
*/
|
|
3403
|
-
declare function toResult<Value>(promise: Promise<Value>): Promise<Result<Value>>;
|
|
3404
|
-
//#endregion
|
|
3405
|
-
//#region src/promise/timed.d.ts
|
|
3406
|
-
/**
|
|
3407
|
-
* Create a promise that should be settled within a certain amount of time
|
|
3408
|
-
* @param promise Promise to settle
|
|
3409
|
-
* @param options Timed options
|
|
3410
|
-
* @returns Timed promise
|
|
3411
|
-
*/
|
|
3412
|
-
declare function timed<Value>(promise: Promise<Value>, options: RequiredKeys<PromiseOptions, 'time'>): Promise<Value>;
|
|
3413
|
-
/**
|
|
3414
|
-
* Create a promise that should be settled within a certain amount of time
|
|
3415
|
-
* @param promise Promise to settle
|
|
3416
|
-
* @param time How long to wait for _(in milliseconds; defaults to `0`)_
|
|
3417
|
-
* @returns Timed promise
|
|
3418
|
-
*/
|
|
3419
|
-
declare function timed<Value>(promise: Promise<Value>, time: number): Promise<Value>;
|
|
3420
|
-
//#endregion
|
|
3421
3348
|
//#region src/promise/index.d.ts
|
|
3422
3349
|
/**
|
|
3423
3350
|
* Wrap a promise with safety handlers, with optional abort capabilities and timeout
|
|
@@ -3512,6 +3439,149 @@ declare function resultPromises<Items extends unknown[]>(items: [...Items], sign
|
|
|
3512
3439
|
*/
|
|
3513
3440
|
declare function resultPromises<Value>(items: Promise<Value>[], signal?: AbortSignal): Promise<Result<Awaited<Value>>[]>;
|
|
3514
3441
|
//#endregion
|
|
3442
|
+
//#region src/internal/result.d.ts
|
|
3443
|
+
/**
|
|
3444
|
+
* Is the result an extended error?
|
|
3445
|
+
* @param result Result to check
|
|
3446
|
+
* @returns `true` if the result is an extended error, `false` otherwise
|
|
3447
|
+
*/
|
|
3448
|
+
declare function isError<Value, E = Error>(value: ExtendedErr<E> | Result<Value, E>, extended: true): value is ExtendedErr<E>;
|
|
3449
|
+
/**
|
|
3450
|
+
* Is the result an error?
|
|
3451
|
+
* @param result Result to check
|
|
3452
|
+
* @returns `true` if the result is an error, `false` otherwise
|
|
3453
|
+
*/
|
|
3454
|
+
declare function isError<Value, E = Error>(value: Result<Value, E>): value is Err<E>;
|
|
3455
|
+
/**
|
|
3456
|
+
* Is the value an error?
|
|
3457
|
+
* @param value Value to check
|
|
3458
|
+
* @returns `true` if the value is an error, `false` otherwise
|
|
3459
|
+
*/
|
|
3460
|
+
declare function isError(value: unknown): value is Err<unknown> | ExtendedErr<unknown>;
|
|
3461
|
+
/**
|
|
3462
|
+
* Is the result ok?
|
|
3463
|
+
* @param value Result to check
|
|
3464
|
+
* @returns `true` if the result is ok, `false` otherwise
|
|
3465
|
+
*/
|
|
3466
|
+
declare function isOk<Value, E = Error>(value: Result<Value, E>): value is Ok<Value>;
|
|
3467
|
+
/**
|
|
3468
|
+
* Is the value ok?
|
|
3469
|
+
* @param value Value to check
|
|
3470
|
+
* @returns `true` if the value is ok, `false` otherwise
|
|
3471
|
+
*/
|
|
3472
|
+
declare function isOk(value: unknown): value is Ok<unknown>;
|
|
3473
|
+
/**
|
|
3474
|
+
* Is the value a result?
|
|
3475
|
+
* @param value Value to check
|
|
3476
|
+
* @returns `true` if the value is a result, `false` otherwise
|
|
3477
|
+
*/
|
|
3478
|
+
declare function isResult(value: unknown): value is ExtendedErr<unknown> | Result<unknown, unknown>;
|
|
3479
|
+
//#endregion
|
|
3480
|
+
//#region src/result/misc.d.ts
|
|
3481
|
+
/**
|
|
3482
|
+
* Creates an extended error result
|
|
3483
|
+
* @param error Error value
|
|
3484
|
+
* @param original Original error
|
|
3485
|
+
* @returns Error result
|
|
3486
|
+
*/
|
|
3487
|
+
declare function error<E>(value: E, original: Error): ExtendedErr<E>;
|
|
3488
|
+
/**
|
|
3489
|
+
* Creates an error result
|
|
3490
|
+
* @param error Error value
|
|
3491
|
+
* @returns Error result
|
|
3492
|
+
*/
|
|
3493
|
+
declare function error<E>(value: E): Err<E>;
|
|
3494
|
+
declare function getError<E>(value: E, original?: Error): Err<E> | ExtendedErr<E>;
|
|
3495
|
+
/**
|
|
3496
|
+
* Creates an ok result
|
|
3497
|
+
* @param value Value
|
|
3498
|
+
* @returns Ok result
|
|
3499
|
+
*/
|
|
3500
|
+
declare function ok<Value>(value: Value): Ok<Value>;
|
|
3501
|
+
/**
|
|
3502
|
+
* Converts a result to a promise
|
|
3503
|
+
*
|
|
3504
|
+
* Resolves if ok, rejects for error
|
|
3505
|
+
* @param result Result to convert
|
|
3506
|
+
* @returns Promised result
|
|
3507
|
+
*/
|
|
3508
|
+
declare function toPromise<Value, E = Error>(callback: () => AnyResult<Value, E>): Promise<Value>;
|
|
3509
|
+
/**
|
|
3510
|
+
* Converts a result to a promise
|
|
3511
|
+
*
|
|
3512
|
+
* Resolves if ok, rejects for error
|
|
3513
|
+
* @param result Result to convert
|
|
3514
|
+
* @returns Promised result
|
|
3515
|
+
*/
|
|
3516
|
+
declare function toPromise<Value, E = Error>(result: AnyResult<Value, E>): Promise<Value>;
|
|
3517
|
+
/**
|
|
3518
|
+
* Gets the value of an ok result _(or a default value)_
|
|
3519
|
+
* @param value Result to unwrap
|
|
3520
|
+
* @param defaultValue Default value
|
|
3521
|
+
* @returns Value of the result _(or the default value)_
|
|
3522
|
+
*/
|
|
3523
|
+
declare function unwrap<Value, E = Error>(value: Result<Value, E>, defaultValue: Value): Value;
|
|
3524
|
+
/**
|
|
3525
|
+
* Gets the value of an ok result _(or a default value)_
|
|
3526
|
+
* @param value Result to unwrap
|
|
3527
|
+
* @param defaultValue Default value
|
|
3528
|
+
* @returns Value of the result _(or the default value)_
|
|
3529
|
+
*/
|
|
3530
|
+
declare function unwrap(value: unknown, defaultValue: unknown): unknown;
|
|
3531
|
+
//#endregion
|
|
3532
|
+
//#region src/promise/helpers.d.ts
|
|
3533
|
+
/**
|
|
3534
|
+
* Is the value a fulfilled promise result?
|
|
3535
|
+
* @param value Value to check
|
|
3536
|
+
* @returns `true` if the value is a fulfilled promise result, `false` otherwise
|
|
3537
|
+
*/
|
|
3538
|
+
declare function isFulfilled<Value>(value: unknown): value is FulfilledPromise<Value>;
|
|
3539
|
+
/**
|
|
3540
|
+
* Is the value a rejected promise result?
|
|
3541
|
+
* @param value Value to check
|
|
3542
|
+
* @returns `true` if the value is a rejected promise result, `false` otherwise
|
|
3543
|
+
*/
|
|
3544
|
+
declare function isRejected(value: unknown): value is RejectedPromise;
|
|
3545
|
+
//#endregion
|
|
3546
|
+
//#region src/promise/misc.d.ts
|
|
3547
|
+
/**
|
|
3548
|
+
* Create a cancelable promise
|
|
3549
|
+
* @param executor Executor function for the promise
|
|
3550
|
+
* @returns Cancelable promise
|
|
3551
|
+
*/
|
|
3552
|
+
declare function cancelable<Value>(executor: (resolve: (value: Value) => void, reject: (reason: unknown) => void) => void): CancelablePromise<Value>;
|
|
3553
|
+
declare function handleResult(status: string, parameters: PromiseParameters): void;
|
|
3554
|
+
declare function settlePromise(aborter: () => void, settler: (value: any) => void, value: unknown, signal?: AbortSignal): void;
|
|
3555
|
+
/**
|
|
3556
|
+
* Converts a promise to a promised result
|
|
3557
|
+
* @param callback Promise callback
|
|
3558
|
+
* @returns Promised result
|
|
3559
|
+
*/
|
|
3560
|
+
declare function toResult<Value>(callback: () => Promise<Value>): Promise<Result<Value>>;
|
|
3561
|
+
/**
|
|
3562
|
+
* Converts a promise to a promised result
|
|
3563
|
+
* @param promise Promise to convert
|
|
3564
|
+
* @returns Promised result
|
|
3565
|
+
*/
|
|
3566
|
+
declare function toResult<Value>(promise: Promise<Value>): Promise<Result<Value>>;
|
|
3567
|
+
//#endregion
|
|
3568
|
+
//#region src/promise/timed.d.ts
|
|
3569
|
+
declare function getTimedPromise<Value>(promise: Promise<Value>, time: number, signal?: AbortSignal): Promise<Value>;
|
|
3570
|
+
/**
|
|
3571
|
+
* Create a promise that should be settled within a certain amount of time
|
|
3572
|
+
* @param promise Promise to settle
|
|
3573
|
+
* @param options Timed options
|
|
3574
|
+
* @returns Timed promise
|
|
3575
|
+
*/
|
|
3576
|
+
declare function timed<Value>(promise: Promise<Value>, options: RequiredKeys<PromiseOptions, 'time'>): Promise<Value>;
|
|
3577
|
+
/**
|
|
3578
|
+
* Create a promise that should be settled within a certain amount of time
|
|
3579
|
+
* @param promise Promise to settle
|
|
3580
|
+
* @param time How long to wait for _(in milliseconds; defaults to `0`)_
|
|
3581
|
+
* @returns Timed promise
|
|
3582
|
+
*/
|
|
3583
|
+
declare function timed<Value>(promise: Promise<Value>, time: number): Promise<Value>;
|
|
3584
|
+
//#endregion
|
|
3515
3585
|
//#region src/query.d.ts
|
|
3516
3586
|
/**
|
|
3517
3587
|
* Convert a query string to a plain _(nested)_ object
|
|
@@ -4120,44 +4190,6 @@ declare namespace attemptPipe {
|
|
|
4120
4190
|
var async: typeof attemptAsyncPipe;
|
|
4121
4191
|
}
|
|
4122
4192
|
//#endregion
|
|
4123
|
-
//#region src/internal/result.d.ts
|
|
4124
|
-
/**
|
|
4125
|
-
* Is the result an extended error?
|
|
4126
|
-
* @param result Result to check
|
|
4127
|
-
* @returns `true` if the result is an extended error, `false` otherwise
|
|
4128
|
-
*/
|
|
4129
|
-
declare function isError<Value, E = Error>(value: ExtendedErr<E> | Result<Value, E>, extended: true): value is ExtendedErr<E>;
|
|
4130
|
-
/**
|
|
4131
|
-
* Is the result an error?
|
|
4132
|
-
* @param result Result to check
|
|
4133
|
-
* @returns `true` if the result is an error, `false` otherwise
|
|
4134
|
-
*/
|
|
4135
|
-
declare function isError<Value, E = Error>(value: Result<Value, E>): value is Err<E>;
|
|
4136
|
-
/**
|
|
4137
|
-
* Is the value an error?
|
|
4138
|
-
* @param value Value to check
|
|
4139
|
-
* @returns `true` if the value is an error, `false` otherwise
|
|
4140
|
-
*/
|
|
4141
|
-
declare function isError(value: unknown): value is Err<unknown> | ExtendedErr<unknown>;
|
|
4142
|
-
/**
|
|
4143
|
-
* Is the result ok?
|
|
4144
|
-
* @param value Result to check
|
|
4145
|
-
* @returns `true` if the result is ok, `false` otherwise
|
|
4146
|
-
*/
|
|
4147
|
-
declare function isOk<Value, E = Error>(value: Result<Value, E>): value is Ok<Value>;
|
|
4148
|
-
/**
|
|
4149
|
-
* Is the value ok?
|
|
4150
|
-
* @param value Value to check
|
|
4151
|
-
* @returns `true` if the value is ok, `false` otherwise
|
|
4152
|
-
*/
|
|
4153
|
-
declare function isOk(value: unknown): value is Ok<unknown>;
|
|
4154
|
-
/**
|
|
4155
|
-
* Is the value a result?
|
|
4156
|
-
* @param value Value to check
|
|
4157
|
-
* @returns `true` if the value is a result, `false` otherwise
|
|
4158
|
-
*/
|
|
4159
|
-
declare function isResult(value: unknown): value is ExtendedErr<unknown> | Result<unknown, unknown>;
|
|
4160
|
-
//#endregion
|
|
4161
4193
|
//#region src/result/index.d.ts
|
|
4162
4194
|
/**
|
|
4163
4195
|
* Executes a promise, catching any errors, and returns a result
|
|
@@ -4295,4 +4327,4 @@ declare class SizedSet<Value = unknown> extends Set<Value> {
|
|
|
4295
4327
|
get(value: Value, update?: boolean): Value | undefined;
|
|
4296
4328
|
}
|
|
4297
4329
|
//#endregion
|
|
4298
|
-
export { ArrayComparisonSorter, ArrayKeySorter, ArrayOrPlainObject, ArrayPosition, ArrayValueSorter, Asserter, type Beacon, type BeaconOptions, BuiltIns, CancelableCallback, CancelablePromise, type Color, Constructor, DiffOptions, DiffResult, DiffValue, EqualOptions,
|
|
4330
|
+
export { AnyResult, ArrayComparisonSorter, ArrayKeySorter, ArrayOrPlainObject, ArrayPosition, ArrayValueSorter, Asserter, AttemptFlow, AttemptFlowPromise, type Beacon, type BeaconOptions, BuiltIns, CancelableCallback, CancelablePromise, type Color, Constructor, DiffOptions, DiffResult, DiffValue, EqualOptions, Err, EventPosition, ExtendedErr, ExtendedResult, Flow, FlowPromise, FulfilledPromise, GenericAsyncCallback, GenericCallback, type HSLAColor, type HSLColor, HasValue, Key, KeyedValue, type Logger, type Memoized, type MemoizedOptions, MergeOptions, Merger, NestedArray, NestedKeys, NestedPartial, NestedValue, NestedValues, NumericalKeys, NumericalValues, type Observable, type Observer, Ok, OnceAsyncCallback, OnceCallback, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED, PlainObject, Primitive, PromiseData, PromiseHandlers, PromiseOptions, PromiseParameters, PromiseStrategy, PromiseTimeoutError, PromisesItems, PromisesOptions, PromisesResult, PromisesUnwrapped, PromisesValue, PromisesValues, type Queue, QueueError, type QueueOptions, type Queued, type RGBAColor, type RGBColor, RejectedPromise, RequiredKeys, Result, ResultMatch, RetryError, RetryOptions, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, Simplify, SizedMap, SizedSet, Smushed, SortDirection, type Subscription, TemplateOptions, type Time, ToString, TypedArray, Unsmushed, UnwrapValue, assert, attempt, attemptFlow, attemptPipe, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, count, debounce, delay, diff, difference, drop, endsWith, endsWithArray, equal, error, exists, filter, find, flatten, floor, flow, fromQuery, toPromise as fromResult, toPromise, getArray, getArrayPosition, getColor, getError, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getTimedPromise, getUuid, getValue, groupBy, handleResult, hasValue, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, ignoreKey, includes, includesArray, indexOf, indexOfArray, insert, intersection, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isInstanceOf, isKey, isNonNullable, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, logger, lowerCase, matchResult, max, median, memoize, merge, min, move, noop, ok, omit, once, parse, partition, pascalCase, pick, pipe, promises, push, queue, range, retry, rgbToHex, rgbToHsl, rgbToHsla, round, select, setValue, settlePromise, shuffle, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toQuery, toRecord, toResult, toSet, toggle, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
|
package/dist/index.mjs
CHANGED
|
@@ -3808,7 +3808,7 @@ function isType(value, type) {
|
|
|
3808
3808
|
function cancelable(executor) {
|
|
3809
3809
|
return new CancelablePromise(executor);
|
|
3810
3810
|
}
|
|
3811
|
-
function handleResult
|
|
3811
|
+
function handleResult(status, parameters) {
|
|
3812
3812
|
const { abort, complete, data, handlers, index, signal, value } = parameters;
|
|
3813
3813
|
if (signal?.aborted ?? false) return;
|
|
3814
3814
|
if (!complete && status === "rejected") {
|
|
@@ -3834,6 +3834,28 @@ async function toResult(value) {
|
|
|
3834
3834
|
return actual.then((result) => ok(result)).catch((reason) => error(reason));
|
|
3835
3835
|
}
|
|
3836
3836
|
//#endregion
|
|
3837
|
+
//#region src/promise/delay.ts
|
|
3838
|
+
function delay(options) {
|
|
3839
|
+
const { signal, time } = getPromiseOptions(options);
|
|
3840
|
+
if (signal?.aborted ?? false) return Promise.reject(signal.reason);
|
|
3841
|
+
function abort() {
|
|
3842
|
+
timer.cancel();
|
|
3843
|
+
rejector(signal.reason);
|
|
3844
|
+
}
|
|
3845
|
+
const timer = getTimer(TIMER_WAIT, () => {
|
|
3846
|
+
settlePromise(abort, resolver, void 0, signal);
|
|
3847
|
+
}, time);
|
|
3848
|
+
signal?.addEventListener(PROMISE_ABORT_EVENT, abort, PROMISE_ABORT_OPTIONS);
|
|
3849
|
+
let rejector;
|
|
3850
|
+
let resolver;
|
|
3851
|
+
return new Promise((resolve, reject) => {
|
|
3852
|
+
rejector = reject;
|
|
3853
|
+
resolver = resolve;
|
|
3854
|
+
if (time === 0) settlePromise(abort, resolve, void 0, signal);
|
|
3855
|
+
else timer();
|
|
3856
|
+
});
|
|
3857
|
+
}
|
|
3858
|
+
//#endregion
|
|
3837
3859
|
//#region src/promise/timed.ts
|
|
3838
3860
|
async function getTimedPromise(promise, time, signal) {
|
|
3839
3861
|
function abort() {
|
|
@@ -3862,28 +3884,6 @@ async function timed(promise, options) {
|
|
|
3862
3884
|
return time > 0 ? getTimedPromise(promise, time, signal) : promise;
|
|
3863
3885
|
}
|
|
3864
3886
|
//#endregion
|
|
3865
|
-
//#region src/promise/delay.ts
|
|
3866
|
-
function delay(options) {
|
|
3867
|
-
const { signal, time } = getPromiseOptions(options);
|
|
3868
|
-
if (signal?.aborted ?? false) return Promise.reject(signal.reason);
|
|
3869
|
-
function abort() {
|
|
3870
|
-
timer.cancel();
|
|
3871
|
-
rejector(signal.reason);
|
|
3872
|
-
}
|
|
3873
|
-
const timer = getTimer(TIMER_WAIT, () => {
|
|
3874
|
-
settlePromise(abort, resolver, void 0, signal);
|
|
3875
|
-
}, time);
|
|
3876
|
-
signal?.addEventListener(PROMISE_ABORT_EVENT, abort, PROMISE_ABORT_OPTIONS);
|
|
3877
|
-
let rejector;
|
|
3878
|
-
let resolver;
|
|
3879
|
-
return new Promise((resolve, reject) => {
|
|
3880
|
-
rejector = reject;
|
|
3881
|
-
resolver = resolve;
|
|
3882
|
-
if (time === 0) settlePromise(abort, resolve, void 0, signal);
|
|
3883
|
-
else timer();
|
|
3884
|
-
});
|
|
3885
|
-
}
|
|
3886
|
-
//#endregion
|
|
3887
3887
|
//#region src/promise/index.ts
|
|
3888
3888
|
async function attemptPromise(value, options) {
|
|
3889
3889
|
const isFunction = typeof value === "function";
|
|
@@ -3932,7 +3932,7 @@ async function promises(items, options) {
|
|
|
3932
3932
|
reject,
|
|
3933
3933
|
resolve
|
|
3934
3934
|
};
|
|
3935
|
-
for (let index = 0; index < length; index += 1) actual[index].then((value) => handleResult
|
|
3935
|
+
for (let index = 0; index < length; index += 1) actual[index].then((value) => handleResult(PROMISE_TYPE_FULFILLED, {
|
|
3936
3936
|
abort,
|
|
3937
3937
|
complete,
|
|
3938
3938
|
data,
|
|
@@ -3940,7 +3940,7 @@ async function promises(items, options) {
|
|
|
3940
3940
|
index,
|
|
3941
3941
|
signal,
|
|
3942
3942
|
value
|
|
3943
|
-
})).catch((reason) => handleResult
|
|
3943
|
+
})).catch((reason) => handleResult(PROMISE_TYPE_REJECTED, {
|
|
3944
3944
|
abort,
|
|
3945
3945
|
complete,
|
|
3946
3946
|
data,
|
|
@@ -4187,11 +4187,11 @@ var Queue = class {
|
|
|
4187
4187
|
if (this.#paused) {
|
|
4188
4188
|
const paused = item;
|
|
4189
4189
|
this.#handled.push(() => {
|
|
4190
|
-
handleResult(paused, error, result);
|
|
4190
|
+
handleResult$1(paused, error, result);
|
|
4191
4191
|
});
|
|
4192
4192
|
break;
|
|
4193
4193
|
}
|
|
4194
|
-
handleResult(item, error, result);
|
|
4194
|
+
handleResult$1(item, error, result);
|
|
4195
4195
|
item = this.#items.shift();
|
|
4196
4196
|
}
|
|
4197
4197
|
this.#runners -= 1;
|
|
@@ -4217,7 +4217,7 @@ function getOptions(input) {
|
|
|
4217
4217
|
maximum: getNumberOrDefault(options.maximum, 0)
|
|
4218
4218
|
};
|
|
4219
4219
|
}
|
|
4220
|
-
function handleResult(item, error, result) {
|
|
4220
|
+
function handleResult$1(item, error, result) {
|
|
4221
4221
|
item.signal?.removeEventListener(EVENT_NAME, item.abort);
|
|
4222
4222
|
if (item.signal?.aborted ?? false) item.reject();
|
|
4223
4223
|
else if (error) item.reject(result);
|
|
@@ -4435,4 +4435,4 @@ var SizedSet = class extends Set {
|
|
|
4435
4435
|
}
|
|
4436
4436
|
};
|
|
4437
4437
|
//#endregion
|
|
4438
|
-
export { CancelablePromise, PromiseTimeoutError, QueueError, RetryError, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, SizedMap, SizedSet, assert, attempt, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, count, debounce, delay, diff, difference, drop, endsWith, endsWithArray, equal, error, exists, filter, find, flatten, floor, flow,
|
|
4438
|
+
export { CancelablePromise, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED, PromiseTimeoutError, QueueError, RetryError, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, SizedMap, SizedSet, assert, attempt, attemptFlow, attemptPipe, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, count, debounce, delay, diff, difference, drop, endsWith, endsWithArray, equal, error, exists, filter, find, flatten, floor, flow, fromQuery, toPromise as fromResult, toPromise, getArray, getArrayPosition, getColor, getError, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getTimedPromise, getUuid, getValue, groupBy, handleResult, hasValue, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, ignoreKey, includes, includesArray, indexOf, indexOfArray, insert, intersection, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isInstanceOf, isKey, isNonNullable, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, logger, lowerCase, matchResult, max, median, memoize, merge, min, move, noop, ok, omit, once, parse, partition, pascalCase, pick, pipe, promises, push, queue, range, retry, rgbToHex, rgbToHsl, rgbToHsla, round, select, setValue, settlePromise, shuffle, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toQuery, toRecord, toResult, toSet, toggle, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
|
package/dist/promise/index.d.mts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { Result } from "../result/models.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { toPromise } from "../result/misc.mjs";
|
|
4
|
-
import { delay } from "./delay.mjs";
|
|
5
|
-
import { isFulfilled, isRejected } from "./helpers.mjs";
|
|
6
|
-
import { cancelable, toResult } from "./misc.mjs";
|
|
7
|
-
import { timed } from "./timed.mjs";
|
|
2
|
+
import { PromiseOptions, PromisesItems, PromisesOptions, PromisesResult, PromisesUnwrapped, PromisesValue, PromisesValues } from "./models.mjs";
|
|
8
3
|
|
|
9
4
|
//#region src/promise/index.d.ts
|
|
10
5
|
/**
|
|
@@ -100,4 +95,4 @@ declare function resultPromises<Items extends unknown[]>(items: [...Items], sign
|
|
|
100
95
|
*/
|
|
101
96
|
declare function resultPromises<Value>(items: Promise<Value>[], signal?: AbortSignal): Promise<Result<Awaited<Value>>[]>;
|
|
102
97
|
//#endregion
|
|
103
|
-
export {
|
|
98
|
+
export { attemptPromise, promises };
|
package/dist/promise/index.mjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { getTimedPromise, timed } from "./timed.mjs";
|
|
6
|
-
import { delay } from "./delay.mjs";
|
|
1
|
+
import { PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED } from "./models.mjs";
|
|
2
|
+
import { getPromiseOptions, getPromisesOptions, getResultsFromPromises } from "./helpers.mjs";
|
|
3
|
+
import { handleResult, settlePromise } from "./misc.mjs";
|
|
4
|
+
import { getTimedPromise } from "./timed.mjs";
|
|
7
5
|
//#region src/promise/index.ts
|
|
8
6
|
async function attemptPromise(value, options) {
|
|
9
7
|
const isFunction = typeof value === "function";
|
|
@@ -76,4 +74,4 @@ async function resultPromises(items, signal) {
|
|
|
76
74
|
return promises(items, signal).then(getResultsFromPromises);
|
|
77
75
|
}
|
|
78
76
|
//#endregion
|
|
79
|
-
export {
|
|
77
|
+
export { attemptPromise, promises };
|
package/dist/promise/misc.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Result } from "../result/models.mjs";
|
|
2
2
|
import { CancelablePromise, PromiseParameters } from "./models.mjs";
|
|
3
|
+
import { toPromise } from "../result/misc.mjs";
|
|
4
|
+
import { isFulfilled, isRejected } from "./helpers.mjs";
|
|
3
5
|
|
|
4
6
|
//#region src/promise/misc.d.ts
|
|
5
7
|
/**
|
|
@@ -23,4 +25,4 @@ declare function toResult<Value>(callback: () => Promise<Value>): Promise<Result
|
|
|
23
25
|
*/
|
|
24
26
|
declare function toResult<Value>(promise: Promise<Value>): Promise<Result<Value>>;
|
|
25
27
|
//#endregion
|
|
26
|
-
export { cancelable, handleResult, settlePromise, toResult };
|
|
28
|
+
export { cancelable, toPromise as fromResult, handleResult, isFulfilled, isRejected, settlePromise, toResult };
|
package/dist/promise/misc.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { error, ok } from "../result/misc.mjs";
|
|
1
|
+
import { error, ok, toPromise } from "../result/misc.mjs";
|
|
2
2
|
import { CancelablePromise, PROMISE_ABORT_EVENT, PROMISE_MESSAGE_EXPECTATION_RESULT } from "./models.mjs";
|
|
3
|
+
import { isFulfilled, isRejected } from "./helpers.mjs";
|
|
3
4
|
//#region src/promise/misc.ts
|
|
4
5
|
/**
|
|
5
6
|
* Create a cancelable promise
|
|
@@ -35,4 +36,4 @@ async function toResult(value) {
|
|
|
35
36
|
return actual.then((result) => ok(result)).catch((reason) => error(reason));
|
|
36
37
|
}
|
|
37
38
|
//#endregion
|
|
38
|
-
export { cancelable, handleResult, settlePromise, toResult };
|
|
39
|
+
export { cancelable, toPromise as fromResult, handleResult, isFulfilled, isRejected, settlePromise, toResult };
|
package/dist/result/index.d.mts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { error, ok, toPromise, unwrap } from "./misc.mjs";
|
|
3
|
-
import { toResult } from "../promise/misc.mjs";
|
|
1
|
+
import { ExtendedResult, Result } from "./models.mjs";
|
|
4
2
|
import { attemptPromise } from "../promise/index.mjs";
|
|
5
3
|
import { matchResult } from "./match.mjs";
|
|
6
4
|
import { attemptFlow } from "./work/flow.mjs";
|
|
7
5
|
import { attemptPipe } from "./work/pipe.mjs";
|
|
8
|
-
import { isError, isOk, isResult } from "../internal/result.mjs";
|
|
9
6
|
|
|
10
7
|
//#region src/result/index.d.ts
|
|
11
8
|
/**
|
|
@@ -55,4 +52,4 @@ declare namespace attempt {
|
|
|
55
52
|
var promise: typeof attemptPromise;
|
|
56
53
|
}
|
|
57
54
|
//#endregion
|
|
58
|
-
export {
|
|
55
|
+
export { attempt };
|
package/dist/result/index.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { error, getError, ok, toPromise, unwrap } from "./misc.mjs";
|
|
3
|
-
import { toResult } from "../promise/misc.mjs";
|
|
1
|
+
import { getError, ok } from "./misc.mjs";
|
|
4
2
|
import { attemptPromise } from "../promise/index.mjs";
|
|
5
3
|
import { matchResult } from "./match.mjs";
|
|
6
4
|
import { attemptFlow } from "./work/flow.mjs";
|
|
@@ -28,4 +26,4 @@ attempt.match = matchResult;
|
|
|
28
26
|
attempt.pipe = attemptPipe;
|
|
29
27
|
attempt.promise = attemptPromise;
|
|
30
28
|
//#endregion
|
|
31
|
-
export { attempt
|
|
29
|
+
export { attempt };
|
package/dist/result/misc.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AnyResult, Err, ExtendedErr, Ok, Result } from "./models.mjs";
|
|
2
|
+
import { isError, isOk, isResult } from "../internal/result.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/result/misc.d.ts
|
|
4
5
|
/**
|
|
@@ -52,4 +53,4 @@ declare function unwrap<Value, E = Error>(value: Result<Value, E>, defaultValue:
|
|
|
52
53
|
*/
|
|
53
54
|
declare function unwrap(value: unknown, defaultValue: unknown): unknown;
|
|
54
55
|
//#endregion
|
|
55
|
-
export { error, getError, ok, toPromise, unwrap };
|
|
56
|
+
export { error, getError, isError, isOk, isResult, ok, toPromise, unwrap };
|
package/dist/result/misc.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isOk, isResult } from "../internal/result.mjs";
|
|
1
|
+
import { isError, isOk, isResult } from "../internal/result.mjs";
|
|
2
2
|
//#region src/result/misc.ts
|
|
3
3
|
function error(value, original) {
|
|
4
4
|
return getError(value, original);
|
|
@@ -39,4 +39,4 @@ function unwrap(value, defaultValue) {
|
|
|
39
39
|
}
|
|
40
40
|
const MESSAGE_PROMISE_RESULT = "toPromise expected to receive a Result";
|
|
41
41
|
//#endregion
|
|
42
|
-
export { error, getError, ok, toPromise, unwrap };
|
|
42
|
+
export { error, getError, isError, isOk, isResult, ok, toPromise, unwrap };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oscarpalmer/atoms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.167.0",
|
|
4
4
|
"description": "Atomic utilities for making your JavaScript better.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"helper",
|
|
@@ -111,10 +111,18 @@
|
|
|
111
111
|
"types": "./dist/promise/delay.d.mts",
|
|
112
112
|
"default": "./dist/promise/delay.mjs"
|
|
113
113
|
},
|
|
114
|
+
"./promise/misc": {
|
|
115
|
+
"types": "./dist/promise/misc.d.mts",
|
|
116
|
+
"default": "./dist/promise/misc.mjs"
|
|
117
|
+
},
|
|
114
118
|
"./promise/models": {
|
|
115
119
|
"types": "./dist/promise/models.d.mts",
|
|
116
120
|
"default": "./dist/promise/models.mjs"
|
|
117
121
|
},
|
|
122
|
+
"./promise/timed": {
|
|
123
|
+
"types": "./dist/promise/timed.d.mts",
|
|
124
|
+
"default": "./dist/promise/timed.mjs"
|
|
125
|
+
},
|
|
118
126
|
"./query": {
|
|
119
127
|
"types": "./dist/query.d.mts",
|
|
120
128
|
"default": "./dist/query.mjs"
|
|
@@ -131,6 +139,26 @@
|
|
|
131
139
|
"types": "./dist/result/index.d.mts",
|
|
132
140
|
"default": "./dist/result/index.mjs"
|
|
133
141
|
},
|
|
142
|
+
"./result/flow": {
|
|
143
|
+
"types": "./dist/result/work/flow.d.mts",
|
|
144
|
+
"default": "./dist/result/work/flow.mjs"
|
|
145
|
+
},
|
|
146
|
+
"./result/match": {
|
|
147
|
+
"types": "./dist/result/match.d.mts",
|
|
148
|
+
"default": "./dist/result/match.mjs"
|
|
149
|
+
},
|
|
150
|
+
"./result/misc": {
|
|
151
|
+
"types": "./dist/result/misc.d.mts",
|
|
152
|
+
"default": "./dist/result/misc.mjs"
|
|
153
|
+
},
|
|
154
|
+
"./result/models": {
|
|
155
|
+
"types": "./dist/result/models.d.mts",
|
|
156
|
+
"default": "./dist/result/models.mjs"
|
|
157
|
+
},
|
|
158
|
+
"./result/pipe": {
|
|
159
|
+
"types": "./dist/result/work/pipe.d.mts",
|
|
160
|
+
"default": "./dist/result/work/pipe.mjs"
|
|
161
|
+
},
|
|
134
162
|
"./sized/map": {
|
|
135
163
|
"types": "./dist/sized/map.d.mts",
|
|
136
164
|
"default": "./dist/sized/map.mjs"
|
|
@@ -203,4 +231,4 @@
|
|
|
203
231
|
"vitest": "npm:@voidzero-dev/vite-plus-test@latest"
|
|
204
232
|
},
|
|
205
233
|
"packageManager": "npm@11.11.1"
|
|
206
|
-
}
|
|
234
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -38,10 +38,19 @@ export * from './logger';
|
|
|
38
38
|
export * from './math';
|
|
39
39
|
export * from './models';
|
|
40
40
|
export * from './number';
|
|
41
|
+
export * from './promise/delay';
|
|
41
42
|
export * from './promise/index';
|
|
43
|
+
export * from './promise/misc';
|
|
44
|
+
export * from './promise/models';
|
|
45
|
+
export * from './promise/timed';
|
|
42
46
|
export * from './query';
|
|
43
47
|
export * from './queue';
|
|
44
48
|
export * from './random';
|
|
45
49
|
export * from './result/index';
|
|
50
|
+
export * from './result/match';
|
|
51
|
+
export * from './result/misc';
|
|
52
|
+
export * from './result/models';
|
|
53
|
+
export * from './result/work/flow';
|
|
54
|
+
export * from './result/work/pipe';
|
|
46
55
|
export * from './sized/map';
|
|
47
56
|
export * from './sized/set';
|
package/src/promise/index.ts
CHANGED
|
@@ -283,25 +283,3 @@ async function resultPromises(
|
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
// #endregion
|
|
286
|
-
|
|
287
|
-
// #region Exports
|
|
288
|
-
|
|
289
|
-
export {toPromise as fromResult} from '../result/misc';
|
|
290
|
-
export {delay} from './delay';
|
|
291
|
-
export {isFulfilled, isRejected} from './helpers';
|
|
292
|
-
export {cancelable, toResult} from './misc';
|
|
293
|
-
export {
|
|
294
|
-
CancelablePromise,
|
|
295
|
-
PromiseTimeoutError,
|
|
296
|
-
type FulfilledPromise,
|
|
297
|
-
type PromiseOptions,
|
|
298
|
-
type PromisesOptions,
|
|
299
|
-
type PromisesResult,
|
|
300
|
-
type PromiseStrategy,
|
|
301
|
-
type PromisesValues as PromisesValue,
|
|
302
|
-
type PromisesValue as PromisesValueItem,
|
|
303
|
-
type RejectedPromise,
|
|
304
|
-
} from './models';
|
|
305
|
-
export {timed} from './timed';
|
|
306
|
-
|
|
307
|
-
// #endregion
|
package/src/promise/misc.ts
CHANGED
package/src/result/index.ts
CHANGED
|
@@ -95,12 +95,3 @@ attempt.pipe = attemptPipe;
|
|
|
95
95
|
attempt.promise = attemptPromise;
|
|
96
96
|
|
|
97
97
|
// #endregion
|
|
98
|
-
|
|
99
|
-
// #region Exports
|
|
100
|
-
|
|
101
|
-
export {isError, isOk, isResult} from '../internal/result';
|
|
102
|
-
export {toResult as fromPromise} from '../promise/misc';
|
|
103
|
-
export {error, ok, toPromise, unwrap} from './misc';
|
|
104
|
-
export type {Err, ExtendedErr, ExtendedResult, Ok, Result} from './models';
|
|
105
|
-
|
|
106
|
-
// #endregion
|
package/src/result/misc.ts
CHANGED
|
@@ -113,3 +113,9 @@ export function unwrap(value: unknown, defaultValue: unknown): unknown {
|
|
|
113
113
|
const MESSAGE_PROMISE_RESULT = 'toPromise expected to receive a Result';
|
|
114
114
|
|
|
115
115
|
// #endregion
|
|
116
|
+
|
|
117
|
+
// #region Exports
|
|
118
|
+
|
|
119
|
+
export {isError, isOk, isResult} from '../internal/result';
|
|
120
|
+
|
|
121
|
+
// #endregion
|