@bitblit/ratchet-common 4.0.80-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/dist/cjs/2d/line-2d.js +2 -0
- package/dist/cjs/2d/plane-2d.js +2 -0
- package/dist/cjs/2d/point-2d.js +2 -0
- package/dist/cjs/2d/poly-line-2d.js +2 -0
- package/dist/cjs/2d/ratchet-2d.js +250 -0
- package/dist/cjs/build/build-information.js +2 -0
- package/dist/cjs/build/ratchet-common-info.js +18 -0
- package/dist/cjs/histogram/histogram-entry.js +2 -0
- package/dist/cjs/histogram/histogram.js +54 -0
- package/dist/cjs/index.js +74 -0
- package/dist/cjs/jwt/common-jwt-token.js +2 -0
- package/dist/cjs/jwt/expired-jwt-handling.js +9 -0
- package/dist/cjs/jwt/jwt-ratchet-like.js +2 -0
- package/dist/cjs/jwt/jwt-ratchet.js +164 -0
- package/dist/cjs/jwt/jwt-token-base.js +2 -0
- package/dist/cjs/lang/array-ratchet.js +87 -0
- package/dist/cjs/lang/base64-ratchet.js +49 -0
- package/dist/cjs/lang/boolean-ratchet.js +49 -0
- package/dist/cjs/lang/composite-last-success-provider.js +28 -0
- package/dist/cjs/lang/date-ratchet.js +33 -0
- package/dist/cjs/lang/duration-ratchet.js +46 -0
- package/dist/cjs/lang/enum-ratchet.js +34 -0
- package/dist/cjs/lang/error-ratchet.js +49 -0
- package/dist/cjs/lang/expiring-object.js +68 -0
- package/dist/cjs/lang/geolocation-ratchet.js +267 -0
- package/dist/cjs/lang/global-ratchet.js +48 -0
- package/dist/cjs/lang/key-value.js +6 -0
- package/dist/cjs/lang/last-success-provider.js +2 -0
- package/dist/cjs/lang/map-ratchet.js +168 -0
- package/dist/cjs/lang/no.js +8 -0
- package/dist/cjs/lang/number-ratchet.js +156 -0
- package/dist/cjs/lang/parsed-url.js +2 -0
- package/dist/cjs/lang/promise-ratchet.js +142 -0
- package/dist/cjs/lang/require-ratchet.js +60 -0
- package/dist/cjs/lang/stop-watch.js +117 -0
- package/dist/cjs/lang/string-ratchet.js +195 -0
- package/dist/cjs/lang/time-zone-ratchet.js +80 -0
- package/dist/cjs/lang/timeout-token.js +19 -0
- package/dist/cjs/lang/transform-ratchet.js +70 -0
- package/dist/cjs/logger/classic-single-line-log-message-formatter.js +18 -0
- package/dist/cjs/logger/log-message-builder.js +51 -0
- package/dist/cjs/logger/log-message-format-type.js +9 -0
- package/dist/cjs/logger/log-message-formatter.js +2 -0
- package/dist/cjs/logger/log-message-processor.js +2 -0
- package/dist/cjs/logger/log-message.js +2 -0
- package/dist/cjs/logger/log-snapshot.js +2 -0
- package/dist/cjs/logger/logger-instance.js +207 -0
- package/dist/cjs/logger/logger-level-name.js +12 -0
- package/dist/cjs/logger/logger-meta.js +2 -0
- package/dist/cjs/logger/logger-options.js +2 -0
- package/dist/cjs/logger/logger-output-function.js +9 -0
- package/dist/cjs/logger/logger-ring-buffer.js +76 -0
- package/dist/cjs/logger/logger-util.js +49 -0
- package/dist/cjs/logger/logger.js +139 -0
- package/dist/cjs/logger/none-log-message-formatter.js +9 -0
- package/dist/cjs/logger/structured-json-log-message-formatter.js +24 -0
- package/dist/cjs/network/browser-local-ip-provider.js +25 -0
- package/dist/cjs/network/fixed-local-ip-provider.js +12 -0
- package/dist/cjs/network/local-ip-provider.js +2 -0
- package/dist/cjs/network/network-ratchet.js +106 -0
- package/dist/cjs/stream/buffer-writable.js +20 -0
- package/dist/cjs/stream/stream-ratchet.js +72 -0
- package/dist/cjs/stream/string-writable.js +18 -0
- package/dist/cjs/third-party/google/google-recaptcha-ratchet.js +33 -0
- package/dist/cjs/third-party/twilio/twilio-ratchet.js +75 -0
- package/dist/cjs/transform/built-in-transforms.js +195 -0
- package/dist/cjs/transform/transform-rule.js +2 -0
- package/dist/cjs/tx/transaction-configuration.js +2 -0
- package/dist/cjs/tx/transaction-final-state.js +9 -0
- package/dist/cjs/tx/transaction-ratchet.js +80 -0
- package/dist/cjs/tx/transaction-result.js +2 -0
- package/dist/cjs/tx/transaction-step.js +2 -0
- package/dist/es/2d/line-2d.js +1 -0
- package/dist/es/2d/plane-2d.js +1 -0
- package/dist/es/2d/point-2d.js +1 -0
- package/dist/es/2d/poly-line-2d.js +1 -0
- package/dist/es/2d/ratchet-2d.js +245 -0
- package/dist/es/build/build-information.js +1 -0
- package/dist/es/build/ratchet-common-info.js +14 -0
- package/dist/es/histogram/histogram-entry.js +1 -0
- package/dist/es/histogram/histogram.js +50 -0
- package/dist/es/index.js +71 -0
- package/dist/es/jwt/common-jwt-token.js +1 -0
- package/dist/es/jwt/expired-jwt-handling.js +6 -0
- package/dist/es/jwt/jwt-ratchet-like.js +1 -0
- package/dist/es/jwt/jwt-ratchet.js +159 -0
- package/dist/es/jwt/jwt-token-base.js +1 -0
- package/dist/es/lang/array-ratchet.js +83 -0
- package/dist/es/lang/base64-ratchet.js +45 -0
- package/dist/es/lang/boolean-ratchet.js +45 -0
- package/dist/es/lang/composite-last-success-provider.js +24 -0
- package/dist/es/lang/date-ratchet.js +29 -0
- package/dist/es/lang/duration-ratchet.js +42 -0
- package/dist/es/lang/enum-ratchet.js +30 -0
- package/dist/es/lang/error-ratchet.js +44 -0
- package/dist/es/lang/expiring-object.js +63 -0
- package/dist/es/lang/geolocation-ratchet.js +263 -0
- package/dist/es/lang/global-ratchet.js +43 -0
- package/dist/es/lang/key-value.js +2 -0
- package/dist/es/lang/last-success-provider.js +1 -0
- package/dist/es/lang/map-ratchet.js +164 -0
- package/dist/es/lang/no.js +4 -0
- package/dist/es/lang/number-ratchet.js +152 -0
- package/dist/es/lang/parsed-url.js +1 -0
- package/dist/es/lang/promise-ratchet.js +138 -0
- package/dist/es/lang/require-ratchet.js +56 -0
- package/dist/es/lang/stop-watch.js +113 -0
- package/dist/es/lang/string-ratchet.js +191 -0
- package/dist/es/lang/time-zone-ratchet.js +76 -0
- package/dist/es/lang/timeout-token.js +15 -0
- package/dist/es/lang/transform-ratchet.js +66 -0
- package/dist/es/logger/classic-single-line-log-message-formatter.js +13 -0
- package/dist/es/logger/log-message-builder.js +47 -0
- package/dist/es/logger/log-message-format-type.js +6 -0
- package/dist/es/logger/log-message-formatter.js +1 -0
- package/dist/es/logger/log-message-processor.js +1 -0
- package/dist/es/logger/log-message.js +1 -0
- package/dist/es/logger/log-snapshot.js +1 -0
- package/dist/es/logger/logger-instance.js +201 -0
- package/dist/es/logger/logger-level-name.js +9 -0
- package/dist/es/logger/logger-meta.js +1 -0
- package/dist/es/logger/logger-options.js +1 -0
- package/dist/es/logger/logger-output-function.js +6 -0
- package/dist/es/logger/logger-ring-buffer.js +72 -0
- package/dist/es/logger/logger-util.js +44 -0
- package/dist/es/logger/logger.js +134 -0
- package/dist/es/logger/none-log-message-formatter.js +5 -0
- package/dist/es/logger/structured-json-log-message-formatter.js +19 -0
- package/dist/es/network/browser-local-ip-provider.js +21 -0
- package/dist/es/network/fixed-local-ip-provider.js +8 -0
- package/dist/es/network/local-ip-provider.js +1 -0
- package/dist/es/network/network-ratchet.js +102 -0
- package/dist/es/stream/buffer-writable.js +16 -0
- package/dist/es/stream/stream-ratchet.js +68 -0
- package/dist/es/stream/string-writable.js +14 -0
- package/dist/es/third-party/google/google-recaptcha-ratchet.js +28 -0
- package/dist/es/third-party/twilio/twilio-ratchet.js +70 -0
- package/dist/es/transform/built-in-transforms.js +191 -0
- package/dist/es/transform/transform-rule.js +1 -0
- package/dist/es/tx/transaction-configuration.js +1 -0
- package/dist/es/tx/transaction-final-state.js +6 -0
- package/dist/es/tx/transaction-ratchet.js +76 -0
- package/dist/es/tx/transaction-result.js +1 -0
- package/dist/es/tx/transaction-step.js +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.es.tsbuildinfo +1 -0
- package/dist/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/2d/line-2d.d.ts +5 -0
- package/dist/types/2d/plane-2d.d.ts +6 -0
- package/dist/types/2d/point-2d.d.ts +4 -0
- package/dist/types/2d/poly-line-2d.d.ts +4 -0
- package/dist/types/2d/ratchet-2d.d.ts +37 -0
- package/dist/types/build/build-information.d.ts +8 -0
- package/dist/types/build/ratchet-common-info.d.ts +5 -0
- package/dist/types/histogram/histogram-entry.d.ts +4 -0
- package/dist/types/histogram/histogram.d.ts +15 -0
- package/dist/types/index.d.ts +74 -0
- package/dist/types/jwt/common-jwt-token.d.ts +17 -0
- package/dist/types/jwt/expired-jwt-handling.d.ts +5 -0
- package/dist/types/jwt/jwt-ratchet-like.d.ts +18 -0
- package/dist/types/jwt/jwt-ratchet.d.ts +39 -0
- package/dist/types/jwt/jwt-token-base.d.ts +13 -0
- package/dist/types/lang/array-ratchet.d.ts +30 -0
- package/dist/types/lang/base64-ratchet.d.ts +10 -0
- package/dist/types/lang/boolean-ratchet.d.ts +7 -0
- package/dist/types/lang/composite-last-success-provider.d.ts +8 -0
- package/dist/types/lang/date-ratchet.d.ts +11 -0
- package/dist/types/lang/duration-ratchet.d.ts +7 -0
- package/dist/types/lang/enum-ratchet.d.ts +12 -0
- package/dist/types/lang/error-ratchet.d.ts +6 -0
- package/dist/types/lang/expiring-object.d.ts +20 -0
- package/dist/types/lang/geolocation-ratchet.d.ts +40 -0
- package/dist/types/lang/global-ratchet.d.ts +6 -0
- package/dist/types/lang/key-value.d.ts +4 -0
- package/dist/types/lang/last-success-provider.d.ts +4 -0
- package/dist/types/lang/map-ratchet.d.ts +15 -0
- package/dist/types/lang/no.d.ts +3 -0
- package/dist/types/lang/number-ratchet.d.ts +20 -0
- package/dist/types/lang/parsed-url.d.ts +10 -0
- package/dist/types/lang/promise-ratchet.d.ts +32 -0
- package/dist/types/lang/require-ratchet.d.ts +11 -0
- package/dist/types/lang/stop-watch.d.ts +17 -0
- package/dist/types/lang/string-ratchet.d.ts +27 -0
- package/dist/types/lang/time-zone-ratchet.d.ts +50 -0
- package/dist/types/lang/timeout-token.d.ts +9 -0
- package/dist/types/lang/transform-ratchet.d.ts +7 -0
- package/dist/types/logger/classic-single-line-log-message-formatter.d.ts +6 -0
- package/dist/types/logger/log-message-builder.d.ts +14 -0
- package/dist/types/logger/log-message-format-type.d.ts +5 -0
- package/dist/types/logger/log-message-formatter.d.ts +5 -0
- package/dist/types/logger/log-message-processor.d.ts +5 -0
- package/dist/types/logger/log-message.d.ts +8 -0
- package/dist/types/logger/log-snapshot.d.ts +5 -0
- package/dist/types/logger/logger-instance.d.ts +46 -0
- package/dist/types/logger/logger-level-name.d.ts +8 -0
- package/dist/types/logger/logger-meta.d.ts +6 -0
- package/dist/types/logger/logger-options.d.ts +13 -0
- package/dist/types/logger/logger-output-function.d.ts +5 -0
- package/dist/types/logger/logger-ring-buffer.d.ts +18 -0
- package/dist/types/logger/logger-util.d.ts +8 -0
- package/dist/types/logger/logger.d.ts +52 -0
- package/dist/types/logger/none-log-message-formatter.d.ts +6 -0
- package/dist/types/logger/structured-json-log-message-formatter.d.ts +6 -0
- package/dist/types/network/browser-local-ip-provider.d.ts +7 -0
- package/dist/types/network/fixed-local-ip-provider.d.ts +6 -0
- package/dist/types/network/local-ip-provider.d.ts +4 -0
- package/dist/types/network/network-ratchet.d.ts +9 -0
- package/dist/types/stream/buffer-writable.d.ts +9 -0
- package/dist/types/stream/stream-ratchet.d.ts +12 -0
- package/dist/types/stream/string-writable.d.ts +8 -0
- package/dist/types/third-party/google/google-recaptcha-ratchet.d.ts +4 -0
- package/dist/types/third-party/twilio/twilio-ratchet.d.ts +15 -0
- package/dist/types/transform/built-in-transforms.d.ts +18 -0
- package/dist/types/transform/transform-rule.d.ts +3 -0
- package/dist/types/tx/transaction-configuration.d.ts +7 -0
- package/dist/types/tx/transaction-final-state.d.ts +5 -0
- package/dist/types/tx/transaction-ratchet.d.ts +6 -0
- package/dist/types/tx/transaction-result.d.ts +9 -0
- package/dist/types/tx/transaction-step.d.ts +5 -0
- package/package.json +65 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { KeyValue } from './key-value';
|
|
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,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): 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,32 @@
|
|
|
1
|
+
import { TimeoutToken } from './timeout-token';
|
|
2
|
+
import { LoggerLevelName } from '../logger/logger-level-name';
|
|
3
|
+
export declare class PromiseRatchet {
|
|
4
|
+
/**
|
|
5
|
+
* Returns a promise that only resolves when the named event happens on the event source -
|
|
6
|
+
* the promise will return the passed object, if any, at that point. If errEventNames are specified,
|
|
7
|
+
* the promise will reject when any of those events are fired
|
|
8
|
+
* @param evtSrc Object that will fire the event
|
|
9
|
+
* @param okEvtNames Names of the event that will be considered successes
|
|
10
|
+
* @param errEventNames Names of error events
|
|
11
|
+
* @param rval Return value, if any
|
|
12
|
+
*/
|
|
13
|
+
static resolveOnEvent<T>(evtSrc: any, okEvtNames: string[], errEvtNames?: string[], rval?: T): Promise<T>;
|
|
14
|
+
static timeout<T>(srcPromise: Promise<T>, title: string, timeoutMS: number): Promise<T | TimeoutToken>;
|
|
15
|
+
static createTimeoutPromise(title: string, timeoutMS: number): Promise<TimeoutToken>;
|
|
16
|
+
static wait(time: number): Promise<void>;
|
|
17
|
+
static dumpResult(result: any, autoDebug?: boolean): void;
|
|
18
|
+
static dumpError(err: any, autoDebug?: boolean): void;
|
|
19
|
+
static logErrorAndReturnNull(err: any, autoDebug?: boolean): void;
|
|
20
|
+
static runPromiseAndDump<T>(promise: Promise<T>): void;
|
|
21
|
+
static waitFor(testFunction: (n: number) => any, expectedValue: any, // eslint-disable-line @typescript-eslint/explicit-module-boundary-types
|
|
22
|
+
intervalMS: number, maxCycles: number, label?: string, count?: number): Promise<boolean>;
|
|
23
|
+
static runBoundedParallel<T>(promiseFn: Function, // eslint-disable-line @typescript-eslint/ban-types
|
|
24
|
+
params: any[][], context: any, // eslint-disable-line @typescript-eslint/explicit-module-boundary-types
|
|
25
|
+
maxConcurrent?: number, logLevel?: LoggerLevelName): Promise<T[]>;
|
|
26
|
+
static runBoundedParallelSingleParam<T>(promiseFn: Function, // eslint-disable-line @typescript-eslint/ban-types
|
|
27
|
+
params: any[], context: any, // eslint-disable-line @typescript-eslint/explicit-module-boundary-types
|
|
28
|
+
maxConcurrent?: number, logLevel?: LoggerLevelName): Promise<T[]>;
|
|
29
|
+
static asyncForEachSerial(array: any[], callback: Function): Promise<void>;
|
|
30
|
+
static asyncForEachParallel(array: any[], callback: Function): Promise<void>;
|
|
31
|
+
private constructor();
|
|
32
|
+
}
|
|
@@ -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';
|
|
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,27 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
/**
|
|
15
|
+
* Returns the number of slots in a day (simple math)
|
|
16
|
+
* @param {number} slotWidthMs
|
|
17
|
+
* @returns {number} containing the number of slots in a day (last one may be partial)
|
|
18
|
+
*/
|
|
19
|
+
dailySlotCount(slotWidthMs: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* Imagine a day cut into N 'slots', each slotWidthMS wide - then there are
|
|
22
|
+
* 86,400,000 / slotWidthMS slots available, indexed from 0 on up. This function
|
|
23
|
+
* returns that index
|
|
24
|
+
* @param {number} slotWidthMs
|
|
25
|
+
* @returns {number} containing the current index
|
|
26
|
+
*/
|
|
27
|
+
currentTimeSlotIdx(slotWidthMs: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* Imagine a day cut into N 'slots', each slotWidthMS wide - then there are
|
|
30
|
+
* 86,400,000 / slotWidthMS slots available, indexed from 0 on up. This function
|
|
31
|
+
* returns that index
|
|
32
|
+
* @param {number} slotWidthMs
|
|
33
|
+
* @returns {number} containing the current index
|
|
34
|
+
*/
|
|
35
|
+
matchingTimeSlotIdx(timestamp: number, slotWidthMs: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Given the definition of slotWidth and currentTimeSlotIdx from above, return the ms that is the
|
|
38
|
+
* start of the slot that "now" falls within.
|
|
39
|
+
* @param {number} slotWidthMs
|
|
40
|
+
* @returns {number}
|
|
41
|
+
*/
|
|
42
|
+
startOfCurrentSlotEpochMS(slotWidthMs: number): number;
|
|
43
|
+
/**
|
|
44
|
+
* Given the definition of slotWidth and currentTimeSlotIdx from above, return the ms that is the
|
|
45
|
+
* start of the slot that the passed timestamp falls within.
|
|
46
|
+
* @param {number} slotWidthMs
|
|
47
|
+
* @returns {number}
|
|
48
|
+
*/
|
|
49
|
+
startOfMatchingSlotEpochMS(timestamp: number, slotWidthMs: number): number;
|
|
50
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LoggerLevelName } from '../logger/logger-level-name';
|
|
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,7 @@
|
|
|
1
|
+
import { TransformRule } from '../transform/transform-rule';
|
|
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,6 @@
|
|
|
1
|
+
import { LogMessage } from './log-message';
|
|
2
|
+
import { LogMessageFormatter } from './log-message-formatter';
|
|
3
|
+
import { LoggerMeta } from './logger-meta';
|
|
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';
|
|
2
|
+
import { LogMessage } from './log-message';
|
|
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';
|
|
2
|
+
import { LoggerOptions } from './logger-options';
|
|
3
|
+
import { LoggerRingBuffer } from './logger-ring-buffer';
|
|
4
|
+
import { LoggerLevelName } from './logger-level-name';
|
|
5
|
+
import { LogMessageBuilder } from './log-message-builder';
|
|
6
|
+
import { LogMessageProcessor } from './log-message-processor';
|
|
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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LogMessageFormatType } from './log-message-format-type';
|
|
2
|
+
import { LoggerLevelName } from './logger-level-name';
|
|
3
|
+
import { LogMessageProcessor } from './log-message-processor';
|
|
4
|
+
import { LoggerOutputFunction } from './logger-output-function';
|
|
5
|
+
export interface LoggerOptions {
|
|
6
|
+
initialLevel?: LoggerLevelName;
|
|
7
|
+
formatType?: LogMessageFormatType;
|
|
8
|
+
trace?: string;
|
|
9
|
+
globalVars?: Record<string, string | number | boolean>;
|
|
10
|
+
outputFunction?: LoggerOutputFunction;
|
|
11
|
+
ringBufferSize?: number;
|
|
12
|
+
preProcessors?: LogMessageProcessor[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LogMessage } from './log-message';
|
|
2
|
+
import { LogSnapshot } from './log-snapshot';
|
|
3
|
+
export declare class LoggerRingBuffer {
|
|
4
|
+
private _lastLogMessage;
|
|
5
|
+
private _buffer;
|
|
6
|
+
private _bufferIdx;
|
|
7
|
+
private _lastSnapshotIdx;
|
|
8
|
+
private _bufferSize;
|
|
9
|
+
constructor(size: number);
|
|
10
|
+
get currentIndex(): number;
|
|
11
|
+
get lastSnapshotIdx(): number;
|
|
12
|
+
set bufferSize(newSize: number);
|
|
13
|
+
getMessages(inStartFrom?: number, clear?: boolean, reverseSort?: boolean): LogMessage[];
|
|
14
|
+
takeSnapshot(): LogSnapshot;
|
|
15
|
+
getLastLogMessage(): LogMessage;
|
|
16
|
+
private clearRingBuffer;
|
|
17
|
+
addToRingBuffer(newMsg: LogMessage): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LoggerLevelName } from './logger-level-name';
|
|
2
|
+
import { LoggerOutputFunction } from './logger-output-function';
|
|
3
|
+
export declare class LoggerUtil {
|
|
4
|
+
private static LOG_LEVELS_IN_ORDER;
|
|
5
|
+
static handlerFunctionMap(outputFn?: LoggerOutputFunction): Map<LoggerLevelName, (...any: any[]) => void>;
|
|
6
|
+
static defaultHandlerFunction(): (...any: any[]) => void;
|
|
7
|
+
static levelIsEnabled(targetLevel: LoggerLevelName, currentEnabled: LoggerLevelName): boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { LogMessage } from './log-message';
|
|
2
|
+
import { LogSnapshot } from './log-snapshot';
|
|
3
|
+
import { LoggerOptions } from './logger-options';
|
|
4
|
+
import { LoggerInstance } from './logger-instance';
|
|
5
|
+
import { LoggerLevelName } from './logger-level-name';
|
|
6
|
+
import { LoggerRingBuffer } from './logger-ring-buffer';
|
|
7
|
+
import { LogMessageBuilder } from './log-message-builder';
|
|
8
|
+
/**
|
|
9
|
+
* Class to simplify logging across both browsers and node (especially lambda)
|
|
10
|
+
*
|
|
11
|
+
* Important note : This class is here to make logging SIMPLE - mainly it is focused on simplicity,
|
|
12
|
+
* and single point of enable/disable logging. Output goes to console, since thats the only thing
|
|
13
|
+
* that is present in both the browser and node. If you need to do something more complicated (like
|
|
14
|
+
* logging to files, multiple transports, etc) you really should just use something heavier like
|
|
15
|
+
* Winston directly and skip this class entirely
|
|
16
|
+
*/
|
|
17
|
+
export declare class Logger {
|
|
18
|
+
private static LOGGER_INSTANCES;
|
|
19
|
+
private static DEFAULT_OPTIONS;
|
|
20
|
+
static applyDefaultsToOptions(input?: LoggerOptions): LoggerOptions;
|
|
21
|
+
static changeDefaultOptions(input: LoggerOptions, retroactive?: boolean): void;
|
|
22
|
+
static getLogger(loggerName?: string, inOptions?: LoggerOptions): LoggerInstance;
|
|
23
|
+
static recordMessageBuilder(msgBuild: LogMessageBuilder): string;
|
|
24
|
+
static recordMessage(msg: LogMessage): string;
|
|
25
|
+
static formatMessages(msgs: LogMessage[]): string[];
|
|
26
|
+
static updateTracePrefix(newValue: string): void;
|
|
27
|
+
static changeRingBufferSize(newValue: number): void;
|
|
28
|
+
static getRingBuffer(): LoggerRingBuffer;
|
|
29
|
+
static dumpConfigurationIntoLog(): void;
|
|
30
|
+
static dumpOptionsIntoLog(): void;
|
|
31
|
+
static getLevel(): LoggerLevelName;
|
|
32
|
+
static setLevel(newLevel: LoggerLevelName): void;
|
|
33
|
+
static getOptions(): LoggerOptions;
|
|
34
|
+
static getMessages(inStartFrom?: number, clear?: boolean, reverseSort?: boolean): LogMessage[];
|
|
35
|
+
static consoleLogPassThru(level: LoggerLevelName, ...input: any[]): void;
|
|
36
|
+
static error(format: string, ...input: any[]): string;
|
|
37
|
+
static errorP(...input: any[]): void;
|
|
38
|
+
static warn(format: string, ...input: any[]): string;
|
|
39
|
+
static warnP(...input: any[]): void;
|
|
40
|
+
static info(format: string, ...input: any[]): string;
|
|
41
|
+
static infoP(...input: any[]): void;
|
|
42
|
+
static verbose(format: string, ...input: any[]): string;
|
|
43
|
+
static verboseP(...input: any[]): void;
|
|
44
|
+
static debug(format: string, ...input: any[]): string;
|
|
45
|
+
static debugP(...input: any[]): void;
|
|
46
|
+
static silly(format: string, ...input: any[]): string;
|
|
47
|
+
static sillyP(...input: any[]): void;
|
|
48
|
+
static takeSnapshot(): LogSnapshot;
|
|
49
|
+
static logByLevel(level: LoggerLevelName, format: string, ...input: any[]): void;
|
|
50
|
+
static importMessages(msgs: LogMessage[], prefixIn?: string, addTimestamp?: boolean): void;
|
|
51
|
+
static getLastLogMessage(): LogMessage;
|
|
52
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LogMessage } from './log-message';
|
|
2
|
+
import { LogMessageFormatter } from './log-message-formatter';
|
|
3
|
+
import { LoggerMeta } from './logger-meta';
|
|
4
|
+
export declare class NoneLogMessageFormatter implements LogMessageFormatter {
|
|
5
|
+
formatMessage(msg: LogMessage, meta: LoggerMeta): string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LogMessage } from './log-message';
|
|
2
|
+
import { LogMessageFormatter } from './log-message-formatter';
|
|
3
|
+
import { LoggerMeta } from './logger-meta';
|
|
4
|
+
export declare class StructuredJsonLogMessageFormatter implements LogMessageFormatter {
|
|
5
|
+
formatMessage(msg: LogMessage, meta: LoggerMeta): string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ParsedUrl } from '../lang/parsed-url';
|
|
2
|
+
export declare class NetworkRatchet {
|
|
3
|
+
private static LOCAL_IP;
|
|
4
|
+
static findLocalIp(useCache?: boolean): Promise<string>;
|
|
5
|
+
static parseUrl(href: string): ParsedUrl;
|
|
6
|
+
private static updateLocalIP;
|
|
7
|
+
private static grepSDP;
|
|
8
|
+
private static updateAddressList;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Writable } from 'stream';
|
|
4
|
+
export declare class BufferWritable extends Writable {
|
|
5
|
+
private _val;
|
|
6
|
+
constructor();
|
|
7
|
+
_write(chunk: any, encoding: string, callback: any): void;
|
|
8
|
+
get value(): Buffer;
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Readable } from 'stream';
|
|
4
|
+
export declare class StreamRatchet {
|
|
5
|
+
private constructor();
|
|
6
|
+
static readableToBufferSync(stream: Readable): Buffer;
|
|
7
|
+
static webReadableStreamToBuffer(stream: ReadableStream): Promise<Buffer>;
|
|
8
|
+
static webReadableStreamToString(stream: ReadableStream): Promise<string>;
|
|
9
|
+
static stringToReadable(input: string): Readable;
|
|
10
|
+
static stringToWebReadableStream(input: string): ReadableStream;
|
|
11
|
+
static anyToStringReadable(input: any): Readable;
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This class is for people who just need to send an occasionaly outbound text message and don't need
|
|
3
|
+
* Twilio's 7mb non-tree-shakable library
|
|
4
|
+
*/
|
|
5
|
+
export declare class TwilioRatchet {
|
|
6
|
+
private accountSid;
|
|
7
|
+
private authToken;
|
|
8
|
+
private outBoundNumber;
|
|
9
|
+
static readonly TWILLIO_BASE_API_URL: string;
|
|
10
|
+
constructor(accountSid: string, authToken: string, outBoundNumber: string);
|
|
11
|
+
static sendMessageDirect(accountSid: string, authToken: string, outBoundNumber: string, recipientPhoneNumbers: string[], message: string): Promise<any[]>;
|
|
12
|
+
static generateTwilioBasicAuth(sid: string, authToken: string): string;
|
|
13
|
+
sendMessage(recipientPhoneNumbers: string[], message: string): Promise<any[]>;
|
|
14
|
+
static isValidE164Number(num: string): boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TransformRule } from './transform-rule';
|
|
2
|
+
export declare class BuiltInTransforms {
|
|
3
|
+
static keysOnly(rule: TransformRule): TransformRule;
|
|
4
|
+
static valuesOnly(rule: TransformRule): TransformRule;
|
|
5
|
+
static stringReplaceTransform(input: string, output: string): TransformRule;
|
|
6
|
+
static stripStringTransform(input: string): TransformRule;
|
|
7
|
+
static retainAll(input: string[]): TransformRule;
|
|
8
|
+
static removeAll(input: string[]): TransformRule;
|
|
9
|
+
static snakeToCamelCase(): TransformRule;
|
|
10
|
+
static stringToNumber(): TransformRule;
|
|
11
|
+
static camelToSnakeCase(): TransformRule;
|
|
12
|
+
static concatenateToNewField(newFieldName: string, oldFieldNamesInOrder: string[], abortIfFieldMissing?: boolean): TransformRule;
|
|
13
|
+
static numberToBool(fieldNames: string[]): TransformRule;
|
|
14
|
+
static boolToNumber(fieldNames: string[]): TransformRule;
|
|
15
|
+
static makeDuplicateField(oldName: string, newName: string): TransformRule;
|
|
16
|
+
static addField(name: string, valueToAdd: string): TransformRule;
|
|
17
|
+
static reformatDateFields(fieldNames: string[], oldFormat: string, newFormat: string): TransformRule;
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TransactionResult } from './transaction-result';
|
|
2
|
+
import { LoggerLevelName } from '../logger/logger-level-name';
|
|
3
|
+
export interface TransactionConfiguration<T> {
|
|
4
|
+
stepLogLevel?: LoggerLevelName;
|
|
5
|
+
executeAfterRollback?(result: TransactionResult<T>): Promise<void>;
|
|
6
|
+
executeAfterRollbackFailure?(result: TransactionResult<T>): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TransactionStep } from './transaction-step';
|
|
2
|
+
import { TransactionResult } from './transaction-result';
|
|
3
|
+
import { TransactionConfiguration } from './transaction-configuration';
|
|
4
|
+
export declare class TransactionRatchet {
|
|
5
|
+
static execute<T>(steps: TransactionStep<T>[], initialContext: T, inConfiguration?: TransactionConfiguration<T>): Promise<TransactionResult<T>>;
|
|
6
|
+
}
|