@getriebe/process-values
Represent and validate scalar process data and typed values.
Source revision 49560371f6cd34d30383df5619df46969c594ae4.
bindMessagePayload
Section titled “bindMessagePayload”export declare function bindMessagePayload(values: ProcessData, bindings: readonly MessageBinding[]): ProcessData;calculate
Section titled “calculate”export declare function calculate(operation: NumericOperation, left: NumericValue, right: NumericValue): NumericValue;compareNumbers
Section titled “compareNumbers”export declare function compareNumbers(left: NumericValue, right: NumericValue): -1 | 0 | 1;DECIMAL_INTEGER_DIGITS
Section titled “DECIMAL_INTEGER_DIGITS”export declare const DECIMAL_INTEGER_DIGITS = 128;DECIMAL_SCALE
Section titled “DECIMAL_SCALE”export declare const DECIMAL_SCALE = 128;DecimalRounding
Section titled “DecimalRounding”export type DecimalRounding = "HALF_UP" | "HALF_EVEN";DecimalValue
Section titled “DecimalValue”export type DecimalValue = Readonly<{ kind: "decimal"; value: string; [validNumber]: true;}>;decodeMessagePayload
Section titled “decodeMessagePayload”export declare function decodeMessagePayload(contract: MessageContract, payload: unknown): ProcessData;decodeProcessData
Section titled “decodeProcessData”export declare function decodeProcessData(fields: Readonly<Record<string, ValueKind>>, input: unknown): ProcessData;decodeProcessValue
Section titled “decodeProcessValue”export declare function decodeProcessValue<K extends ValueKind>(kind: K, input: unknown): Extract<ProcessValue, { kind: K;}>;divideRounded
Section titled “divideRounded”export declare function divideRounded(left: NumericValue, right: NumericValue, scale: number, mode: DecimalRounding): DecimalValue;EncodedProcessValue
Section titled “EncodedProcessValue”export type EncodedProcessValue = string | boolean | readonly string[] | readonly boolean[];encodeProcessValue
Section titled “encodeProcessValue”export declare function encodeProcessValue(value: ProcessValue): EncodedProcessValue;LONG_MAX
Section titled “LONG_MAX”export declare const LONG_MAX: bigint;LONG_MIN
Section titled “LONG_MIN”export declare const LONG_MIN: bigint;longValue
Section titled “longValue”export declare function longValue(value: bigint): LongValue;LongValue
Section titled “LongValue”export type LongValue = Readonly<{ kind: "long"; value: bigint; [validNumber]: true;}>;MAX_TIMER_DURATION_MS
Section titled “MAX_TIMER_DURATION_MS”export declare const MAX_TIMER_DURATION_MS: number;MAX_UTC_TIMESTAMP_MS
Section titled “MAX_UTC_TIMESTAMP_MS”export declare const MAX_UTC_TIMESTAMP_MS = 253402300799999;MessageBinding
Section titled “MessageBinding”export interface MessageBinding { readonly field: string; readonly target: string;}MessageContract
Section titled “MessageContract”export interface MessageContract { readonly type: MessageType; readonly fields: Readonly<Record<string, MessageField>>;}MessageField
Section titled “MessageField”export interface MessageField { readonly kind: ScalarKind; readonly required: boolean;}MessageType
Section titled “MessageType”export interface MessageType { readonly namespace: string; readonly id: string;}messageTypeKey
Section titled “messageTypeKey”export declare function messageTypeKey({ namespace, id }: MessageType): string;MIN_UTC_TIMESTAMP_MS
Section titled “MIN_UTC_TIMESTAMP_MS”export declare const MIN_UTC_TIMESTAMP_MS = -62135596800000;NumericValue
Section titled “NumericValue”export type NumericValue = LongValue | DecimalValue;ProcessData
Section titled “ProcessData”export type ProcessData = Readonly<Partial<Record<string, ProcessValue>>>;ProcessValue
Section titled “ProcessValue”export type ProcessValue = NumericValue | Readonly<{ kind: "string"; value: string;}> | Readonly<{ kind: "boolean"; value: boolean;}> | Readonly<{ kind: "string-list"; value: readonly string[];}> | Readonly<{ kind: "boolean-list"; value: readonly boolean[];}>;ScalarKind
Section titled “ScalarKind”export type ScalarKind = "string" | "boolean" | "long" | "decimal";ValueError
Section titled “ValueError”export declare class ValueError extends Error { readonly code: ValueErrorCode; constructor(code: ValueErrorCode, message: string);}ValueErrorCode
Section titled “ValueErrorCode”export type ValueErrorCode = "invalid_value" | "out_of_range" | "division_by_zero" | "inexact_division";ValueKind
Section titled “ValueKind”export type ValueKind = ScalarKind | "string-list" | "boolean-list";