cafe-utility 33.4.0 → 33.6.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 (4) hide show
  1. package/index.d.ts +29 -2
  2. package/index.js +579 -547
  3. package/module.mjs +1 -0
  4. 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
@@ -760,8 +770,8 @@ type SolverStatus = 'pending' | 'in-progress' | 'completed' | 'failed'
760
770
  type SolverStepState = 'pending' | 'in-progress' | 'completed' | 'failed' | 'skipped'
761
771
  interface SolverStep {
762
772
  name: string
763
- precondition: (context: Map<string, unknown>) => Promise<boolean>
764
- action: (stepName: string, context: Map<string, unknown>) => Promise<void>
773
+ precondition?: (context: Map<string, unknown>) => Promise<boolean>
774
+ action: (context: Map<string, unknown>) => Promise<void>
765
775
  transientSkipStepName?: string
766
776
  }
767
777
  export declare class Solver {
@@ -778,6 +788,21 @@ export declare class Solver {
778
788
  addStep(step: SolverStep): void
779
789
  execute(): Promise<Map<string, unknown>>
780
790
  }
791
+ interface LockOptions {
792
+ queryFunction: () => Promise<string>
793
+ lockFunction: (storable: string) => Promise<void>
794
+ unlockFunction: () => Promise<void>
795
+ timeoutMillis: number
796
+ }
797
+ export declare class Lock {
798
+ private queryFunction
799
+ private lockFunction
800
+ private unlockFunction
801
+ private timeoutMillis
802
+ constructor(options: LockOptions)
803
+ couldLock(): Promise<true | Date>
804
+ unlock(): Promise<void>
805
+ }
781
806
  export declare const Binary: {
782
807
  hexToUint8Array: typeof hexToUint8Array
783
808
  uint8ArrayToHex: typeof uint8ArrayToHex
@@ -1038,6 +1063,7 @@ export declare const Types: {
1038
1063
  isIntegerString: typeof isIntegerString
1039
1064
  isHexString: typeof isHexString
1040
1065
  isUrl: typeof isUrl
1066
+ isBigint: typeof isBigint
1041
1067
  isNullable: typeof isNullable
1042
1068
  asString: typeof asString
1043
1069
  asHexString: typeof asHexString
@@ -1058,6 +1084,7 @@ export declare const Types: {
1058
1084
  asStringMap: typeof asStringMap
1059
1085
  asNumericDictionary: typeof asNumericDictionary
1060
1086
  asUrl: typeof asUrl
1087
+ asBigint: typeof asBigint
1061
1088
  asEmptiable: typeof asEmptiable
1062
1089
  asNullable: typeof asNullable
1063
1090
  asOptional: typeof asOptional