@settlemint/sdk-utils
Advanced tools
Comparing version
{ | ||
"name": "@settlemint/sdk-utils", | ||
"description": "Shared utilities and helper functions for SettleMint SDK modules", | ||
"version": "2.0.0-main9ec47c7b", | ||
"version": "2.0.0-maina59e1ddd", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "private": false, |
@@ -303,3 +303,3 @@ <p align="center"> | ||
> **executeCommand**(`command`, `args`, `options`?): `Promise`\<`string`[]\> | ||
> **executeCommand**(`command`, `args`, `options?`): `Promise`\<`string`[]\> | ||
@@ -318,3 +318,3 @@ Defined in: [sdk/utils/src/terminal/execute-command.ts:31](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/terminal/execute-command.ts#L31) | ||
| `args` | `string`[] | Array of arguments to pass to the command | | ||
| `options`? | [`ExecuteCommandOptions`](#executecommandoptions) | Options for customizing command execution | | ||
| `options?` | [`ExecuteCommandOptions`](#executecommandoptions) | Options for customizing command execution | | ||
@@ -380,3 +380,3 @@ ##### Returns | ||
> **fetchWithRetry**(`input`, `init`?, `maxRetries`?, `initialSleepTime`?): `Promise`\<`Response`\> | ||
> **fetchWithRetry**(`input`, `init?`, `maxRetries?`, `initialSleepTime?`): `Promise`\<`Response`\> | ||
@@ -393,5 +393,5 @@ Defined in: [sdk/utils/src/http/fetch-with-retry.ts:18](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/http/fetch-with-retry.ts#L18) | ||
| `input` | `URL` \| `RequestInfo` | `undefined` | The URL or Request object to fetch | | ||
| `init`? | `RequestInit` | `undefined` | The fetch init options | | ||
| `maxRetries`? | `number` | `5` | Maximum number of retry attempts | | ||
| `initialSleepTime`? | `number` | `3_000` | Initial sleep time between retries in ms | | ||
| `init?` | `RequestInit` | `undefined` | The fetch init options | | ||
| `maxRetries?` | `number` | `5` | Maximum number of retry attempts | | ||
| `initialSleepTime?` | `number` | `3_000` | Initial sleep time between retries in ms | | ||
@@ -512,3 +512,3 @@ ##### Returns | ||
> **getPackageManager**(`targetDir`?): `Promise`\<`AgentName`\> | ||
> **getPackageManager**(`targetDir?`): `Promise`\<`AgentName`\> | ||
@@ -523,3 +523,3 @@ Defined in: [sdk/utils/src/package-manager/get-package-manager.ts:15](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/package-manager/get-package-manager.ts#L15) | ||
| ------ | ------ | ------ | | ||
| `targetDir`? | `string` | The directory to check for package manager (optional, defaults to process.cwd()) | | ||
| `targetDir?` | `string` | The directory to check for package manager (optional, defaults to process.cwd()) | | ||
@@ -545,3 +545,3 @@ ##### Returns | ||
> **getPackageManagerExecutable**(`targetDir`?): `Promise`\<\{ `args`: `string`[]; `command`: `string`; \}\> | ||
> **getPackageManagerExecutable**(`targetDir?`): `Promise`\<\{ `args`: `string`[]; `command`: `string`; \}\> | ||
@@ -556,3 +556,3 @@ Defined in: [sdk/utils/src/package-manager/get-package-manager-executable.ts:14](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/package-manager/get-package-manager-executable.ts#L14) | ||
| ------ | ------ | ------ | | ||
| `targetDir`? | `string` | The directory to check for package manager (optional, defaults to process.cwd()) | | ||
| `targetDir?` | `string` | The directory to check for package manager (optional, defaults to process.cwd()) | | ||
@@ -578,3 +578,3 @@ ##### Returns | ||
> **graphqlFetchWithRetry**\<`Data`\>(`input`, `init`?, `maxRetries`?, `initialSleepTime`?): `Promise`\<`Data`\> | ||
> **graphqlFetchWithRetry**\<`Data`\>(`input`, `init?`, `maxRetries?`, `initialSleepTime?`): `Promise`\<`Data`\> | ||
@@ -598,5 +598,5 @@ Defined in: [sdk/utils/src/http/graphql-fetch-with-retry.ts:34](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/http/graphql-fetch-with-retry.ts#L34) | ||
| `input` | `URL` \| `RequestInfo` | `undefined` | The URL or Request object for the GraphQL endpoint | | ||
| `init`? | `RequestInit` | `undefined` | Optional fetch configuration options | | ||
| `maxRetries`? | `number` | `5` | Maximum retry attempts before failing (default: 5) | | ||
| `initialSleepTime`? | `number` | `3_000` | Initial delay between retries in milliseconds (default: 3000) | | ||
| `init?` | `RequestInit` | `undefined` | Optional fetch configuration options | | ||
| `maxRetries?` | `number` | `5` | Maximum retry attempts before failing (default: 5) | | ||
| `initialSleepTime?` | `number` | `3_000` | Initial delay between retries in milliseconds (default: 3000) | | ||
@@ -639,3 +639,3 @@ ##### Returns | ||
> **installDependencies**(`pkgs`, `cwd`?): `Promise`\<`void`\> | ||
> **installDependencies**(`pkgs`, `cwd?`): `Promise`\<`void`\> | ||
@@ -651,3 +651,3 @@ Defined in: [sdk/utils/src/package-manager/install-dependencies.ts:20](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/package-manager/install-dependencies.ts#L20) | ||
| `pkgs` | `string` \| `string`[] | A single package name or array of package names to install | | ||
| `cwd`? | `string` | The directory to run the installation in | | ||
| `cwd?` | `string` | The directory to run the installation in | | ||
@@ -742,3 +742,3 @@ ##### Returns | ||
> **isPackageInstalled**(`name`, `path`?): `Promise`\<`boolean`\> | ||
> **isPackageInstalled**(`name`, `path?`): `Promise`\<`boolean`\> | ||
@@ -754,3 +754,3 @@ Defined in: [sdk/utils/src/package-manager/is-package-installed.ts:17](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/package-manager/is-package-installed.ts#L17) | ||
| `name` | `string` | The name of the package to check | | ||
| `path`? | `string` | The path to the project root directory. If not provided, will be automatically determined | | ||
| `path?` | `string` | The path to the project root directory. If not provided, will be automatically determined | | ||
@@ -965,3 +965,3 @@ ##### Returns | ||
> **projectRoot**(`fallbackToCwd`, `cwd`?): `Promise`\<`string`\> | ||
> **projectRoot**(`fallbackToCwd`, `cwd?`): `Promise`\<`string`\> | ||
@@ -977,3 +977,3 @@ Defined in: [sdk/utils/src/filesystem/project-root.ts:18](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/filesystem/project-root.ts#L18) | ||
| `fallbackToCwd` | `boolean` | `false` | If true, will return the current working directory if no package.json is found | | ||
| `cwd`? | `string` | `undefined` | The directory to start searching for the package.json file from (defaults to process.cwd()) | | ||
| `cwd?` | `string` | `undefined` | The directory to start searching for the package.json file from (defaults to process.cwd()) | | ||
@@ -1035,3 +1035,3 @@ ##### Returns | ||
> **retryWhenFailed**\<`T`\>(`fn`, `maxRetries`, `initialSleepTime`, `stopOnError`?): `Promise`\<`T`\> | ||
> **retryWhenFailed**\<`T`\>(`fn`, `maxRetries`, `initialSleepTime`, `stopOnError?`): `Promise`\<`T`\> | ||
@@ -1055,3 +1055,3 @@ Defined in: [sdk/utils/src/retry.ts:14](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/retry.ts#L14) | ||
| `initialSleepTime` | `number` | `1_000` | The initial time to sleep between exponential backoff retries. | | ||
| `stopOnError`? | (`error`) => `boolean` | `undefined` | The function to stop on error. | | ||
| `stopOnError?` | (`error`) => `boolean` | `undefined` | The function to stop on error. | | ||
@@ -1077,3 +1077,3 @@ ##### Returns | ||
> **setName**(`name`, `path`?): `Promise`\<`void`\> | ||
> **setName**(`name`, `path?`): `Promise`\<`void`\> | ||
@@ -1089,3 +1089,3 @@ Defined in: [sdk/utils/src/package-manager/set-name.ts:16](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/package-manager/set-name.ts#L16) | ||
| `name` | `string` | The new name to set in the package.json file | | ||
| `path`? | `string` | The path to the project root directory. If not provided, will be automatically determined | | ||
| `path?` | `string` | The path to the project root directory. If not provided, will be automatically determined | | ||
@@ -1297,3 +1297,3 @@ ##### Returns | ||
| `options` | \{ `cwd`: `string`; `env`: `Partial`\<\{ `SETTLEMINT_ACCESS_TOKEN`: `string`; `SETTLEMINT_ACCESSIBLE_PRIVATE_KEY`: `string`; `SETTLEMINT_APPLICATION`: `string`; `SETTLEMINT_BLOCKCHAIN_NETWORK`: `string`; `SETTLEMINT_BLOCKCHAIN_NODE`: `string`; `SETTLEMINT_BLOCKSCOUT`: `string`; `SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT`: `string`; `SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT`: `string`; `SETTLEMINT_CUSTOM_DEPLOYMENT`: `string`; `SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT`: `string`; `SETTLEMINT_HASURA`: `string`; `SETTLEMINT_HASURA_ADMIN_SECRET`: `string`; `SETTLEMINT_HASURA_DATABASE_URL`: `string`; `SETTLEMINT_HASURA_ENDPOINT`: `string`; `SETTLEMINT_HD_PRIVATE_KEY`: `string`; `SETTLEMINT_INSTANCE`: `string`; `SETTLEMINT_IPFS`: `string`; `SETTLEMINT_IPFS_API_ENDPOINT`: `string`; `SETTLEMINT_IPFS_GATEWAY_ENDPOINT`: `string`; `SETTLEMINT_IPFS_PINNING_ENDPOINT`: `string`; `SETTLEMINT_LOAD_BALANCER`: `string`; `SETTLEMINT_MINIO`: `string`; `SETTLEMINT_MINIO_ACCESS_KEY`: `string`; `SETTLEMINT_MINIO_ENDPOINT`: `string`; `SETTLEMINT_MINIO_SECRET_KEY`: `string`; `SETTLEMINT_NEW_PROJECT_NAME`: `string`; `SETTLEMINT_PORTAL`: `string`; `SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT`: `string`; `SETTLEMINT_PORTAL_REST_ENDPOINT`: `string`; `SETTLEMINT_THEGRAPH`: `string`; `SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH`: `string`; `SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS`: `string`[]; `SETTLEMINT_WORKSPACE`: `string`; \}\>; `prod`: `boolean`; `secrets`: `boolean`; \} | The options for writing the environment variables | | ||
| `options.cwd`? | `string` | The directory to start searching for the package.json file from (defaults to process.cwd()) | | ||
| `options.cwd?` | `string` | The directory to start searching for the package.json file from (defaults to process.cwd()) | | ||
| `options.env` | `Partial`\<\{ `SETTLEMINT_ACCESS_TOKEN`: `string`; `SETTLEMINT_ACCESSIBLE_PRIVATE_KEY`: `string`; `SETTLEMINT_APPLICATION`: `string`; `SETTLEMINT_BLOCKCHAIN_NETWORK`: `string`; `SETTLEMINT_BLOCKCHAIN_NODE`: `string`; `SETTLEMINT_BLOCKSCOUT`: `string`; `SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT`: `string`; `SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT`: `string`; `SETTLEMINT_CUSTOM_DEPLOYMENT`: `string`; `SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT`: `string`; `SETTLEMINT_HASURA`: `string`; `SETTLEMINT_HASURA_ADMIN_SECRET`: `string`; `SETTLEMINT_HASURA_DATABASE_URL`: `string`; `SETTLEMINT_HASURA_ENDPOINT`: `string`; `SETTLEMINT_HD_PRIVATE_KEY`: `string`; `SETTLEMINT_INSTANCE`: `string`; `SETTLEMINT_IPFS`: `string`; `SETTLEMINT_IPFS_API_ENDPOINT`: `string`; `SETTLEMINT_IPFS_GATEWAY_ENDPOINT`: `string`; `SETTLEMINT_IPFS_PINNING_ENDPOINT`: `string`; `SETTLEMINT_LOAD_BALANCER`: `string`; `SETTLEMINT_MINIO`: `string`; `SETTLEMINT_MINIO_ACCESS_KEY`: `string`; `SETTLEMINT_MINIO_ENDPOINT`: `string`; `SETTLEMINT_MINIO_SECRET_KEY`: `string`; `SETTLEMINT_NEW_PROJECT_NAME`: `string`; `SETTLEMINT_PORTAL`: `string`; `SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT`: `string`; `SETTLEMINT_PORTAL_REST_ENDPOINT`: `string`; `SETTLEMINT_THEGRAPH`: `string`; `SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH`: `string`; `SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS`: `string`[]; `SETTLEMINT_WORKSPACE`: `string`; \}\> | The environment variables to write | | ||
@@ -1401,3 +1401,3 @@ | `options.prod` | `boolean` | Whether to write production environment variables | | ||
| <a id="stopmessage"></a> `stopMessage` | `string` | Message to display when spinner completes successfully | [sdk/utils/src/terminal/spinner.ts:30](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/terminal/spinner.ts#L30) | | ||
| <a id="task"></a> `task` | (`spinner`?: `Spinner`) => `Promise`\<`R`\> | Async task to execute while spinner is active | [sdk/utils/src/terminal/spinner.ts:28](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/terminal/spinner.ts#L28) | | ||
| <a id="task"></a> `task` | (`spinner?`) => `Promise`\<`R`\> | Async task to execute while spinner is active | [sdk/utils/src/terminal/spinner.ts:28](https://github.com/settlemint/sdk/blob/v2.0.0/sdk/utils/src/terminal/spinner.ts#L28) | | ||
@@ -1404,0 +1404,0 @@ ### Type Aliases |
501099
0