@bitblit/ratchet-common 4.0.1-alpha
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/lib/2d/line-2d.d.ts +5 -0
- package/lib/2d/plane-2d.d.ts +6 -0
- package/lib/2d/point-2d.d.ts +4 -0
- package/lib/2d/poly-line-2d.d.ts +4 -0
- package/lib/2d/ratchet-2d.d.ts +37 -0
- package/lib/2d/ratchet-2d.spec.d.ts +1 -0
- package/lib/build/build-information.d.ts +8 -0
- package/lib/build/ratchet-common-info.d.ts +5 -0
- package/lib/histogram/histogram-entry.d.ts +4 -0
- package/lib/histogram/histogram.d.ts +12 -0
- package/lib/histogram/histogram.spec.d.ts +1 -0
- package/lib/index.d.ts +73 -0
- package/lib/index.mjs +4 -0
- package/lib/index.mjs.map +1 -0
- package/lib/jwt/common-jwt-token.d.ts +6 -0
- package/lib/jwt/expired-jwt-handling.d.ts +5 -0
- package/lib/jwt/jwt-ratchet-like.d.ts +15 -0
- package/lib/jwt/jwt-ratchet.d.ts +30 -0
- package/lib/jwt/jwt-ratchet.spec.d.ts +1 -0
- package/lib/jwt/jwt-token-base.d.ts +9 -0
- package/lib/lang/array-ratchet.d.ts +14 -0
- package/lib/lang/array-ratchet.spec.d.ts +1 -0
- package/lib/lang/base64-ratchet.d.ts +10 -0
- package/lib/lang/base64-ratchet.spec.d.ts +1 -0
- package/lib/lang/boolean-ratchet.d.ts +7 -0
- package/lib/lang/boolean-ratchet.spec.d.ts +1 -0
- package/lib/lang/composite-last-success-provider.d.ts +7 -0
- package/lib/lang/composite-last-success-provider.spec.d.ts +1 -0
- package/lib/lang/date-ratchet.d.ts +11 -0
- package/lib/lang/date-ratchet.spec.d.ts +1 -0
- package/lib/lang/duration-ratchet.d.ts +7 -0
- package/lib/lang/duration-ratchet.spec.d.ts +1 -0
- package/lib/lang/enum-ratchet.d.ts +5 -0
- package/lib/lang/enum-ratchet.spec.d.ts +5 -0
- package/lib/lang/error-ratchet.d.ts +6 -0
- package/lib/lang/error-ratchet.spec.d.ts +1 -0
- package/lib/lang/esm-ratchet.d.ts +4 -0
- package/lib/lang/expiring-object.d.ts +20 -0
- package/lib/lang/expiring-object.spec.d.ts +1 -0
- package/lib/lang/geolocation-ratchet.d.ts +40 -0
- package/lib/lang/geolocation-ratchet.spec.d.ts +1 -0
- package/lib/lang/global-ratchet.d.ts +6 -0
- package/lib/lang/global-ratchet.spec.d.ts +1 -0
- package/lib/lang/key-value.d.ts +4 -0
- package/lib/lang/last-success-provider.d.ts +3 -0
- package/lib/lang/map-ratchet.d.ts +15 -0
- package/lib/lang/map-ratchet.spec.d.ts +1 -0
- package/lib/lang/no.d.ts +3 -0
- package/lib/lang/no.spec.d.ts +1 -0
- package/lib/lang/number-ratchet.d.ts +20 -0
- package/lib/lang/number-ratchet.spec.d.ts +1 -0
- package/lib/lang/parsed-url.d.ts +10 -0
- package/lib/lang/promise-ratchet.d.ts +18 -0
- package/lib/lang/promise-ratchet.spec.d.ts +1 -0
- package/lib/lang/require-ratchet.d.ts +11 -0
- package/lib/lang/require-ratchet.spec.d.ts +3 -0
- package/lib/lang/stop-watch.d.ts +17 -0
- package/lib/lang/string-ratchet.d.ts +28 -0
- package/lib/lang/string-ratchet.spec.d.ts +1 -0
- package/lib/lang/time-zone-ratchet.d.ts +19 -0
- package/lib/lang/time-zone-ratchet.spec.d.ts +1 -0
- package/lib/lang/timeout-token.d.ts +9 -0
- package/lib/lang/timeout-token.spec.d.ts +1 -0
- package/lib/lang/transform-ratchet.d.ts +7 -0
- package/lib/lang/transform-ratchet.spec.d.ts +1 -0
- package/lib/logger/classic-single-line-log-message-formatter.d.ts +6 -0
- package/lib/logger/log-message-builder.d.ts +14 -0
- package/lib/logger/log-message-format-type.d.ts +5 -0
- package/lib/logger/log-message-formatter.d.ts +5 -0
- package/lib/logger/log-message-processor.d.ts +5 -0
- package/lib/logger/log-message.d.ts +8 -0
- package/lib/logger/log-snapshot.d.ts +5 -0
- package/lib/logger/logger-instance.d.ts +46 -0
- package/lib/logger/logger-level-name.d.ts +8 -0
- package/lib/logger/logger-meta.d.ts +6 -0
- package/lib/logger/logger-options.d.ts +13 -0
- package/lib/logger/logger-output-function.d.ts +5 -0
- package/lib/logger/logger-ring-buffer.d.ts +18 -0
- package/lib/logger/logger-util.d.ts +8 -0
- package/lib/logger/logger-util.spec.d.ts +1 -0
- package/lib/logger/logger.d.ts +43 -0
- package/lib/logger/logger.spec.d.ts +1 -0
- package/lib/logger/none-log-message-formatter.d.ts +6 -0
- package/lib/logger/structured-json-log-message-formatter.d.ts +6 -0
- package/lib/network/browser-local-ip-provider.d.ts +7 -0
- package/lib/network/browser-local-ip-provider.spec.d.ts +1 -0
- package/lib/network/fixed-local-ip-provider.d.ts +6 -0
- package/lib/network/local-ip-provider.d.ts +3 -0
- package/lib/network/network-ratchet.d.ts +9 -0
- package/lib/network/network-ratchet.spec.d.ts +1 -0
- package/lib/stream/buffer-writable.d.ts +9 -0
- package/lib/stream/multi-stream.d.ts +7 -0
- package/lib/stream/stream-ratchet.d.ts +12 -0
- package/lib/stream/stream-ratchet.spec.d.ts +1 -0
- package/lib/stream/string-writable.d.ts +8 -0
- package/lib/stream/string-writable.spec.d.ts +1 -0
- package/lib/third-party/google/google-recaptcha-ratchet.d.ts +4 -0
- package/lib/third-party/google/google-recaptcha-ratchet.spec.d.ts +1 -0
- package/lib/third-party/twilio/twilio-ratchet.d.ts +11 -0
- package/lib/transform/built-in-transforms.d.ts +18 -0
- package/lib/transform/transform-rule.d.ts +3 -0
- package/lib/tx/transaction-configuration.d.ts +7 -0
- package/lib/tx/transaction-final-state.d.ts +5 -0
- package/lib/tx/transaction-ratchet.d.ts +6 -0
- package/lib/tx/transaction-ratchet.spec.d.ts +1 -0
- package/lib/tx/transaction-result.d.ts +9 -0
- package/lib/tx/transaction-step.d.ts +5 -0
- package/package.json +71 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JwtTokenBase } from './jwt-token-base.js';
|
|
2
|
+
import { LoggerLevelName } from '../logger/logger-level-name.js';
|
|
3
|
+
import { ExpiredJwtHandling } from './expired-jwt-handling.js';
|
|
4
|
+
export interface JwtRatchetLike {
|
|
5
|
+
get encryptionKeyPromise(): Promise<string | string[]>;
|
|
6
|
+
get decryptKeysPromise(): Promise<string[]>;
|
|
7
|
+
get jtiGenerator(): () => string;
|
|
8
|
+
get decryptOnlyKeyUseLogLevel(): LoggerLevelName;
|
|
9
|
+
get parseFailureLogLevel(): LoggerLevelName;
|
|
10
|
+
decodeToken<T extends JwtTokenBase>(payloadString: string, expiredHandling?: ExpiredJwtHandling): Promise<T>;
|
|
11
|
+
encryptionKeyArray(): Promise<string[]>;
|
|
12
|
+
selectRandomEncryptionKey(): Promise<string>;
|
|
13
|
+
createTokenString(payload: any, expirationSeconds?: number, overrideEncryptionKey?: string): Promise<string>;
|
|
14
|
+
refreshJWTString(tokenString: string, allowExpired?: boolean, expirationSeconds?: number): Promise<string>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { JwtTokenBase } from './jwt-token-base.js';
|
|
2
|
+
import { LoggerLevelName } from '../logger/logger-level-name.js';
|
|
3
|
+
import { ExpiredJwtHandling } from './expired-jwt-handling.js';
|
|
4
|
+
import { JwtRatchetLike } from './jwt-ratchet-like.js';
|
|
5
|
+
export declare class JwtRatchet implements JwtRatchetLike {
|
|
6
|
+
private _encryptionKeyPromise;
|
|
7
|
+
private _decryptKeysPromise?;
|
|
8
|
+
private _jtiGenerator;
|
|
9
|
+
private _decryptOnlyKeyUseLogLevel;
|
|
10
|
+
private _parseFailureLogLevel;
|
|
11
|
+
private static readonly EXPIRED_FLAG_NAME;
|
|
12
|
+
constructor(_encryptionKeyPromise: Promise<string | string[]>, _decryptKeysPromise?: Promise<string[]>, _jtiGenerator?: () => string, _decryptOnlyKeyUseLogLevel?: LoggerLevelName, _parseFailureLogLevel?: LoggerLevelName);
|
|
13
|
+
get encryptionKeyPromise(): Promise<string | string[]>;
|
|
14
|
+
get decryptKeysPromise(): Promise<string[]>;
|
|
15
|
+
get jtiGenerator(): () => string;
|
|
16
|
+
get decryptOnlyKeyUseLogLevel(): LoggerLevelName;
|
|
17
|
+
get parseFailureLogLevel(): LoggerLevelName;
|
|
18
|
+
static hasExpiredFlag(ob: any): boolean;
|
|
19
|
+
static invalidSafeDecode<T>(payloadString: string, decryptKey: string, logLevel?: LoggerLevelName): Promise<T>;
|
|
20
|
+
static secondsRemainingUntilExpiration(payloadString: string): Promise<number>;
|
|
21
|
+
static msRemainingUntilExpiration(payloadString: string): Promise<number>;
|
|
22
|
+
decodeToken<T extends JwtTokenBase>(payloadString: string, expiredHandling?: ExpiredJwtHandling): Promise<T>;
|
|
23
|
+
encryptionKeyArray(): Promise<string[]>;
|
|
24
|
+
selectRandomEncryptionKey(): Promise<string>;
|
|
25
|
+
createTokenString(payload: any, expirationSeconds?: number, overrideEncryptionKey?: string): Promise<string>;
|
|
26
|
+
refreshJWTString(tokenString: string, allowExpired?: boolean, expirationSeconds?: number): Promise<string>;
|
|
27
|
+
static decodeTokenNoVerify<T extends JwtTokenBase>(token: string): T;
|
|
28
|
+
static removeJwtFields(ob: any): void;
|
|
29
|
+
static removeExpiredFlag(ob: any): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class ArrayRatchet {
|
|
2
|
+
static wrapElementsInArray(input: any[]): any[][];
|
|
3
|
+
static compareTwoArrays<T>(ar1: T[], ar2: T[], fn: ComparisonFunction<T>): MatchReport<T>;
|
|
4
|
+
static extractSubarrayFromSortedByNumberField<T>(input: T[], fieldDotPath: string, minInclusive: number, maxExclusive: number): T[];
|
|
5
|
+
static findSplit(input: any[], fieldDotPath: string, target: number): number;
|
|
6
|
+
}
|
|
7
|
+
export interface ComparisonFunction<T> {
|
|
8
|
+
(t1: T, t2: T): number;
|
|
9
|
+
}
|
|
10
|
+
export interface MatchReport<T> {
|
|
11
|
+
matching: T[];
|
|
12
|
+
setOneOnly: T[];
|
|
13
|
+
setTwoOnly: T[];
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare class Base64Ratchet {
|
|
3
|
+
static safeObjectToBase64JSON(input: any): any;
|
|
4
|
+
static safeBase64JSONParse(input: string): any;
|
|
5
|
+
static generateBase64VersionOfBlob(blob: Blob): Promise<string>;
|
|
6
|
+
static generateBase64VersionOfString(input: string): string;
|
|
7
|
+
static generateBase64VersionOfBuffer(input: Buffer): string;
|
|
8
|
+
static base64StringToBuffer(input: string): Buffer;
|
|
9
|
+
static base64StringToString(input: string, encoding?: BufferEncoding): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class BooleanRatchet {
|
|
2
|
+
static allTrue(vals: boolean[], emptyArraysReturn?: boolean): boolean;
|
|
3
|
+
static anyTrue(vals: boolean[], emptyArraysReturn?: boolean): boolean;
|
|
4
|
+
static parseBool(val: any): boolean;
|
|
5
|
+
static intToBool(val: any): boolean;
|
|
6
|
+
static boolToInt(val: any): number;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LastSuccessProvider } from './last-success-provider.js';
|
|
2
|
+
export declare class CompositeLastSuccessProvider implements LastSuccessProvider {
|
|
3
|
+
private sources;
|
|
4
|
+
private mostRecent;
|
|
5
|
+
constructor(src: LastSuccessProvider[], mostRecentSrc?: boolean);
|
|
6
|
+
lastSuccess(): number;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class DateRatchet {
|
|
2
|
+
static COMMON_US_DATE_FORMAT: string;
|
|
3
|
+
static DEFAULT_DATE_FORMAT: string;
|
|
4
|
+
static FULL_DATE_FORMAT: string;
|
|
5
|
+
static PACIFIC_TIME_ZONE: string;
|
|
6
|
+
static UTC_TIME_ZONE: string;
|
|
7
|
+
static formatFullDate(input: Date): string;
|
|
8
|
+
static formatDefaultDateOnly(input: Date): string;
|
|
9
|
+
static parseDefaultDate(input: string): Date;
|
|
10
|
+
static parseCommonUsDate(input: string): Date;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DurationLike } from 'luxon';
|
|
2
|
+
export declare class DurationRatchet {
|
|
3
|
+
static formatMsDuration(ms: number, includeMS?: boolean): string;
|
|
4
|
+
static colonFormatMsDuration(ms: number, includeMS?: boolean): string;
|
|
5
|
+
static daysBetween(d1: Date, d2: Date): number;
|
|
6
|
+
static createSteps(startEpochMS: number, endEpochMS: number, timezone: string, outputFormat: string, stepUnit: DurationLike): string[];
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LoggerLevelName } from '../logger/logger-level-name.js';
|
|
2
|
+
export declare class ExpiringObject<T> {
|
|
3
|
+
private _config;
|
|
4
|
+
private _cacheObject;
|
|
5
|
+
private _lastUpdatedEpochMS;
|
|
6
|
+
private _timeRemainingMS;
|
|
7
|
+
constructor(inputConfig?: ExpiringObjectConfig<T>);
|
|
8
|
+
private defaultConfig;
|
|
9
|
+
private defaultTimeRemainingMS;
|
|
10
|
+
update(newValue: T, doNotUpdateClock?: boolean): void;
|
|
11
|
+
fetchCacheObjectTimeRemainingMS(): Promise<number>;
|
|
12
|
+
fetch(): Promise<T>;
|
|
13
|
+
}
|
|
14
|
+
export declare class ExpiringObjectConfig<T> {
|
|
15
|
+
timeToLiveMS?: number;
|
|
16
|
+
generator?: () => Promise<T>;
|
|
17
|
+
initialValue?: T;
|
|
18
|
+
logLevel?: LoggerLevelName;
|
|
19
|
+
overrideTimeRemainingMS?: (lastUpdatedEpochMS: number) => Promise<number>;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare class GeolocationRatchet {
|
|
2
|
+
private constructor();
|
|
3
|
+
static distanceBetweenLocations(lat1: number, lon1: number, lat2: number, lon2: number, unit?: string): number;
|
|
4
|
+
static distanceBetweenRatchetGeoLocations(loc1: RatchetGeoLocation, loc2: RatchetGeoLocation, unit?: string): number;
|
|
5
|
+
static degreeOfLatLngInMiles(latitudeInDecimalDegress?: number): number;
|
|
6
|
+
static milesInDegLatLng(miles: number, latitudeInDecimalDegress?: number): number;
|
|
7
|
+
static centerOfBounds(bounds: RatchetLocationBounds): RatchetGeoLocation;
|
|
8
|
+
private static calculateSplits;
|
|
9
|
+
static clusterGeoBounds(inputVal: RatchetLocationBounds[], latSlices?: number, lngSlices?: number): RatchetLocationBounds[];
|
|
10
|
+
static canonicalizeBounds(inp: RatchetLocationBounds, allowCrossover?: boolean): RatchetLocationBounds;
|
|
11
|
+
static combineBounds(inp: RatchetLocationBounds[]): RatchetLocationBounds;
|
|
12
|
+
static roundLocation(r: RatchetGeoLocation, roundDigits: number): RatchetGeoLocation;
|
|
13
|
+
static locationToBounds(loc: RatchetGeoLocation, radiusMiles: number): RatchetLocationBounds;
|
|
14
|
+
static sameLocation(loc1: RatchetGeoLocation, loc2: RatchetGeoLocation): boolean;
|
|
15
|
+
static pointInBounds(pt: RatchetGeoLocation, bound: RatchetLocationBounds): boolean;
|
|
16
|
+
static pointInAnyBound(pt: RatchetGeoLocation, inBounds: RatchetLocationBounds[], minPointsBeforeMapping?: number): boolean;
|
|
17
|
+
static pointInRatchetLocationBoundsMap(pt: RatchetGeoLocation, mp: RatchetLocationBoundsMap): boolean;
|
|
18
|
+
static findRatchetLocationBoundsMapEntry(pt: RatchetGeoLocation, mp: RatchetLocationBoundsMap): RatchetLocationBoundsMapEntry;
|
|
19
|
+
static buildRatchetLocationBoundsMap(inBounds: RatchetLocationBounds[]): RatchetLocationBoundsMap;
|
|
20
|
+
}
|
|
21
|
+
export interface RatchetGeoLocation {
|
|
22
|
+
lat: number;
|
|
23
|
+
lng: number;
|
|
24
|
+
}
|
|
25
|
+
export interface RatchetLocationBounds {
|
|
26
|
+
origin: RatchetGeoLocation;
|
|
27
|
+
extent: RatchetGeoLocation;
|
|
28
|
+
}
|
|
29
|
+
export interface RatchetLocationBoundsMap {
|
|
30
|
+
latOffset: number;
|
|
31
|
+
lngOffset: number;
|
|
32
|
+
maxLat: number;
|
|
33
|
+
maxLng: number;
|
|
34
|
+
mapping: RatchetLocationBoundsMapEntry[][];
|
|
35
|
+
}
|
|
36
|
+
export interface RatchetLocationBoundsMapEntry {
|
|
37
|
+
lat: number;
|
|
38
|
+
lng: number;
|
|
39
|
+
bounds: RatchetLocationBounds[];
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { KeyValue } from './key-value.js';
|
|
2
|
+
export declare class MapRatchet {
|
|
3
|
+
static expandNestedKeys<T>(src: any): T;
|
|
4
|
+
static mapByUniqueProperty<T, R>(input: T[], propName: string): Map<R, T>;
|
|
5
|
+
static groupByProperty<T, R>(input: T[], propName: string): Map<R, T[]>;
|
|
6
|
+
static findValue(toSearch: any, path: string[]): any;
|
|
7
|
+
static findValueDotPath(toSearch: any, dotPath: string): any;
|
|
8
|
+
static simpleDeepCompare(object1: any, object2: any): boolean;
|
|
9
|
+
static toKeyValueList(value: any): KeyValue[];
|
|
10
|
+
static fromKeyValueList(list: KeyValue[]): any;
|
|
11
|
+
static cleanup<T>(obj: T, stripZero?: boolean, stripNull?: boolean, stripUndefined?: boolean, stripEmptyString?: boolean): T;
|
|
12
|
+
static extractValueFromMapIgnoreCase(src: any, key: string): any;
|
|
13
|
+
static safeCallFunction(ob: any, fnName: string): boolean;
|
|
14
|
+
static caseInsensitiveAccess<T>(ob: any, keyName: string): T;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/lang/no.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class NumberRatchet {
|
|
2
|
+
private static MAX_LEADING_ZEROS_FORMAT_LENGTH;
|
|
3
|
+
static toFixedDecimalNumber(input: number | string, placesAfterPoint: number): number;
|
|
4
|
+
static leadingZeros(val: any, size: number): string;
|
|
5
|
+
static between(inTest: number, inP1: number, inP2: number): boolean;
|
|
6
|
+
static safeNumber(input: any, ifNotNumber?: number, useDefaultForNullAndUndefined?: boolean): number;
|
|
7
|
+
static numberCSVToList(inputCSV: string): number[];
|
|
8
|
+
static fitToWindow(val: number, b1: number, b2: number): number;
|
|
9
|
+
static groupNumbersIntoContiguousRanges(inputData: number[], minRangeSize?: number): SinglesAndRanges;
|
|
10
|
+
static distributeItemsEvenly(items: number, buckets: number): number[];
|
|
11
|
+
static createRange(minInclusive: number, maxExclusive: number, step?: number): number[];
|
|
12
|
+
}
|
|
13
|
+
export interface SinglesAndRanges {
|
|
14
|
+
singles: number[];
|
|
15
|
+
ranges: NumberRange[];
|
|
16
|
+
}
|
|
17
|
+
export interface NumberRange {
|
|
18
|
+
min: number;
|
|
19
|
+
max: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TimeoutToken } from './timeout-token.js';
|
|
2
|
+
import { LoggerLevelName } from '../logger/logger-level-name.js';
|
|
3
|
+
export declare class PromiseRatchet {
|
|
4
|
+
static resolveOnEvent<T>(evtSrc: any, okEvtNames: string[], errEvtNames?: string[], rval?: T): Promise<T>;
|
|
5
|
+
static timeout<T>(srcPromise: Promise<T>, title: string, timeoutMS: number): Promise<T | TimeoutToken>;
|
|
6
|
+
static createTimeoutPromise(title: string, timeoutMS: number): Promise<TimeoutToken>;
|
|
7
|
+
static wait(time: number): Promise<void>;
|
|
8
|
+
static dumpResult(result: any, autoDebug?: boolean): void;
|
|
9
|
+
static dumpError(err: any, autoDebug?: boolean): void;
|
|
10
|
+
static logErrorAndReturnNull(err: any, autoDebug?: boolean): void;
|
|
11
|
+
static runPromiseAndDump<T>(promise: Promise<T>): void;
|
|
12
|
+
static waitFor(testFunction: (n: number) => any, expectedValue: any, intervalMS: number, maxCycles: number, label?: string, count?: number): Promise<boolean>;
|
|
13
|
+
static runBoundedParallel<T>(promiseFn: Function, params: any[][], context: any, maxConcurrent?: number, logLevel?: LoggerLevelName): Promise<T[]>;
|
|
14
|
+
static runBoundedParallelSingleParam<T>(promiseFn: Function, params: any[], context: any, maxConcurrent?: number, logLevel?: LoggerLevelName): Promise<T[]>;
|
|
15
|
+
static asyncForEachSerial(array: any[], callback: Function): Promise<void>;
|
|
16
|
+
static asyncForEachParallel(array: any[], callback: Function): Promise<void>;
|
|
17
|
+
private constructor();
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class RequireRatchet {
|
|
2
|
+
static isNullOrUndefined(ob: any): boolean;
|
|
3
|
+
static notNullOrUndefined(ob: any, name?: string): void;
|
|
4
|
+
static notNullUndefinedOrOnlyWhitespaceString(ob: string, name?: string): void;
|
|
5
|
+
static notNullUndefinedOrEmptyArray(ob: any[], name?: string): void;
|
|
6
|
+
static equal(ob1: any, ob2: any, message?: string): void;
|
|
7
|
+
static true(ob: boolean, message?: string): void;
|
|
8
|
+
static noNullOrUndefinedValuesInArray(arr: any[], expectedLength?: number, customMsg?: string): void;
|
|
9
|
+
static noNullOrUndefinedValuesInRestArgs(expectedLength: number, ...restArgs: any[]): void;
|
|
10
|
+
static constructorArgumentsMatchLengthAndAreNonNull(): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LoggerLevelName } from '../logger/logger-level-name.js';
|
|
2
|
+
export declare class StopWatch {
|
|
3
|
+
private label;
|
|
4
|
+
private starts;
|
|
5
|
+
private ends;
|
|
6
|
+
private createTime;
|
|
7
|
+
constructor(label?: string);
|
|
8
|
+
start(name: string): number;
|
|
9
|
+
stop(name: string): number;
|
|
10
|
+
reset(name: string): void;
|
|
11
|
+
hasTimer(name: string): boolean;
|
|
12
|
+
log(name?: string, shortForm?: boolean, logLevel?: LoggerLevelName): void;
|
|
13
|
+
logExpected(pctComplete: number, name?: string, shortForm?: boolean, logLevel?: LoggerLevelName): void;
|
|
14
|
+
dump(name?: string, shortForm?: boolean): string;
|
|
15
|
+
dumpExpected(pctComplete: number, name?: string, shortForm?: boolean): string;
|
|
16
|
+
elapsedMS(name?: string): number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare class StringRatchet {
|
|
2
|
+
static RFC_3986_RESERVED: string[];
|
|
3
|
+
static stringToUint8Array(val: string): Uint8Array;
|
|
4
|
+
static uint8ArrayToString(val: Uint8Array): string;
|
|
5
|
+
static attemptJsonParse(val: string): any;
|
|
6
|
+
static canParseAsJson(val: string): boolean;
|
|
7
|
+
static allUnique(input: string): boolean;
|
|
8
|
+
static allPermutationsOfLength(len: number, alphabet: string): string[];
|
|
9
|
+
static createType4Guid(): string;
|
|
10
|
+
static createRandomHexString(len?: number): string;
|
|
11
|
+
static canonicalize(value: string): string;
|
|
12
|
+
static formatBytes(bytes: number, decimals?: number): string;
|
|
13
|
+
static safeString(input: any): string;
|
|
14
|
+
static stringContainsOnlyNumbers(input: string): boolean;
|
|
15
|
+
static stringContainsOnlyAlphanumeric(input: string): boolean;
|
|
16
|
+
static stringContainsOnlyHex(input: string): boolean;
|
|
17
|
+
static stringContainsOnly(inVal: string, validCharsIn: string): boolean;
|
|
18
|
+
static obscure(input: string, prefixLength?: number, suffixLength?: number): string;
|
|
19
|
+
static leadingZeros(inVal: any, size: number): string;
|
|
20
|
+
static trimToEmpty(input: string): string;
|
|
21
|
+
static trimToNull(input: string): string;
|
|
22
|
+
static trimAllStringPropertiesToNullInPlace<T>(input: T): T;
|
|
23
|
+
static trimAllStringPropertiesToEmptyInPlace<T>(input: T): T;
|
|
24
|
+
private static trimAllStringPropertiesInPlace;
|
|
25
|
+
static stripNonNumeric(input: string): string;
|
|
26
|
+
static csvSafe(input: any): string;
|
|
27
|
+
static stripNonAscii(value: string): string;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class TimeZoneRatchet {
|
|
2
|
+
static PACIFIC: TimeZoneRatchet;
|
|
3
|
+
private timezone;
|
|
4
|
+
constructor(timezone: string);
|
|
5
|
+
currentHour(): number;
|
|
6
|
+
private toEpochSeconds;
|
|
7
|
+
startOfTodayEpochSeconds(): number;
|
|
8
|
+
startOfMatchingDayEpochSeconds(inputTS: number): number;
|
|
9
|
+
startOfMatchingDayEpochMS(inputTS: number): number;
|
|
10
|
+
startOfCurrentHourEpochSeconds(): number;
|
|
11
|
+
startOfCurrentMinuteEpochSeconds(): number;
|
|
12
|
+
startOfCurrentSecondEpochSeconds(): number;
|
|
13
|
+
startOfTodayEpochMS(): number;
|
|
14
|
+
dailySlotCount(slotWidthMs: number): number;
|
|
15
|
+
currentTimeSlotIdx(slotWidthMs: number): number;
|
|
16
|
+
matchingTimeSlotIdx(timestamp: number, slotWidthMs: number): number;
|
|
17
|
+
startOfCurrentSlotEpochMS(slotWidthMs: number): number;
|
|
18
|
+
startOfMatchingSlotEpochMS(timestamp: number, slotWidthMs: number): number;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LoggerLevelName } from '../logger/logger-level-name.js';
|
|
2
|
+
export declare class TimeoutToken {
|
|
3
|
+
private title;
|
|
4
|
+
private timeoutMS;
|
|
5
|
+
private __timeoutTokenFlagField;
|
|
6
|
+
constructor(title: string, timeoutMS: number);
|
|
7
|
+
writeToLog(logLevel?: LoggerLevelName): void;
|
|
8
|
+
static isTimeoutToken(value: any): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TransformRule } from '../transform/transform-rule.js';
|
|
2
|
+
export declare class TransformRatchet {
|
|
3
|
+
static transform(toTransform: any, rules?: TransformRule[]): any;
|
|
4
|
+
private static transformGeneric;
|
|
5
|
+
private static applyTransformToObject;
|
|
6
|
+
private static applyTransformToPrimitive;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LogMessage } from './log-message.js';
|
|
2
|
+
import { LogMessageFormatter } from './log-message-formatter.js';
|
|
3
|
+
import { LoggerMeta } from './logger-meta.js';
|
|
4
|
+
export declare class ClassicSingleLineLogMessageFormatter implements LogMessageFormatter {
|
|
5
|
+
formatMessage(msg: LogMessage, meta: LoggerMeta): string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LoggerLevelName } from './logger-level-name.js';
|
|
2
|
+
import { LogMessage } from './log-message.js';
|
|
3
|
+
export declare class LogMessageBuilder {
|
|
4
|
+
private wrapped;
|
|
5
|
+
constructor(lvl: LoggerLevelName, messageSource?: string);
|
|
6
|
+
clone(): LogMessageBuilder;
|
|
7
|
+
level(lvl: LoggerLevelName): LogMessageBuilder;
|
|
8
|
+
timestamp(val: number): LogMessageBuilder;
|
|
9
|
+
messageSource(val: string): LogMessageBuilder;
|
|
10
|
+
subVars(val: any[]): LogMessageBuilder;
|
|
11
|
+
params(val: Record<string, string | number | boolean>): LogMessageBuilder;
|
|
12
|
+
p(name: string, value: string | number | boolean): LogMessageBuilder;
|
|
13
|
+
toMessage(): LogMessage;
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LogMessage } from './log-message.js';
|
|
2
|
+
import { LoggerOptions } from './logger-options.js';
|
|
3
|
+
import { LoggerRingBuffer } from './logger-ring-buffer.js';
|
|
4
|
+
import { LoggerLevelName } from './logger-level-name.js';
|
|
5
|
+
import { LogMessageBuilder } from './log-message-builder.js';
|
|
6
|
+
import { LogMessageProcessor } from './log-message-processor.js';
|
|
7
|
+
export declare class LoggerInstance {
|
|
8
|
+
private loggerInstanceName;
|
|
9
|
+
private _loggerMeta;
|
|
10
|
+
private _ringBuffer;
|
|
11
|
+
private _formatter;
|
|
12
|
+
private _level;
|
|
13
|
+
private _handlerFunctionMap;
|
|
14
|
+
private _options;
|
|
15
|
+
constructor(loggerInstanceName: string, inOptions: LoggerOptions);
|
|
16
|
+
addPreProcessor(proc: LogMessageProcessor): LogMessageProcessor[];
|
|
17
|
+
get ringBuffer(): LoggerRingBuffer;
|
|
18
|
+
dumpConfigurationIntoLog(): void;
|
|
19
|
+
dumpOptionsIntoLog(): void;
|
|
20
|
+
changeRingBufferSize(newSize: number): void;
|
|
21
|
+
updateTracePrefix(newValue: string): void;
|
|
22
|
+
get options(): LoggerOptions;
|
|
23
|
+
set options(newOpts: LoggerOptions);
|
|
24
|
+
get level(): LoggerLevelName;
|
|
25
|
+
set level(newLevel: LoggerLevelName);
|
|
26
|
+
consoleLogPassThru(level: LoggerLevelName, ...input: any[]): void;
|
|
27
|
+
createLogMessage(level: LoggerLevelName, params: Record<string, string>, format: string, ...input: any[]): LogMessage;
|
|
28
|
+
formatMessage(msg: LogMessage): string;
|
|
29
|
+
formatMessages(msgs: LogMessage[]): string[];
|
|
30
|
+
recordMessageBuilder(msgBuild: LogMessageBuilder): string;
|
|
31
|
+
recordMessage(inMsg: LogMessage): string;
|
|
32
|
+
error(format: string, ...input: any[]): string;
|
|
33
|
+
errorP(...input: any[]): void;
|
|
34
|
+
warn(format: string, ...input: any[]): string;
|
|
35
|
+
warnP(...input: any[]): void;
|
|
36
|
+
info(format: string, ...input: any[]): string;
|
|
37
|
+
infoP(...input: any[]): void;
|
|
38
|
+
verbose(format: string, ...input: any[]): string;
|
|
39
|
+
verboseP(...input: any[]): void;
|
|
40
|
+
debug(format: string, ...input: any[]): string;
|
|
41
|
+
debugP(...input: any[]): void;
|
|
42
|
+
silly(format: string, ...input: any[]): string;
|
|
43
|
+
sillyP(...input: any[]): void;
|
|
44
|
+
logByLevel(level: LoggerLevelName, format: string, ...input: any[]): void;
|
|
45
|
+
importMessages(msgs: LogMessage[], prefixIn?: string, addTimestamp?: boolean): void;
|
|
46
|
+
}
|