
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
@xylabs/sdk-js
Advanced tools
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
@xylabs/sdk-js
new ApiClient(token?, stage?): ApiClient;
null
| string
ApiClient
protected optional token: null | string;
protected optional stage: ApiStage;
abstract endPoint(): string;
string
T
new ApiEndpoint<T>(config, path): ApiEndpoint<T>;
string
ApiEndpoint
<T
>
get value(): undefined | T;
undefined
| T
fetch(): Promise<T>;
Promise
<T
>
get(): Promise<T | NonNullable<T>>;
Promise
<T
| NonNullable
<T
>>
insert(value): Promise<T>;
T
Promise
<T
>
Axios
new AxiosJson(config?): AxiosJson;
RawAxiosJsonRequestConfig
<any
>
AxiosJson
Axios.constructor
static optional defaultLogger: Logger;
static finalPath(response): any;
AxiosResponse
any
Axios
new AxiosJsonUncompressed(config?): AxiosJsonUncompressed;
RawAxiosJsonRequestUncompressedConfig
<any
>
AxiosJsonUncompressed
Axios.constructor
static optional defaultLogger: Logger;
static finalPath(response): any;
AxiosResponse
any
Interface to handle overlap between Winston &
console
with as much congruency as possible.
new ConsoleLogger(level?): ConsoleLogger;
ConsoleLogger
readonly level: LogLevelValue;
readonly logger: Logger;
get debug(): LogFunction;
get error(): LogFunction;
get info(): LogFunction;
get log(): LogFunction;
get trace(): LogFunction;
get warn(): LogFunction;
readonly static type: "EthAddress" = "EthAddress";
type: string;
static fromString(value?, base?): undefined | EthAddress;
string
number
undefined
| EthAddress
static parse(value, base?): undefined | EthAddress;
unknown
number
undefined
| EthAddress
static validate(address): boolean;
string
boolean
equals(address?): boolean;
null
| string
| EthAddress
boolean
toBigNumber(): bigint;
bigint
toHex(): string;
string
toJSON(): string;
string
toLowerCaseString(): string;
string
toShortString(length?): string;
number
string
toString(checksum?, chainId?): string;
boolean
string
string
validate(): boolean;
boolean
ForgetPromise
new ForgetPromise(): ForgetPromiseNode;
ForgetPromiseNode
ForgetPromise.constructor
static activeForgets: number;
ForgetPromise.activeForgets
static exceptedForgets: number;
ForgetPromise.exceptedForgets
static logger: Logger;
ForgetPromise.logger
get static active(): boolean;
boolean
ForgetPromise.active
static awaitInactive(interval?, timeout?): Promise<number>;
number
number
Promise
<number
>
ForgetPromise.awaitInactive
static exceptionHandler(
error,
config,
externalStackTrace?): void;
Error
string
void
ForgetPromise.exceptionHandler
static forget<T>(promise, config?): void;
Used to explicitly launch an async function (or Promise) with awaiting it
T
Promisable
<T
>
The promise to forget
Configuration of forget settings
void
ForgetPromise.forget
static timeoutHandler(
time,
config,
externalStackTrace?): void;
number
string
void
ForgetPromise.timeoutHandler
Interface to handle overlap between Winston &
console
with as much congruency as possible.
new IdLogger(logger, id?): IdLogger;
() => string
IdLogger
set id(id): void;
string
void
debug(...data): void;
...unknown
[]
void
Logger.debug
error(...data): void;
...unknown
[]
void
Logger.error
info(...data): void;
...unknown
[]
void
Logger.info
log(...data): void;
...unknown
[]
void
Logger.log
trace(...data): void;
...unknown
[]
void
Logger.trace
warn(...data): void;
...unknown
[]
void
Logger.warn
T
extends TypedObject
new IsObjectFactory<T>(): IsObjectFactory<T>;
IsObjectFactory
<T
>
create(shape?, additionalChecks?): TypeCheck<T>;
ObjectTypeShape
TypeCheck
<TypedObject
>[]
TypeCheck
<T
>
Interface to handle overlap between Winston &
console
with as much congruency as possible.
new LevelLogger(logger, level?): LevelLogger;
LevelLogger
readonly level: LogLevelValue;
readonly logger: Logger;
get debug(): LogFunction;
get error(): LogFunction;
get info(): LogFunction;
get log(): LogFunction;
get trace(): LogFunction;
get warn(): LogFunction;
use @xylabs/logger instead
new Log(config): Log;
LogConfig
Log
protected config: LogConfig;
debug(...params): void;
...any
[]
void
error(...params): void;
...any
[]
void
info(...params): void;
...any
[]
void
log(...params): void;
...any
[]
void
warn(...params): void;
...any
[]
void
T
extends EmptyObject
= EmptyObject
new ObjectWrapper<T>(obj): ObjectWrapper<T>;
T
ObjectWrapper
<T
>
readonly obj: T;
get protected stringKeyObj(): StringKeyObject;
Promise
<T
>T
V
= void
new PromiseEx<T, V>(func, value?): PromiseEx<T, V>;
V
PromiseEx
<T
, V
>
Promise<T>.constructor
optional cancelled: boolean;
then<TResult1, TResult2>(
onfulfilled?,
onrejected?,
onvalue?): Promise<TResult1 | TResult2>;
Attaches callbacks for the resolution and/or rejection of the Promise.
TResult1
= T
TResult2
= never
The callback to execute when the Promise is resolved.
null
| (value
) => TResult1
| PromiseLike
<TResult1
>
The callback to execute when the Promise is rejected.
null
| (reason
) => TResult2
| PromiseLike
<TResult2
>
(value?
) => boolean
Promise
<TResult1
| TResult2
>
A Promise for the completion of which ever callback is executed.
Promise.then
value(onvalue?): this;
(value?
) => boolean
this
A logger that does not log anything.
This is useful when you want to disable logging
like when running unit tests or in silent mode.
It implements the Logger
interface but all methods
are no-op functions.
new SilentLogger(): SilentLogger;
SilentLogger
readonly debug: (..._data) => undefined;
...unknown
[]
undefined
readonly error: (..._data) => undefined;
...unknown
[]
undefined
readonly info: (..._data) => undefined;
...unknown
[]
undefined
readonly log: (..._data) => undefined;
...unknown
[]
undefined
readonly trace: (..._data) => undefined;
...unknown
[]
undefined
readonly warn: (..._data) => undefined;
...unknown
[]
undefined
ObjectWrapper
<Partial
<T
>>T
extends EmptyObject
= AnyObject
Validator
<T
>new ValidatorBase<T>(obj): ValidatorBase<T>;
T
ValidatorBase
<T
>
readonly obj: T;
get protected stringKeyObj(): StringKeyObject;
abstract validate(payload): Promisable<Error[]>;
T
Promisable
<Error
[]>
function asAddress(value): undefined | Lowercase<string>;
unknown
undefined
| Lowercase
<string
>
function asAddress(value, assert): Lowercase<string>;
unknown
AssertConfig
Lowercase
<string
>
function asHash(value): undefined | Lowercase<string>;
unknown
undefined
| Lowercase
<string
>
function asHash(value, assert): Lowercase<string>;
unknown
AssertConfig
Lowercase
<string
>
function asHex(value): undefined | Lowercase<string>;
unknown
undefined
| Lowercase
<string
>
function asHex(value, assert): Lowercase<string>;
unknown
AssertConfig
Lowercase
<string
>
function assertDefinedEx<T>(expr, messageFunc?): T;
Intended for defined checks for variables
T
Expression to be evaluated for truthiness
undefined
| T
T
Value of expression
AssertExError
function assertDefinedEx<T, R>(expr, errorFunc?): T;
Intended for defined checks for variables
T
R
extends Error
Expression to be evaluated for truthiness
undefined
| T
AssertExErrorFunc
<T
, R
>
T
Value of expression
AssertExError
function assertDefinedEx<T>(expr): T;
T
undefined
| T
T
function assertDefinedEx<T>(expr, message?): T;
T
undefined
| T
string
T
function assertEx<T>(expr, messageFunc?): T;
Intended for simple truthiness checks for variables
T
Expression to be evaluated for truthiness
undefined
| null
| T
T
Value of expression
AssertExError
function assertEx<T, R>(expr, errorFunc?): T;
Intended for simple truthiness checks for variables
T
R
extends Error
Expression to be evaluated for truthiness
undefined
| null
| T
AssertExErrorFunc
<T
, R
>
T
Value of expression
AssertExError
function assertEx<T>(expr): T;
T
undefined
| null
| T
T
function assertEx<T>(expr, message?): T;
T
undefined
| null
| T
string
T
function createDeepMerge(options): <T>(...objects) => MergeAll<T>;
Creates a deep merge function with the specified options.
MergeOptions
Options for merging.
A deep merge function configured for the specified options.
<T>(...objects): MergeAll<T>;
T
extends AnyObject
[]
...T
MergeAll
<T
>
function hexToBigInt(hex): bigint;
Lowercase
<string
>
bigint
function staticImplements<T>(): <U>(constructor) => void;
Annotation to decorate classes which implement static methods
T
The decorated class requiring it to implement the members of the the type as static properties/methods
<U>(constructor): void;
U
U
void
function toPromise<T>(value): Promise<T>;
T
Promisable
<T
>
Promise
<T
>
apiDomain: string;
optional apiKey: string;
optional jwtToken: string;
optional userid: string;
ForgetConfig
<T
>T
= any
optional name: string;
ForgetConfig.name
optional onCancel: () => void;
void
ForgetConfig.onCancel
optional onComplete: (result) => void;
[undefined
| T
, undefined
| Error
]
void
ForgetConfig.onComplete
optional onException: (error) => void;
Error
void
ForgetConfig.onException
optional timeout: number;
ForgetConfig.timeout
optional terminateOnException: boolean;
optional terminateOnTimeout: boolean;
Configuration of validation and output format
optional bitLength: number;
optional byteSize: number;
optional prefix: boolean;
Interface to handle overlap between Winston &
console
with as much congruency as possible.
debug: LogFunction;
error: LogFunction;
info: LogFunction;
log: LogFunction;
trace: LogFunction;
warn: LogFunction;
optional log: boolean | Logger;
then: () => unknown;
unknown
optional backoff: number;
optional interval: number;
optional retries: number;
T
= unknown
optional backoff: number;
optional interval: number;
optional retries: number;
optional complete: (result?) => boolean;
T
boolean
optional log: boolean | Logger;
optional log: boolean | Logger;
required: false;
optional log: boolean | Logger;
required: true;
T
extends EmptyObject
= AnyObject
validate(payload): Promisable<Error[]>;
T
Promisable
<Error
[]>
type Address = Exclude<Hex, "reserved-address-value">;
type AnyNonPromise = Exclude<TypedValue, PromiseType>;
type AnyObject = Record<TypedKey, unknown>;
Any object, which means that it does not enforce the set of fields that it has. Extending from AnyObject will result in a type that includes the universal set of field names
type ApiStage = EnumValue<typeof ApiStage>;
type AsOptionalTypeFunction<T> = <TType>(value) => undefined | TType;
T
extends AnyNonPromise
= AnyNonPromise
TType
extends AnyNonPromise
undefined
| TType
type AsTypeFunction<T> = {
<TType> (value): undefined | TType;
<TType> (value, config): TType;
<TType> (value, config): undefined | TType;
<TType> (value, assert): undefined | TType;
<TType> (value, assert, config): TType;
<TType> (value, assert, config): undefined | TType;
};
T
extends AnyNonPromise
= AnyNonPromise
<TType>(value): undefined | TType;
TType
extends AnyNonPromise
undefined
| TType
<TType>(value, config): TType;
TType
extends AnyNonPromise
TType
<TType>(value, config): undefined | TType;
TType
extends AnyNonPromise
TypeCheckConfig
| TypeCheckOptionalConfig
undefined
| TType
<TType>(value, assert): undefined | TType;
TType
extends AnyNonPromise
StringOrAlertFunction
<TType
>
undefined
| TType
<TType>(
value,
assert,
config): TType;
TType
extends AnyNonPromise
StringOrAlertFunction
<TType
>
TType
<TType>(
value,
assert,
config): undefined | TType;
TType
extends AnyNonPromise
StringOrAlertFunction
<TType
>
TypeCheckConfig
| TypeCheckOptionalConfig
undefined
| TType
type AssertExErrorFunc<T, R> = (value?) => R;
T
R
extends Error
T
| null
R
type AssertExMessageFunc<T> = (value?) => string;
T
T
| null
string
type AsyncMutex<T> = Promise<T>;
T
Used to document promises that are being used as Mutexes
type Compare<T> = (a, b) => number;
T
T
T
number
type DeepOmitStartsWith<T, Prefix> = T extends infer U[] ? DeepOmitStartsWith<U, Prefix>[] : T extends object ? { [K in keyof T as K extends string ? K extends `${Prefix}${string}` ? never : K : K]: DeepOmitStartsWith<T[K], Prefix> } : T;
T
Prefix
extends string
type DeepPickStartsWith<T, Prefix> = T extends infer U[] ? DeepPickStartsWith<U, Prefix>[] : T extends object ? { [K in keyof T as K extends string ? K extends `${Prefix}${string}` ? K : never : K]: DeepPickStartsWith<T[K], Prefix> } : T;
T
Prefix
extends string
type DeepRestrictToStringKeys<T> = { [K in keyof T as K extends string ? K : never]: T[K] extends (infer U)[] ? DeepRestrictToStringKeys<U>[] : T[K] extends object ? DeepRestrictToStringKeys<T[K]> : T[K] };
T
type EmptyObject<T> = { [K in keyof T]?: never };
An empty object, which means that it does enforce the set of field names, defaulting to an empty set until extended from, which then adds only those additional fields
T
extends object
= object
type EmptyObjectOf<T> = EmptyObject<T> extends T ? EmptyObject<T> : never;
T
extends object
type Hash = Exclude<Hex, "reserved-hash-value">;
type HashBitLength = 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
type Hex = Exclude<Lowercase<string>, "reserved-hex-value">;
type JsonArray = JsonValue[];
type JsonObject = object;
[key: string]: JsonValue
type JsonValue =
| string
| number
| boolean
| null
| JsonObject
| JsonArray;
type LogFunction = (...data) => void;
...unknown
[]
void
type LogLevel = LogLevelValue;
Use LogLevelValue
instead.
This name conflicts with the LogLevel
enum and
makes it confusing to import
type LogLevelKey = EnumKey<typeof LogLevel>;
type LogLevelValue = EnumValue<typeof LogLevel>;
type LogVerbosity = LogLevelKey;
type NullablePromisable<T, V> = Promisable<T | null, V>;
T
V
= never
type NullablePromisableArray<T, V> = PromisableArray<T | null, V>;
T
V
= never
type OmitByPredicate<T> = (value, key) => boolean;
T
extends EmptyObject
= Record
<string
, unknown
>
T
[keyof T
]
keyof T
boolean
type OmitStartsWith<T, Prefix> = { [K in keyof T as K extends `${Prefix}${string}` ? never : K]: T[K] };
T
Prefix
extends string
type Optional<T, F> = Omit<T, F> & Partial<Pick<T, F>>;
T
extends object
F
extends keyof T
type OptionalPromisable<T, V> = Promisable<T | undefined, V>;
T
V
= never
type OptionalPromisableArray<T, V> = PromisableArray<T | undefined, V>;
T
V
= never
type Override<T1, T2> = Omit<T1, keyof T2> & T2;
T1
T2
type PartialRecord<K, T> = { [P in K]?: T };
K
extends keyof any
T
use Partial<Record<>> instead
type PickByPredicate<T> = (value, key) => boolean;
T
extends EmptyObject
= Record
<string
, unknown
>
T
[keyof T
]
keyof T
boolean
type PickStartsWith<T, Prefix> = { [K in keyof T as K extends `${Prefix}${string}` ? K : never]: T[K] };
T
Prefix
extends string
type Profiler = Record<string, number[]>;
type Promisable<T, V> = PromiseEx<T, V> | Promise<T> | T;
T
V
= never
type PromisableArray<T, V> = Promisable<T[], V>;
T
V
= never
type PromiseExFunc<T> = (resolve?, reject?) => void;
T
PromiseExSubFunc
<T
, void
>
PromiseExSubFunc
<T
, void
>
void
type PromiseExSubFunc<T, TResult> = (value) => TResult;
T
TResult
= T
T
TResult
type PromiseExValueFunc<V> = (value?) => boolean;
V
V
boolean
type RawAxiosJsonRequestConfig<D> = RawAxiosRequestConfig<D> & object;
optional compressLength: number;
D
= any
type RawAxiosJsonRequestUncompressedConfig<D> = RawAxiosRequestConfig<D>;
D
= any
type StringKeyObject<T> = object;
T
= unknown
[key: string]: T
type StringOrAlertFunction<T> = string | AssertExMessageFunc<T>;
T
extends AnyNonPromise
type TypeCheck<T> = {
(obj): obj is T;
(obj, config): obj is T;
(obj, config): obj is T;
};
T
extends TypedValue
(obj): obj is T;
obj is T
(obj, config): obj is T;
obj is T
(obj, config): obj is T;
undefined
| number
| TypeCheckConfig
obj is T
type WithAdditional<T, TAdditional> = TAdditional extends EmptyObject ? T & TAdditional : T;
T
extends EmptyObject
| void
TAdditional
extends EmptyObject
| void
= void
const ApiStage: Enum<{
Beta: "beta";
Local: "local";
Prod: "prod";
}>;
const AsObjectFactory: object;
create: <T>(typeCheck) => AsTypeFunction;
T
extends TypedObject
TypeCheck
<T
>
createOptional: <T>(typeCheck) => (value) => T | undefined;
T
extends TypedObject
TypeCheck
<T
>
(value): T | undefined;
T
| undefined
const AsTypeFactory: object;
create: <T>(typeCheck) => AsTypeFunction<T>;
T
extends AnyNonPromise
TypeCheck
<T
>
createOptional: <T>(typeCheck) => (value) => T | undefined;
T
extends AnyNonPromise
TypeCheck
<T
>
(value): T | undefined;
T
| undefined
HashBitLength: HashBitLength[];
const LogLevel: Enum<{
error: 1;
warn: 2;
info: 3;
log: 4;
debug: 5;
trace: 6;
}>;
const NoOpLogFunction: (..._data) => undefined;
...unknown
[]
undefined
const ZERO_ADDRESS: Address;
const ZERO_HASH: Hash;
const asAnyObject: AsTypeFunction;
const axios: AxiosJson;
const axiosUncompressed: AxiosJsonUncompressed;
const bitsToNibbles: (value) => number;
number
number
const clearTimeoutEx: (id) => void;
string
void
const containsAll: <T>(source, target) => boolean;
T
T
[]
T
[]
boolean
const createProfiler: () => Profiler;
const deepMerge: <T>(...objects) => MergeAll<T>;
Deeply merges multiple objects into a new object.
T
extends AnyObject
[]
...T
Multiple objects to merge deeply. The function merges properties from all objects into a new object. If a property exists in multiple objects, the last object's value will be used. If a property is an object, it will be merged recursively. If a property is an array, it will be overwritten by the last object's value. If a property is a primitive value, it will be overwritten by the last object's value. If a property is undefined in the source, it will be skipped. If a property is a symbol, it will be merged as well.
MergeAll
<T
>
A new object with the merged properties.
const defaultForgetNodeConfig: ForgetNodeConfig<unknown>;
const delay: (ms) => Promise<unknown>;
number
Promise
<unknown
>
const difference: <TKey>(a, b) => Set<TKey>;
TKey
Set
<TKey
>
Set
<TKey
>
Set
<TKey
>
const distinct: <T>(value, index, array) => boolean;
T
T
number
T
[]
boolean
const ellipsize: (value, length?) => string;
string
number
string
const exists: <T>(x?) => x is NonNullable<T>;
Used to type narrow an object which is possibly null or undefined. Works well with functional Array methods. For example:
T
The object which is potentially undefined or null
T
| null
x is NonNullable<T>
False if the object is null/undefined, true otherwise
const payloads: XyoPayload[] = boundWitness._payloads?.filter(exists) || []
const filterAs: <In, Out>(x, predicate) => NonNullable<Out>[];
In
Out
In
[]
(a
) => Out
NonNullable
<Out
>[]
const filterAsync: <T>(array, predicate) => Promise<T[]>;
Returns the elements of an array that meet the condition specified in a callback function.
T
T
[]
The array to filter.
(value
, index
, array
) => Promise
<boolean
>
A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
Promise
<T
[]>
The elements of an array that meet the condition specified in a callback function.
const findAs: <In, Out>(x, predicate) => NonNullable<Out> | undefined;
In
Out
In
[]
(a
) => Out
NonNullable
<Out
> | undefined
const findLastAs: <In, Out>(x, predicate) => NonNullable<Out> | undefined;
In
Out
In
[]
(a
) => Out
NonNullable
<Out
> | undefined
const flatten: <T>(a?, b?) => T[];
T
T
| ConcatArray
<T
>
T
| ConcatArray
<T
>
T
[]
const forget: <T>(promise, config?) => void;
T
Promisable
<T
>
void
const fromFixedPoint: (value, places?) => bigint;
bigint
number
bigint
const fulfilled: <T>(val) => val is PromiseFulfilledResult<T>;
For use with Promise.allSettled to filter only successful results
T
PromiseSettledResult
<T
>
val is PromiseFulfilledResult<T>
const fulfilledValues: <T>(previousValue, currentValue) => T[];
For use with Promise.allSettled to reduce to only successful result values
T
T
[]
PromiseSettledResult
<T
>
T
[]
const resolved = Promise.resolve('resolved')
const rejected = Promise.reject('rejected')
const settled = await Promise.allSettled([resolved, rejected])
const results = settled.reduce(fulfilledValues, [] as string[])
// results === [ 'resolved' ]
const resolved = Promise.resolve('resolved')
const rejected = Promise.reject('rejected')
const settled = await Promise.allSettled([resolved, rejected])
const results = settled.reduce<string[]>(fulfilledValues, [])
// results === [ 'resolved' ]
const functionName: (depth?) => string;
number
string
const getApiStage: (hostname) => "beta" | "local" | "prod";
string
"beta"
| "local"
| "prod"
const getFunctionName: (depth?) => string;
number
string
const handleError: <T>(error, handler) => T;
T
any
(error
) => T
T
const handleErrorAsync: <T>(error, handler) => Promise<T>;
T
any
(error
) => Promise
<T
>
Promise
<T
>
const hexFrom: (value, config?) => Hex;
Takes unknown value and tries our best to convert it to a hex string
string
| number
| bigint
| ArrayBufferLike
const hexFromArrayBuffer: (buffer, config?) => Hex;
Convert an ArrayBuffer to a hex string
ArrayBufferLike
const hexFromBigInt: (value, config?) => Hex;
Convert a bigint to a hex string
bigint
const hexFromHexString: (value, config?) => Hex;
string
const hexFromNumber: (value, config?) => Hex;
number
const hexRegex: RegExp;
const hexRegexWithPrefix: RegExp;
const intersection: <TKey>(a, b) => Set<TKey>;
TKey
Set
<TKey
>
Set
<TKey
>
Set
<TKey
>
const isAddress: (value, config?) => value is Address;
unknown
value is Address
const isError: (error) => error is Error;
any
error is Error
const isEthAddress: (obj) => boolean;
string
boolean
const isHash: (value, bitLength?) => value is Hash;
unknown
value is Hash
const isHashBitLength: (value) => value is HashBitLength;
unknown
value is HashBitLength
const isHex: (value, config?) => value is Hex;
unknown
value is Hex
const isHexZero: (value?) => boolean | undefined;
string
boolean
| undefined
const isJsonArray: (value) => value is JsonArray;
unknown
value is JsonArray
const isJsonObject: (value) => value is JsonObject;
unknown
value is JsonObject
const isJsonValue: (value) => value is JsonValue;
unknown
value is JsonValue
const isObject: <T>(value) => value is T & object;
T
T
value is T & object
const isPromise: (value) => value is Promise<unknown>;
unknown
value is Promise<unknown>
const isType: (value, expectedType) => boolean;
unknown
FieldType
boolean
const isValidJsonFieldPair: ([key, value]) => boolean;
[unknown
, unknown
]
boolean
const nibblesToBits: (value) => number;
number
number
const omitBy: <T>(obj, predicate, maxDepth?) => Partial<T>;
T
extends EmptyObject
T
number
Partial
<T
>
const omitByPrefix: <T, P>(payload, prefix, maxDepth?) => DeepOmitStartsWith<T, P>;
T
extends EmptyObject
P
extends string
T
P
number
DeepOmitStartsWith
<T
, P
>
const padHex: (hex, byteCount?) => string;
string
number
string
const pickBy: <T>(obj, predicate, maxDepth?) => Partial<T>;
T
extends EmptyObject
T
number
Partial
<T
>
const pickByPrefix: <T, P>(payload, prefix, maxDepth?) => DeepPickStartsWith<T, P>;
T
extends EmptyObject
P
extends string
T
P
number
DeepPickStartsWith
<T
, P
>
const profile: (profiler, name) => void;
string
void
const profileReport: (profiler) => Record<string, number>;
Record
<string
, number
>
const rejected: <T>(val) => val is PromiseRejectedResult;
For use with Promise.allSettled to filter only rejected results
T
PromiseSettledResult
<T
>
val is PromiseRejectedResult
const removeFields: <T, K>(obj, fields) => Omit<T, K>;
T
extends EmptyObject
K
extends keyof T
T
K
[]
Omit
<T
, K
>
const retry: <T>(func, config?) => Promise<T | undefined>;
T
= unknown
() => Promisable
<T
| undefined
>
Promise
<T
| undefined
>
const setTimeoutEx: (func, delay) => string;
Function
number
string
const toAddress: (value, config?) => Lowercase<string>;
string
| number
| bigint
| ArrayBufferLike
Lowercase
<string
>
const toDecimalPrecision: (value, digits) => string;
number
number
string
const toFixedPoint: (value, places?) => bigint;
bigint
| string
number
bigint
const toHex: (value, config?) => Lowercase<string>;
takes any value and tries our best to convert it to a hex string
string
| number
| bigint
| ArrayBufferLike
Lowercase
<string
>
const toHexLegacy: (buffer) => string;
ArrayBuffer
string
const toJson: (value, maxDepth?) => JsonValue;
unknown
number
const toJsonArray: (value, cycleList?, maxDepth?) => JsonArray;
unknown
[]
unknown
[]
number
const toJsonObject: (value, cycleList?, maxDepth?) => JsonObject;
object
unknown
[]
number
const toJsonString: (value, maxDepth?) => string;
unknown
number
string
const toJsonValue: (value, cycleList?, maxDepth?) => JsonValue;
unknown
unknown
[]
number
const union: <TKey>(a, b) => Set<TKey>;
TKey
Set
<TKey
>
Set
<TKey
>
Set
<TKey
>
const uniq: <T>(arr) => T[];
T
T
[]
T
[]
const uniqBy: <T, I>(arr, iteratee) => T[];
T
I
T
[]
(item
) => I
T
[]
Part of sdk-js
See the LICENSE file for license details
FAQs
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
The npm package @xylabs/sdk-js receives a total of 34 weekly downloads. As such, @xylabs/sdk-js popularity was classified as not popular.
We found that @xylabs/sdk-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.