@settlemint/sdk-utils
Advanced tools
Comparing version
@@ -21,6 +21,12 @@ import { z } from 'zod'; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK: z.ZodOptional<z.ZodString>; | ||
/** Unique name of the blockchain node */ | ||
/** Chain ID of the blockchain network */ | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: z.ZodOptional<z.ZodString>; | ||
/** Unique name of the blockchain node (should have a private key for signing transactions) */ | ||
SETTLEMINT_BLOCKCHAIN_NODE: z.ZodOptional<z.ZodString>; | ||
/** Unique name of the load balancer */ | ||
SETTLEMINT_LOAD_BALANCER: z.ZodOptional<z.ZodString>; | ||
/** JSON RPC endpoint for the blockchain node */ | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: z.ZodOptional<z.ZodString>; | ||
/** Unique name of the blockchain node or load balancer */ | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: z.ZodOptional<z.ZodString>; | ||
/** JSON RPC endpoint for the blockchain node or load balancer */ | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: z.ZodOptional<z.ZodString>; | ||
/** Unique name of the Hasura instance */ | ||
@@ -88,4 +94,7 @@ SETTLEMINT_HASURA: z.ZodOptional<z.ZodString>; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE?: string | undefined; | ||
SETTLEMINT_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_HASURA?: string | undefined; | ||
@@ -124,4 +133,7 @@ SETTLEMINT_HASURA_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE?: string | undefined; | ||
SETTLEMINT_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_HASURA?: string | undefined; | ||
@@ -170,4 +182,7 @@ SETTLEMINT_HASURA_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NODE: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_LOAD_BALANCER: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_HASURA: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
@@ -207,4 +222,7 @@ SETTLEMINT_HASURA_ENDPOINT: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE?: string | undefined; | ||
SETTLEMINT_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_HASURA?: string | undefined; | ||
@@ -244,4 +262,7 @@ SETTLEMINT_HASURA_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE?: string | undefined; | ||
SETTLEMINT_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_HASURA?: string | undefined; | ||
@@ -248,0 +269,0 @@ SETTLEMINT_HASURA_ENDPOINT?: string | undefined; |
@@ -24,2 +24,17 @@ /** | ||
declare function tryParseJson<T>(value: string, defaultValue?: T | null): T | null; | ||
/** | ||
* Extracts a JSON object from a string. | ||
* | ||
* @param value - The string to extract the JSON object from | ||
* @returns The parsed JSON object, or null if no JSON object is found | ||
* @throws {Error} If the input string is too long (longer than 5000 characters) | ||
* @example | ||
* import { extractJsonObject } from "@settlemint/sdk-utils"; | ||
* | ||
* const json = extractJsonObject<{ port: number }>( | ||
* 'port info: {"port": 3000}', | ||
* ); | ||
* // Returns: { port: 3000 } | ||
*/ | ||
declare function extractJsonObject<T>(value: string): T | null; | ||
@@ -95,2 +110,2 @@ /** | ||
export { camelCaseToWords, capitalizeFirstLetter, replaceUnderscoresAndHyphensWithSpaces, retryWhenFailed, truncate, tryParseJson }; | ||
export { camelCaseToWords, capitalizeFirstLetter, extractJsonObject, replaceUnderscoresAndHyphensWithSpaces, retryWhenFailed, truncate, tryParseJson }; |
@@ -45,2 +45,17 @@ import { SpawnOptionsWithoutStdio } from 'node:child_process'; | ||
/** | ||
* Error class for command execution errors | ||
* @extends Error | ||
*/ | ||
declare class CommandError extends Error { | ||
readonly code: number; | ||
readonly output: string[]; | ||
/** | ||
* Constructs a new CommandError | ||
* @param message - The error message | ||
* @param code - The exit code of the command | ||
* @param output - The output of the command | ||
*/ | ||
constructor(message: string, code: number, output: string[]); | ||
} | ||
/** | ||
* Executes a command with the given arguments in a child process. | ||
@@ -54,3 +69,3 @@ * Pipes stdin to the child process and captures stdout/stderr output. | ||
* @returns Array of output strings from stdout and stderr | ||
* @throws {Error} If the process fails to start or exits with non-zero code | ||
* @throws {CommandError} If the process fails to start or exits with non-zero code | ||
* @example | ||
@@ -206,2 +221,2 @@ * import { executeCommand } from "@settlemint/sdk-utils/terminal"; | ||
export { CancelError, type ExecuteCommandOptions, SpinnerError, type SpinnerOptions, ascii, cancel, executeCommand, intro, list, maskTokens, note, outro, spinner, table }; | ||
export { CancelError, CommandError, type ExecuteCommandOptions, SpinnerError, type SpinnerOptions, ascii, cancel, executeCommand, intro, list, maskTokens, note, outro, spinner, table }; |
@@ -55,6 +55,12 @@ import { ZodSchema, ZodString, z } from 'zod'; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK: z.ZodOptional<z.ZodString>; | ||
/** Unique name of the blockchain node */ | ||
/** Chain ID of the blockchain network */ | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: z.ZodOptional<z.ZodString>; | ||
/** Unique name of the blockchain node (should have a private key for signing transactions) */ | ||
SETTLEMINT_BLOCKCHAIN_NODE: z.ZodOptional<z.ZodString>; | ||
/** Unique name of the load balancer */ | ||
SETTLEMINT_LOAD_BALANCER: z.ZodOptional<z.ZodString>; | ||
/** JSON RPC endpoint for the blockchain node */ | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: z.ZodOptional<z.ZodString>; | ||
/** Unique name of the blockchain node or load balancer */ | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: z.ZodOptional<z.ZodString>; | ||
/** JSON RPC endpoint for the blockchain node or load balancer */ | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: z.ZodOptional<z.ZodString>; | ||
/** Unique name of the Hasura instance */ | ||
@@ -122,4 +128,7 @@ SETTLEMINT_HASURA: z.ZodOptional<z.ZodString>; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE?: string | undefined; | ||
SETTLEMINT_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_HASURA?: string | undefined; | ||
@@ -158,4 +167,7 @@ SETTLEMINT_HASURA_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE?: string | undefined; | ||
SETTLEMINT_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_HASURA?: string | undefined; | ||
@@ -204,4 +216,7 @@ SETTLEMINT_HASURA_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NODE: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_LOAD_BALANCER: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_HASURA: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
@@ -241,4 +256,7 @@ SETTLEMINT_HASURA_ENDPOINT: z.ZodOptional<z.ZodOptional<z.ZodString>>; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE?: string | undefined; | ||
SETTLEMINT_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_HASURA?: string | undefined; | ||
@@ -278,4 +296,7 @@ SETTLEMINT_HASURA_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE?: string | undefined; | ||
SETTLEMINT_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER?: string | undefined; | ||
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT?: string | undefined; | ||
SETTLEMINT_HASURA?: string | undefined; | ||
@@ -282,0 +303,0 @@ SETTLEMINT_HASURA_ENDPOINT?: string | undefined; |
{ | ||
"name": "@settlemint/sdk-utils", | ||
"description": "Shared utilities and helper functions for SettleMint SDK modules", | ||
"version": "2.1.4", | ||
"version": "2.1.5", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "private": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
598647
6.54%4155
5.38%2063
5.47%21
23.53%