cafe-utility 33.3.5 → 33.5.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/index.d.ts +34 -0
- package/index.js +600 -543
- package/module.mjs +1 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -213,6 +213,15 @@ declare function asUrl(
|
|
|
213
213
|
name: string
|
|
214
214
|
}
|
|
215
215
|
): string
|
|
216
|
+
declare function isBigint(value: any): boolean
|
|
217
|
+
declare function asBigint(
|
|
218
|
+
value: any,
|
|
219
|
+
options?: {
|
|
220
|
+
name?: string
|
|
221
|
+
min?: bigint
|
|
222
|
+
max?: bigint
|
|
223
|
+
}
|
|
224
|
+
): bigint
|
|
216
225
|
declare function isNullable(typeFn: (value: any) => boolean, value: any): boolean
|
|
217
226
|
declare function asNullable<T>(typeFn: (value: any) => T, value: any): T | null
|
|
218
227
|
declare function asEmptiable<T>(typeFn: (value: any) => T, value: any): T | undefined
|
|
@@ -674,6 +683,7 @@ export declare class FixedPointNumber {
|
|
|
674
683
|
value: bigint
|
|
675
684
|
scale: number
|
|
676
685
|
constructor(value: bigint | string | number, scale: number)
|
|
686
|
+
static cast(other: unknown): FixedPointNumber
|
|
677
687
|
static fromDecimalString(decimalString: string, scale: number): FixedPointNumber
|
|
678
688
|
add(other: FixedPointNumber): FixedPointNumber
|
|
679
689
|
subtract(other: FixedPointNumber): FixedPointNumber
|
|
@@ -756,6 +766,28 @@ export declare class RollingValueProvider<T> {
|
|
|
756
766
|
current(): T
|
|
757
767
|
next(): T
|
|
758
768
|
}
|
|
769
|
+
type SolverStatus = 'pending' | 'in-progress' | 'completed' | 'failed'
|
|
770
|
+
type SolverStepState = 'pending' | 'in-progress' | 'completed' | 'failed' | 'skipped'
|
|
771
|
+
interface SolverStep {
|
|
772
|
+
name: string
|
|
773
|
+
precondition?: (context: Map<string, unknown>) => Promise<boolean>
|
|
774
|
+
action: (context: Map<string, unknown>) => Promise<void>
|
|
775
|
+
transientSkipStepName?: string
|
|
776
|
+
}
|
|
777
|
+
export declare class Solver {
|
|
778
|
+
private status
|
|
779
|
+
private steps
|
|
780
|
+
private onStatusChange
|
|
781
|
+
private onStepChange
|
|
782
|
+
private onFinish
|
|
783
|
+
private onError
|
|
784
|
+
context: Map<string, unknown>
|
|
785
|
+
getStatus(): SolverStatus
|
|
786
|
+
createInitialState(): Record<string, SolverStepState>
|
|
787
|
+
setHooks(hooks: { onStatusChange?: (status: SolverStatus) => Promise<void>; onStepChange?: (state: Record<string, SolverStepState>) => Promise<void>; onFinish?: () => Promise<void>; onError?: (error: unknown) => Promise<void> }): void
|
|
788
|
+
addStep(step: SolverStep): void
|
|
789
|
+
execute(): Promise<Map<string, unknown>>
|
|
790
|
+
}
|
|
759
791
|
export declare const Binary: {
|
|
760
792
|
hexToUint8Array: typeof hexToUint8Array
|
|
761
793
|
uint8ArrayToHex: typeof uint8ArrayToHex
|
|
@@ -1016,6 +1048,7 @@ export declare const Types: {
|
|
|
1016
1048
|
isIntegerString: typeof isIntegerString
|
|
1017
1049
|
isHexString: typeof isHexString
|
|
1018
1050
|
isUrl: typeof isUrl
|
|
1051
|
+
isBigint: typeof isBigint
|
|
1019
1052
|
isNullable: typeof isNullable
|
|
1020
1053
|
asString: typeof asString
|
|
1021
1054
|
asHexString: typeof asHexString
|
|
@@ -1036,6 +1069,7 @@ export declare const Types: {
|
|
|
1036
1069
|
asStringMap: typeof asStringMap
|
|
1037
1070
|
asNumericDictionary: typeof asNumericDictionary
|
|
1038
1071
|
asUrl: typeof asUrl
|
|
1072
|
+
asBigint: typeof asBigint
|
|
1039
1073
|
asEmptiable: typeof asEmptiable
|
|
1040
1074
|
asNullable: typeof asNullable
|
|
1041
1075
|
asOptional: typeof asOptional
|