@settlemint/sdk-utils 2.3.8 → 2.3.11-main4a16f017
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/README.md +91 -80
- package/dist/environment.cjs +4501 -3924
- package/dist/environment.cjs.map +1 -1
- package/dist/environment.d.cts +7 -31
- package/dist/environment.d.ts +7 -31
- package/dist/environment.js +4501 -3924
- package/dist/environment.js.map +1 -1
- package/dist/filesystem.d.cts +1 -17
- package/dist/filesystem.d.ts +1 -17
- package/dist/http.d.cts +0 -4
- package/dist/http.d.ts +0 -4
- package/dist/index.d.cts +0 -4
- package/dist/index.d.ts +0 -4
- package/dist/json.d.cts +0 -1
- package/dist/json.d.ts +0 -1
- package/dist/logging.d.cts +2 -3
- package/dist/logging.d.ts +2 -3
- package/dist/package-manager.d.cts +1 -16
- package/dist/package-manager.d.ts +1 -16
- package/dist/retry.d.cts +0 -1
- package/dist/retry.d.ts +0 -1
- package/dist/runtime.d.cts +0 -1
- package/dist/runtime.d.ts +0 -1
- package/dist/string.d.cts +0 -1
- package/dist/string.d.ts +0 -1
- package/dist/terminal.d.cts +1 -20
- package/dist/terminal.d.ts +1 -20
- package/dist/url.d.cts +0 -1
- package/dist/url.d.ts +0 -1
- package/dist/validation.cjs +4503 -3925
- package/dist/validation.cjs.map +1 -1
- package/dist/validation.d.cts +8 -30
- package/dist/validation.d.ts +8 -30
- package/dist/validation.js +4503 -3926
- package/dist/validation.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
- [DotEnvSchema](#dotenvschema)
|
|
90
90
|
- [DotEnvSchemaPartial](#dotenvschemapartial)
|
|
91
91
|
- [IdSchema](#idschema)
|
|
92
|
+
- [LOCAL\_INSTANCE](#local_instance)
|
|
92
93
|
- [PersonalAccessTokenSchema](#personalaccesstokenschema)
|
|
93
94
|
- [runsInBrowser](#runsinbrowser)
|
|
94
95
|
- [runsOnServer](#runsonserver)
|
|
@@ -112,7 +113,7 @@ The SettleMint Utils SDK provides a collection of shared utilities and helper fu
|
|
|
112
113
|
|
|
113
114
|
> **ascii**(): `void`
|
|
114
115
|
|
|
115
|
-
Defined in: [sdk/utils/src/terminal/ascii.ts:14](https://github.com/settlemint/sdk/blob/v2.3.
|
|
116
|
+
Defined in: [sdk/utils/src/terminal/ascii.ts:14](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/ascii.ts#L14)
|
|
116
117
|
|
|
117
118
|
Prints the SettleMint ASCII art logo to the console in magenta color.
|
|
118
119
|
Used for CLI branding and visual identification.
|
|
@@ -136,7 +137,7 @@ ascii();
|
|
|
136
137
|
|
|
137
138
|
> **camelCaseToWords**(`s`): `string`
|
|
138
139
|
|
|
139
|
-
Defined in: [sdk/utils/src/string.ts:29](https://github.com/settlemint/sdk/blob/v2.3.
|
|
140
|
+
Defined in: [sdk/utils/src/string.ts:29](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/string.ts#L29)
|
|
140
141
|
|
|
141
142
|
Converts a camelCase string to a human-readable string.
|
|
142
143
|
|
|
@@ -167,7 +168,7 @@ const words = camelCaseToWords("camelCaseString");
|
|
|
167
168
|
|
|
168
169
|
> **cancel**(`msg`): `never`
|
|
169
170
|
|
|
170
|
-
Defined in: [sdk/utils/src/terminal/cancel.ts:23](https://github.com/settlemint/sdk/blob/v2.3.
|
|
171
|
+
Defined in: [sdk/utils/src/terminal/cancel.ts:23](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/cancel.ts#L23)
|
|
171
172
|
|
|
172
173
|
Displays an error message in red inverse text and throws a CancelError.
|
|
173
174
|
Used to terminate execution with a visible error message.
|
|
@@ -200,7 +201,7 @@ cancel("An error occurred");
|
|
|
200
201
|
|
|
201
202
|
> **capitalizeFirstLetter**(`val`): `string`
|
|
202
203
|
|
|
203
|
-
Defined in: [sdk/utils/src/string.ts:13](https://github.com/settlemint/sdk/blob/v2.3.
|
|
204
|
+
Defined in: [sdk/utils/src/string.ts:13](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/string.ts#L13)
|
|
204
205
|
|
|
205
206
|
Capitalizes the first letter of a string.
|
|
206
207
|
|
|
@@ -231,7 +232,7 @@ const capitalized = capitalizeFirstLetter("hello");
|
|
|
231
232
|
|
|
232
233
|
> **createLogger**(`options`): [`Logger`](#logger)
|
|
233
234
|
|
|
234
|
-
Defined in: [sdk/utils/src/logging/logger.ts:50](https://github.com/settlemint/sdk/blob/v2.3.
|
|
235
|
+
Defined in: [sdk/utils/src/logging/logger.ts:50](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/logger.ts#L50)
|
|
235
236
|
|
|
236
237
|
Creates a simple logger with configurable log level
|
|
237
238
|
|
|
@@ -264,7 +265,7 @@ logger.error('Operation failed', new Error('Connection timeout'));
|
|
|
264
265
|
|
|
265
266
|
> **emptyDir**(`dir`): `Promise`\<`void`\>
|
|
266
267
|
|
|
267
|
-
Defined in: [sdk/utils/src/package-manager/download-and-extract.ts:45](https://github.com/settlemint/sdk/blob/v2.3.
|
|
268
|
+
Defined in: [sdk/utils/src/package-manager/download-and-extract.ts:45](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/package-manager/download-and-extract.ts#L45)
|
|
268
269
|
|
|
269
270
|
Removes all contents of a directory except the .git folder
|
|
270
271
|
|
|
@@ -292,7 +293,7 @@ await emptyDir("/path/to/dir"); // Removes all contents except .git
|
|
|
292
293
|
|
|
293
294
|
> **ensureBrowser**(): `void`
|
|
294
295
|
|
|
295
|
-
Defined in: [sdk/utils/src/runtime/ensure-server.ts:31](https://github.com/settlemint/sdk/blob/v2.3.
|
|
296
|
+
Defined in: [sdk/utils/src/runtime/ensure-server.ts:31](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/runtime/ensure-server.ts#L31)
|
|
296
297
|
|
|
297
298
|
Ensures that code is running in a browser environment and not on the server.
|
|
298
299
|
|
|
@@ -319,7 +320,7 @@ ensureBrowser();
|
|
|
319
320
|
|
|
320
321
|
> **ensureServer**(): `void`
|
|
321
322
|
|
|
322
|
-
Defined in: [sdk/utils/src/runtime/ensure-server.ts:13](https://github.com/settlemint/sdk/blob/v2.3.
|
|
323
|
+
Defined in: [sdk/utils/src/runtime/ensure-server.ts:13](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/runtime/ensure-server.ts#L13)
|
|
323
324
|
|
|
324
325
|
Ensures that code is running on the server and not in a browser environment.
|
|
325
326
|
|
|
@@ -346,7 +347,7 @@ ensureServer();
|
|
|
346
347
|
|
|
347
348
|
> **executeCommand**(`command`, `args`, `options?`): `Promise`\<`string`[]\>
|
|
348
349
|
|
|
349
|
-
Defined in: [sdk/utils/src/terminal/execute-command.ts:51](https://github.com/settlemint/sdk/blob/v2.3.
|
|
350
|
+
Defined in: [sdk/utils/src/terminal/execute-command.ts:51](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/execute-command.ts#L51)
|
|
350
351
|
|
|
351
352
|
Executes a command with the given arguments in a child process.
|
|
352
353
|
Pipes stdin to the child process and captures stdout/stderr output.
|
|
@@ -388,7 +389,7 @@ await executeCommand("npm", ["install"], { silent: true });
|
|
|
388
389
|
|
|
389
390
|
> **exists**(`path`): `Promise`\<`boolean`\>
|
|
390
391
|
|
|
391
|
-
Defined in: [sdk/utils/src/filesystem/exists.ts:17](https://github.com/settlemint/sdk/blob/v2.3.
|
|
392
|
+
Defined in: [sdk/utils/src/filesystem/exists.ts:17](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/filesystem/exists.ts#L17)
|
|
392
393
|
|
|
393
394
|
Checks if a file or directory exists at the given path
|
|
394
395
|
|
|
@@ -421,7 +422,7 @@ if (await exists('/path/to/file.txt')) {
|
|
|
421
422
|
|
|
422
423
|
> **extractBaseUrlBeforeSegment**(`baseUrl`, `pathSegment`): `string`
|
|
423
424
|
|
|
424
|
-
Defined in: [sdk/utils/src/url.ts:15](https://github.com/settlemint/sdk/blob/v2.3.
|
|
425
|
+
Defined in: [sdk/utils/src/url.ts:15](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/url.ts#L15)
|
|
425
426
|
|
|
426
427
|
Extracts the base URL before a specific segment in a URL.
|
|
427
428
|
|
|
@@ -453,7 +454,7 @@ const baseUrl = extractBaseUrlBeforeSegment("https://example.com/api/v1/subgraph
|
|
|
453
454
|
|
|
454
455
|
> **extractJsonObject**\<`T`\>(`value`): `null` \| `T`
|
|
455
456
|
|
|
456
|
-
Defined in: [sdk/utils/src/json.ts:50](https://github.com/settlemint/sdk/blob/v2.3.
|
|
457
|
+
Defined in: [sdk/utils/src/json.ts:50](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/json.ts#L50)
|
|
457
458
|
|
|
458
459
|
Extracts a JSON object from a string.
|
|
459
460
|
|
|
@@ -496,7 +497,7 @@ const json = extractJsonObject<{ port: number }>(
|
|
|
496
497
|
|
|
497
498
|
> **fetchWithRetry**(`input`, `init?`, `maxRetries?`, `initialSleepTime?`): `Promise`\<`Response`\>
|
|
498
499
|
|
|
499
|
-
Defined in: [sdk/utils/src/http/fetch-with-retry.ts:18](https://github.com/settlemint/sdk/blob/v2.3.
|
|
500
|
+
Defined in: [sdk/utils/src/http/fetch-with-retry.ts:18](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/http/fetch-with-retry.ts#L18)
|
|
500
501
|
|
|
501
502
|
Retry an HTTP request with exponential backoff and jitter.
|
|
502
503
|
Only retries on server errors (5xx), rate limits (429), timeouts (408), and network errors.
|
|
@@ -534,7 +535,7 @@ const response = await fetchWithRetry("https://api.example.com/data");
|
|
|
534
535
|
|
|
535
536
|
> **findMonoRepoPackages**(`projectDir`): `Promise`\<`string`[]\>
|
|
536
537
|
|
|
537
|
-
Defined in: [sdk/utils/src/filesystem/mono-repo.ts:59](https://github.com/settlemint/sdk/blob/v2.3.
|
|
538
|
+
Defined in: [sdk/utils/src/filesystem/mono-repo.ts:59](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/filesystem/mono-repo.ts#L59)
|
|
538
539
|
|
|
539
540
|
Finds all packages in a monorepo
|
|
540
541
|
|
|
@@ -565,7 +566,7 @@ console.log(packages); // Output: ["/path/to/your/project/packages/core", "/path
|
|
|
565
566
|
|
|
566
567
|
> **findMonoRepoRoot**(`startDir`): `Promise`\<`null` \| `string`\>
|
|
567
568
|
|
|
568
|
-
Defined in: [sdk/utils/src/filesystem/mono-repo.ts:19](https://github.com/settlemint/sdk/blob/v2.3.
|
|
569
|
+
Defined in: [sdk/utils/src/filesystem/mono-repo.ts:19](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/filesystem/mono-repo.ts#L19)
|
|
569
570
|
|
|
570
571
|
Finds the root directory of a monorepo
|
|
571
572
|
|
|
@@ -596,7 +597,7 @@ console.log(root); // Output: /path/to/your/project/packages/core
|
|
|
596
597
|
|
|
597
598
|
> **formatTargetDir**(`targetDir`): `string`
|
|
598
599
|
|
|
599
|
-
Defined in: [sdk/utils/src/package-manager/download-and-extract.ts:15](https://github.com/settlemint/sdk/blob/v2.3.
|
|
600
|
+
Defined in: [sdk/utils/src/package-manager/download-and-extract.ts:15](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/package-manager/download-and-extract.ts#L15)
|
|
600
601
|
|
|
601
602
|
Formats a directory path by removing trailing slashes and whitespace
|
|
602
603
|
|
|
@@ -626,7 +627,7 @@ const formatted = formatTargetDir("/path/to/dir/ "); // "/path/to/dir"
|
|
|
626
627
|
|
|
627
628
|
> **getPackageManager**(`targetDir?`): `Promise`\<`AgentName`\>
|
|
628
629
|
|
|
629
|
-
Defined in: [sdk/utils/src/package-manager/get-package-manager.ts:15](https://github.com/settlemint/sdk/blob/v2.3.
|
|
630
|
+
Defined in: [sdk/utils/src/package-manager/get-package-manager.ts:15](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/package-manager/get-package-manager.ts#L15)
|
|
630
631
|
|
|
631
632
|
Detects the package manager used in the current project
|
|
632
633
|
|
|
@@ -657,7 +658,7 @@ console.log(`Using ${packageManager}`);
|
|
|
657
658
|
|
|
658
659
|
> **getPackageManagerExecutable**(`targetDir?`): `Promise`\<\{ `args`: `string`[]; `command`: `string`; \}\>
|
|
659
660
|
|
|
660
|
-
Defined in: [sdk/utils/src/package-manager/get-package-manager-executable.ts:14](https://github.com/settlemint/sdk/blob/v2.3.
|
|
661
|
+
Defined in: [sdk/utils/src/package-manager/get-package-manager-executable.ts:14](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/package-manager/get-package-manager-executable.ts#L14)
|
|
661
662
|
|
|
662
663
|
Retrieves the executable command and arguments for the package manager
|
|
663
664
|
|
|
@@ -688,7 +689,7 @@ console.log(`Using ${command} with args: ${args.join(" ")}`);
|
|
|
688
689
|
|
|
689
690
|
> **graphqlFetchWithRetry**\<`Data`\>(`input`, `init?`, `maxRetries?`, `initialSleepTime?`): `Promise`\<`Data`\>
|
|
690
691
|
|
|
691
|
-
Defined in: [sdk/utils/src/http/graphql-fetch-with-retry.ts:34](https://github.com/settlemint/sdk/blob/v2.3.
|
|
692
|
+
Defined in: [sdk/utils/src/http/graphql-fetch-with-retry.ts:34](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/http/graphql-fetch-with-retry.ts#L34)
|
|
692
693
|
|
|
693
694
|
Executes a GraphQL request with automatic retries using exponential backoff and jitter.
|
|
694
695
|
Only retries on server errors (5xx), rate limits (429), timeouts (408), and network errors.
|
|
@@ -747,7 +748,7 @@ const data = await graphqlFetchWithRetry<{ user: { id: string } }>(
|
|
|
747
748
|
|
|
748
749
|
> **installDependencies**(`pkgs`, `cwd?`): `Promise`\<`void`\>
|
|
749
750
|
|
|
750
|
-
Defined in: [sdk/utils/src/package-manager/install-dependencies.ts:20](https://github.com/settlemint/sdk/blob/v2.3.
|
|
751
|
+
Defined in: [sdk/utils/src/package-manager/install-dependencies.ts:20](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/package-manager/install-dependencies.ts#L20)
|
|
751
752
|
|
|
752
753
|
Installs one or more packages as dependencies using the detected package manager
|
|
753
754
|
|
|
@@ -786,7 +787,7 @@ await installDependencies(["express", "cors"]);
|
|
|
786
787
|
|
|
787
788
|
> **intro**(`msg`): `void`
|
|
788
789
|
|
|
789
|
-
Defined in: [sdk/utils/src/terminal/intro.ts:16](https://github.com/settlemint/sdk/blob/v2.3.
|
|
790
|
+
Defined in: [sdk/utils/src/terminal/intro.ts:16](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/intro.ts#L16)
|
|
790
791
|
|
|
791
792
|
Displays an introductory message in magenta text with padding.
|
|
792
793
|
Any sensitive tokens in the message are masked before display.
|
|
@@ -816,7 +817,7 @@ intro("Starting deployment...");
|
|
|
816
817
|
|
|
817
818
|
> **isEmpty**(`path`): `Promise`\<`boolean`\>
|
|
818
819
|
|
|
819
|
-
Defined in: [sdk/utils/src/package-manager/download-and-extract.ts:31](https://github.com/settlemint/sdk/blob/v2.3.
|
|
820
|
+
Defined in: [sdk/utils/src/package-manager/download-and-extract.ts:31](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/package-manager/download-and-extract.ts#L31)
|
|
820
821
|
|
|
821
822
|
Checks if a directory is empty or contains only a .git folder
|
|
822
823
|
|
|
@@ -848,7 +849,7 @@ if (await isEmpty("/path/to/dir")) {
|
|
|
848
849
|
|
|
849
850
|
> **isPackageInstalled**(`name`, `path?`): `Promise`\<`boolean`\>
|
|
850
851
|
|
|
851
|
-
Defined in: [sdk/utils/src/package-manager/is-package-installed.ts:17](https://github.com/settlemint/sdk/blob/v2.3.
|
|
852
|
+
Defined in: [sdk/utils/src/package-manager/is-package-installed.ts:17](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/package-manager/is-package-installed.ts#L17)
|
|
852
853
|
|
|
853
854
|
Checks if a package is installed in the project's dependencies, devDependencies, or peerDependencies.
|
|
854
855
|
|
|
@@ -884,7 +885,7 @@ console.log(`@settlemint/sdk-utils is installed: ${isInstalled}`);
|
|
|
884
885
|
|
|
885
886
|
> **list**(`title`, `items`): `void`
|
|
886
887
|
|
|
887
|
-
Defined in: [sdk/utils/src/terminal/list.ts:23](https://github.com/settlemint/sdk/blob/v2.3.
|
|
888
|
+
Defined in: [sdk/utils/src/terminal/list.ts:23](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/list.ts#L23)
|
|
888
889
|
|
|
889
890
|
Displays a list of items in a formatted manner, supporting nested items.
|
|
890
891
|
|
|
@@ -924,7 +925,7 @@ list("Providers", [
|
|
|
924
925
|
|
|
925
926
|
> **loadEnv**\<`T`\>(`validateEnv`, `prod`, `path`): `Promise`\<`T` *extends* `true` ? `object` : `object`\>
|
|
926
927
|
|
|
927
|
-
Defined in: [sdk/utils/src/environment/load-env.ts:25](https://github.com/settlemint/sdk/blob/v2.3.
|
|
928
|
+
Defined in: [sdk/utils/src/environment/load-env.ts:25](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/environment/load-env.ts#L25)
|
|
928
929
|
|
|
929
930
|
Loads environment variables from .env files.
|
|
930
931
|
To enable encryption with dotenvx (https://www.dotenvx.com/docs) run `bunx dotenvx encrypt`
|
|
@@ -972,7 +973,7 @@ const rawEnv = await loadEnv(false, false);
|
|
|
972
973
|
|
|
973
974
|
> **makeJsonStringifiable**\<`T`\>(`value`): `T`
|
|
974
975
|
|
|
975
|
-
Defined in: [sdk/utils/src/json.ts:73](https://github.com/settlemint/sdk/blob/v2.3.
|
|
976
|
+
Defined in: [sdk/utils/src/json.ts:73](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/json.ts#L73)
|
|
976
977
|
|
|
977
978
|
Converts a value to a JSON stringifiable format.
|
|
978
979
|
|
|
@@ -1009,7 +1010,7 @@ const json = makeJsonStringifiable<{ amount: bigint }>({ amount: BigInt(1000) })
|
|
|
1009
1010
|
|
|
1010
1011
|
> **maskTokens**(`output`): `string`
|
|
1011
1012
|
|
|
1012
|
-
Defined in: [sdk/utils/src/logging/mask-tokens.ts:13](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1013
|
+
Defined in: [sdk/utils/src/logging/mask-tokens.ts:13](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/mask-tokens.ts#L13)
|
|
1013
1014
|
|
|
1014
1015
|
Masks sensitive SettleMint tokens in output text by replacing them with asterisks.
|
|
1015
1016
|
Handles personal access tokens (PAT), application access tokens (AAT), and service account tokens (SAT).
|
|
@@ -1041,7 +1042,7 @@ const masked = maskTokens("Token: sm_pat_****"); // "Token: ***"
|
|
|
1041
1042
|
|
|
1042
1043
|
> **note**(`message`, `level`): `void`
|
|
1043
1044
|
|
|
1044
|
-
Defined in: [sdk/utils/src/terminal/note.ts:21](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1045
|
+
Defined in: [sdk/utils/src/terminal/note.ts:21](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/note.ts#L21)
|
|
1045
1046
|
|
|
1046
1047
|
Displays a note message with optional warning level formatting.
|
|
1047
1048
|
Regular notes are displayed in normal text, while warnings are shown in yellow.
|
|
@@ -1076,7 +1077,7 @@ note("Low disk space remaining", "warn");
|
|
|
1076
1077
|
|
|
1077
1078
|
> **outro**(`msg`): `void`
|
|
1078
1079
|
|
|
1079
|
-
Defined in: [sdk/utils/src/terminal/outro.ts:16](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1080
|
+
Defined in: [sdk/utils/src/terminal/outro.ts:16](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/outro.ts#L16)
|
|
1080
1081
|
|
|
1081
1082
|
Displays a closing message in green inverted text with padding.
|
|
1082
1083
|
Any sensitive tokens in the message are masked before display.
|
|
@@ -1106,7 +1107,7 @@ outro("Deployment completed successfully!");
|
|
|
1106
1107
|
|
|
1107
1108
|
> **projectRoot**(`fallbackToCwd`, `cwd?`): `Promise`\<`string`\>
|
|
1108
1109
|
|
|
1109
|
-
Defined in: [sdk/utils/src/filesystem/project-root.ts:18](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1110
|
+
Defined in: [sdk/utils/src/filesystem/project-root.ts:18](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/filesystem/project-root.ts#L18)
|
|
1110
1111
|
|
|
1111
1112
|
Finds the root directory of the current project by locating the nearest package.json file
|
|
1112
1113
|
|
|
@@ -1143,7 +1144,7 @@ console.log(`Project root is at: ${rootDir}`);
|
|
|
1143
1144
|
|
|
1144
1145
|
> **replaceUnderscoresAndHyphensWithSpaces**(`s`): `string`
|
|
1145
1146
|
|
|
1146
|
-
Defined in: [sdk/utils/src/string.ts:48](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1147
|
+
Defined in: [sdk/utils/src/string.ts:48](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/string.ts#L48)
|
|
1147
1148
|
|
|
1148
1149
|
Replaces underscores and hyphens with spaces.
|
|
1149
1150
|
|
|
@@ -1174,7 +1175,7 @@ const result = replaceUnderscoresAndHyphensWithSpaces("Already_Spaced-Second");
|
|
|
1174
1175
|
|
|
1175
1176
|
> **requestLogger**(`logger`, `name`, `fn`): (...`args`) => `Promise`\<`Response`\>
|
|
1176
1177
|
|
|
1177
|
-
Defined in: [sdk/utils/src/logging/request-logger.ts:14](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1178
|
+
Defined in: [sdk/utils/src/logging/request-logger.ts:14](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/request-logger.ts#L14)
|
|
1178
1179
|
|
|
1179
1180
|
Logs the request and duration of a fetch call (> 500ms is logged as warn, otherwise info)
|
|
1180
1181
|
|
|
@@ -1208,7 +1209,7 @@ The fetch function
|
|
|
1208
1209
|
|
|
1209
1210
|
> **retryWhenFailed**\<`T`\>(`fn`, `maxRetries`, `initialSleepTime`, `stopOnError?`): `Promise`\<`T`\>
|
|
1210
1211
|
|
|
1211
|
-
Defined in: [sdk/utils/src/retry.ts:16](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1212
|
+
Defined in: [sdk/utils/src/retry.ts:16](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/retry.ts#L16)
|
|
1212
1213
|
|
|
1213
1214
|
Retry a function when it fails.
|
|
1214
1215
|
|
|
@@ -1248,7 +1249,7 @@ const result = await retryWhenFailed(() => readFile("/path/to/file.txt"), 3, 1_0
|
|
|
1248
1249
|
|
|
1249
1250
|
> **setName**(`name`, `path?`): `Promise`\<`void`\>
|
|
1250
1251
|
|
|
1251
|
-
Defined in: [sdk/utils/src/package-manager/set-name.ts:16](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1252
|
+
Defined in: [sdk/utils/src/package-manager/set-name.ts:16](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/package-manager/set-name.ts#L16)
|
|
1252
1253
|
|
|
1253
1254
|
Sets the name field in the package.json file
|
|
1254
1255
|
|
|
@@ -1283,7 +1284,7 @@ await setName("my-new-project-name");
|
|
|
1283
1284
|
|
|
1284
1285
|
> **spinner**\<`R`\>(`options`): `Promise`\<`R`\>
|
|
1285
1286
|
|
|
1286
|
-
Defined in: [sdk/utils/src/terminal/spinner.ts:55](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1287
|
+
Defined in: [sdk/utils/src/terminal/spinner.ts:55](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/spinner.ts#L55)
|
|
1287
1288
|
|
|
1288
1289
|
Displays a loading spinner while executing an async task.
|
|
1289
1290
|
Shows progress with start/stop messages and handles errors.
|
|
@@ -1333,7 +1334,7 @@ const result = await spinner({
|
|
|
1333
1334
|
|
|
1334
1335
|
> **table**(`title`, `data`): `void`
|
|
1335
1336
|
|
|
1336
|
-
Defined in: [sdk/utils/src/terminal/table.ts:21](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1337
|
+
Defined in: [sdk/utils/src/terminal/table.ts:21](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/table.ts#L21)
|
|
1337
1338
|
|
|
1338
1339
|
Displays data in a formatted table in the terminal.
|
|
1339
1340
|
|
|
@@ -1367,7 +1368,7 @@ table("My Table", data);
|
|
|
1367
1368
|
|
|
1368
1369
|
> **truncate**(`value`, `maxLength`): `string`
|
|
1369
1370
|
|
|
1370
|
-
Defined in: [sdk/utils/src/string.ts:65](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1371
|
+
Defined in: [sdk/utils/src/string.ts:65](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/string.ts#L65)
|
|
1371
1372
|
|
|
1372
1373
|
Truncates a string to a maximum length and appends "..." if it is longer.
|
|
1373
1374
|
|
|
@@ -1399,7 +1400,7 @@ const truncated = truncate("Hello, world!", 10);
|
|
|
1399
1400
|
|
|
1400
1401
|
> **tryParseJson**\<`T`\>(`value`, `defaultValue`): `null` \| `T`
|
|
1401
1402
|
|
|
1402
|
-
Defined in: [sdk/utils/src/json.ts:23](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1403
|
+
Defined in: [sdk/utils/src/json.ts:23](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/json.ts#L23)
|
|
1403
1404
|
|
|
1404
1405
|
Attempts to parse a JSON string into a typed value, returning a default value if parsing fails.
|
|
1405
1406
|
|
|
@@ -1446,7 +1447,7 @@ const invalid = tryParseJson<string[]>(
|
|
|
1446
1447
|
|
|
1447
1448
|
> **validate**\<`T`\>(`schema`, `value`): `T`\[`"_output"`\]
|
|
1448
1449
|
|
|
1449
|
-
Defined in: [sdk/utils/src/validation/validate.ts:16](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1450
|
+
Defined in: [sdk/utils/src/validation/validate.ts:16](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/validate.ts#L16)
|
|
1450
1451
|
|
|
1451
1452
|
Validates a value against a given Zod schema.
|
|
1452
1453
|
|
|
@@ -1454,7 +1455,7 @@ Validates a value against a given Zod schema.
|
|
|
1454
1455
|
|
|
1455
1456
|
| Type Parameter |
|
|
1456
1457
|
| ------ |
|
|
1457
|
-
| `T` *extends* `ZodType`\<`unknown`, `unknown
|
|
1458
|
+
| `T` *extends* `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> |
|
|
1458
1459
|
|
|
1459
1460
|
##### Parameters
|
|
1460
1461
|
|
|
@@ -1487,7 +1488,7 @@ const validatedId = validate(IdSchema, "550e8400-e29b-41d4-a716-446655440000");
|
|
|
1487
1488
|
|
|
1488
1489
|
> **writeEnv**(`options`): `Promise`\<`void`\>
|
|
1489
1490
|
|
|
1490
|
-
Defined in: [sdk/utils/src/environment/write-env.ts:41](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1491
|
+
Defined in: [sdk/utils/src/environment/write-env.ts:41](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/environment/write-env.ts#L41)
|
|
1491
1492
|
|
|
1492
1493
|
Writes environment variables to .env files across a project or monorepo
|
|
1493
1494
|
|
|
@@ -1539,7 +1540,7 @@ await writeEnv({
|
|
|
1539
1540
|
|
|
1540
1541
|
#### CancelError
|
|
1541
1542
|
|
|
1542
|
-
Defined in: [sdk/utils/src/terminal/cancel.ts:8](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1543
|
+
Defined in: [sdk/utils/src/terminal/cancel.ts:8](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/cancel.ts#L8)
|
|
1543
1544
|
|
|
1544
1545
|
Error class used to indicate that the operation was cancelled.
|
|
1545
1546
|
This error is used to signal that the operation should be aborted.
|
|
@@ -1552,7 +1553,7 @@ This error is used to signal that the operation should be aborted.
|
|
|
1552
1553
|
|
|
1553
1554
|
#### CommandError
|
|
1554
1555
|
|
|
1555
|
-
Defined in: [sdk/utils/src/terminal/execute-command.ts:16](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1556
|
+
Defined in: [sdk/utils/src/terminal/execute-command.ts:16](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/execute-command.ts#L16)
|
|
1556
1557
|
|
|
1557
1558
|
Error class for command execution errors
|
|
1558
1559
|
|
|
@@ -1566,7 +1567,7 @@ Error class for command execution errors
|
|
|
1566
1567
|
|
|
1567
1568
|
> **new CommandError**(`message`, `code`, `output`): [`CommandError`](#commanderror)
|
|
1568
1569
|
|
|
1569
|
-
Defined in: [sdk/utils/src/terminal/execute-command.ts:23](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1570
|
+
Defined in: [sdk/utils/src/terminal/execute-command.ts:23](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/execute-command.ts#L23)
|
|
1570
1571
|
|
|
1571
1572
|
Constructs a new CommandError
|
|
1572
1573
|
|
|
@@ -1592,7 +1593,7 @@ Constructs a new CommandError
|
|
|
1592
1593
|
|
|
1593
1594
|
> `readonly` **code**: `number`
|
|
1594
1595
|
|
|
1595
|
-
Defined in: [sdk/utils/src/terminal/execute-command.ts:25](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1596
|
+
Defined in: [sdk/utils/src/terminal/execute-command.ts:25](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/execute-command.ts#L25)
|
|
1596
1597
|
|
|
1597
1598
|
The exit code of the command
|
|
1598
1599
|
|
|
@@ -1600,7 +1601,7 @@ The exit code of the command
|
|
|
1600
1601
|
|
|
1601
1602
|
> `readonly` **output**: `string`[]
|
|
1602
1603
|
|
|
1603
|
-
Defined in: [sdk/utils/src/terminal/execute-command.ts:26](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1604
|
+
Defined in: [sdk/utils/src/terminal/execute-command.ts:26](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/execute-command.ts#L26)
|
|
1604
1605
|
|
|
1605
1606
|
The output of the command
|
|
1606
1607
|
|
|
@@ -1608,7 +1609,7 @@ The output of the command
|
|
|
1608
1609
|
|
|
1609
1610
|
#### SpinnerError
|
|
1610
1611
|
|
|
1611
|
-
Defined in: [sdk/utils/src/terminal/spinner.ts:12](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1612
|
+
Defined in: [sdk/utils/src/terminal/spinner.ts:12](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/spinner.ts#L12)
|
|
1612
1613
|
|
|
1613
1614
|
Error class used to indicate that the spinner operation failed.
|
|
1614
1615
|
This error is used to signal that the operation should be aborted.
|
|
@@ -1621,7 +1622,7 @@ This error is used to signal that the operation should be aborted.
|
|
|
1621
1622
|
|
|
1622
1623
|
#### ExecuteCommandOptions
|
|
1623
1624
|
|
|
1624
|
-
Defined in: [sdk/utils/src/terminal/execute-command.ts:7](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1625
|
+
Defined in: [sdk/utils/src/terminal/execute-command.ts:7](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/execute-command.ts#L7)
|
|
1625
1626
|
|
|
1626
1627
|
Options for executing a command, extending SpawnOptionsWithoutStdio
|
|
1627
1628
|
|
|
@@ -1633,13 +1634,13 @@ Options for executing a command, extending SpawnOptionsWithoutStdio
|
|
|
1633
1634
|
|
|
1634
1635
|
| Property | Type | Description | Defined in |
|
|
1635
1636
|
| ------ | ------ | ------ | ------ |
|
|
1636
|
-
| <a id="silent"></a> `silent?` | `boolean` | Whether to suppress output to stdout/stderr | [sdk/utils/src/terminal/execute-command.ts:9](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1637
|
+
| <a id="silent"></a> `silent?` | `boolean` | Whether to suppress output to stdout/stderr | [sdk/utils/src/terminal/execute-command.ts:9](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/execute-command.ts#L9) |
|
|
1637
1638
|
|
|
1638
1639
|
***
|
|
1639
1640
|
|
|
1640
1641
|
#### Logger
|
|
1641
1642
|
|
|
1642
|
-
Defined in: [sdk/utils/src/logging/logger.ts:23](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1643
|
+
Defined in: [sdk/utils/src/logging/logger.ts:23](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/logger.ts#L23)
|
|
1643
1644
|
|
|
1644
1645
|
Simple logger interface with basic logging methods
|
|
1645
1646
|
Logger
|
|
@@ -1648,16 +1649,16 @@ Simple logger interface with basic logging methods
|
|
|
1648
1649
|
|
|
1649
1650
|
| Property | Type | Description | Defined in |
|
|
1650
1651
|
| ------ | ------ | ------ | ------ |
|
|
1651
|
-
| <a id="debug"></a> `debug` | (`message`, ...`args`) => `void` | Log debug information | [sdk/utils/src/logging/logger.ts:25](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1652
|
-
| <a id="error"></a> `error` | (`message`, ...`args`) => `void` | Log errors | [sdk/utils/src/logging/logger.ts:31](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1653
|
-
| <a id="info"></a> `info` | (`message`, ...`args`) => `void` | Log general information | [sdk/utils/src/logging/logger.ts:27](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1654
|
-
| <a id="warn"></a> `warn` | (`message`, ...`args`) => `void` | Log warnings | [sdk/utils/src/logging/logger.ts:29](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1652
|
+
| <a id="debug"></a> `debug` | (`message`, ...`args`) => `void` | Log debug information | [sdk/utils/src/logging/logger.ts:25](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/logger.ts#L25) |
|
|
1653
|
+
| <a id="error"></a> `error` | (`message`, ...`args`) => `void` | Log errors | [sdk/utils/src/logging/logger.ts:31](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/logger.ts#L31) |
|
|
1654
|
+
| <a id="info"></a> `info` | (`message`, ...`args`) => `void` | Log general information | [sdk/utils/src/logging/logger.ts:27](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/logger.ts#L27) |
|
|
1655
|
+
| <a id="warn"></a> `warn` | (`message`, ...`args`) => `void` | Log warnings | [sdk/utils/src/logging/logger.ts:29](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/logger.ts#L29) |
|
|
1655
1656
|
|
|
1656
1657
|
***
|
|
1657
1658
|
|
|
1658
1659
|
#### LoggerOptions
|
|
1659
1660
|
|
|
1660
|
-
Defined in: [sdk/utils/src/logging/logger.ts:12](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1661
|
+
Defined in: [sdk/utils/src/logging/logger.ts:12](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/logger.ts#L12)
|
|
1661
1662
|
|
|
1662
1663
|
Configuration options for the logger
|
|
1663
1664
|
LoggerOptions
|
|
@@ -1666,14 +1667,14 @@ Configuration options for the logger
|
|
|
1666
1667
|
|
|
1667
1668
|
| Property | Type | Description | Defined in |
|
|
1668
1669
|
| ------ | ------ | ------ | ------ |
|
|
1669
|
-
| <a id="level"></a> `level?` | [`LogLevel`](#loglevel) | The minimum log level to output | [sdk/utils/src/logging/logger.ts:14](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1670
|
-
| <a id="prefix"></a> `prefix?` | `string` | The prefix to add to the log message | [sdk/utils/src/logging/logger.ts:16](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1670
|
+
| <a id="level"></a> `level?` | [`LogLevel`](#loglevel) | The minimum log level to output | [sdk/utils/src/logging/logger.ts:14](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/logger.ts#L14) |
|
|
1671
|
+
| <a id="prefix"></a> `prefix?` | `string` | The prefix to add to the log message | [sdk/utils/src/logging/logger.ts:16](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/logger.ts#L16) |
|
|
1671
1672
|
|
|
1672
1673
|
***
|
|
1673
1674
|
|
|
1674
1675
|
#### SpinnerOptions\<R\>
|
|
1675
1676
|
|
|
1676
|
-
Defined in: [sdk/utils/src/terminal/spinner.ts:25](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1677
|
+
Defined in: [sdk/utils/src/terminal/spinner.ts:25](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/spinner.ts#L25)
|
|
1677
1678
|
|
|
1678
1679
|
Options for configuring the spinner behavior
|
|
1679
1680
|
|
|
@@ -1687,9 +1688,9 @@ Options for configuring the spinner behavior
|
|
|
1687
1688
|
|
|
1688
1689
|
| Property | Type | Description | Defined in |
|
|
1689
1690
|
| ------ | ------ | ------ | ------ |
|
|
1690
|
-
| <a id="startmessage"></a> `startMessage` | `string` | Message to display when spinner starts | [sdk/utils/src/terminal/spinner.ts:27](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1691
|
-
| <a id="stopmessage"></a> `stopMessage` | `string` | Message to display when spinner completes successfully | [sdk/utils/src/terminal/spinner.ts:31](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1692
|
-
| <a id="task"></a> `task` | (`spinner?`) => `Promise`\<`R`\> | Async task to execute while spinner is active | [sdk/utils/src/terminal/spinner.ts:29](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1691
|
+
| <a id="startmessage"></a> `startMessage` | `string` | Message to display when spinner starts | [sdk/utils/src/terminal/spinner.ts:27](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/spinner.ts#L27) |
|
|
1692
|
+
| <a id="stopmessage"></a> `stopMessage` | `string` | Message to display when spinner completes successfully | [sdk/utils/src/terminal/spinner.ts:31](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/spinner.ts#L31) |
|
|
1693
|
+
| <a id="task"></a> `task` | (`spinner?`) => `Promise`\<`R`\> | Async task to execute while spinner is active | [sdk/utils/src/terminal/spinner.ts:29](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/terminal/spinner.ts#L29) |
|
|
1693
1694
|
|
|
1694
1695
|
### Type Aliases
|
|
1695
1696
|
|
|
@@ -1697,7 +1698,7 @@ Options for configuring the spinner behavior
|
|
|
1697
1698
|
|
|
1698
1699
|
> **DotEnv** = `z.infer`\<*typeof* [`DotEnvSchema`](#dotenvschema)\>
|
|
1699
1700
|
|
|
1700
|
-
Defined in: [sdk/utils/src/validation/dot-env.schema.ts:
|
|
1701
|
+
Defined in: [sdk/utils/src/validation/dot-env.schema.ts:112](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/dot-env.schema.ts#L112)
|
|
1701
1702
|
|
|
1702
1703
|
Type definition for the environment variables schema.
|
|
1703
1704
|
|
|
@@ -1707,7 +1708,7 @@ Type definition for the environment variables schema.
|
|
|
1707
1708
|
|
|
1708
1709
|
> **DotEnvPartial** = `z.infer`\<*typeof* [`DotEnvSchemaPartial`](#dotenvschemapartial)\>
|
|
1709
1710
|
|
|
1710
|
-
Defined in: [sdk/utils/src/validation/dot-env.schema.ts:
|
|
1711
|
+
Defined in: [sdk/utils/src/validation/dot-env.schema.ts:123](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/dot-env.schema.ts#L123)
|
|
1711
1712
|
|
|
1712
1713
|
Type definition for the partial environment variables schema.
|
|
1713
1714
|
|
|
@@ -1717,7 +1718,7 @@ Type definition for the partial environment variables schema.
|
|
|
1717
1718
|
|
|
1718
1719
|
> **Id** = `z.infer`\<*typeof* [`IdSchema`](#idschema)\>
|
|
1719
1720
|
|
|
1720
|
-
Defined in: [sdk/utils/src/validation/id.schema.ts:30](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1721
|
+
Defined in: [sdk/utils/src/validation/id.schema.ts:30](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/id.schema.ts#L30)
|
|
1721
1722
|
|
|
1722
1723
|
Type definition for database IDs, inferred from IdSchema.
|
|
1723
1724
|
Can be either a PostgreSQL UUID string or MongoDB ObjectID string.
|
|
@@ -1728,7 +1729,7 @@ Can be either a PostgreSQL UUID string or MongoDB ObjectID string.
|
|
|
1728
1729
|
|
|
1729
1730
|
> **LogLevel** = `"debug"` \| `"info"` \| `"warn"` \| `"error"` \| `"none"`
|
|
1730
1731
|
|
|
1731
|
-
Defined in: [sdk/utils/src/logging/logger.ts:6](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1732
|
+
Defined in: [sdk/utils/src/logging/logger.ts:6](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/logging/logger.ts#L6)
|
|
1732
1733
|
|
|
1733
1734
|
Log levels supported by the logger
|
|
1734
1735
|
|
|
@@ -1738,7 +1739,7 @@ Log levels supported by the logger
|
|
|
1738
1739
|
|
|
1739
1740
|
> `const` **AccessTokenSchema**: `ZodString`
|
|
1740
1741
|
|
|
1741
|
-
Defined in: [sdk/utils/src/validation/access-token.schema.ts:21](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1742
|
+
Defined in: [sdk/utils/src/validation/access-token.schema.ts:21](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/access-token.schema.ts#L21)
|
|
1742
1743
|
|
|
1743
1744
|
Schema for validating both application and personal access tokens.
|
|
1744
1745
|
Accepts tokens starting with either 'sm_pat_' or 'sm_aat_' prefix.
|
|
@@ -1749,7 +1750,7 @@ Accepts tokens starting with either 'sm_pat_' or 'sm_aat_' prefix.
|
|
|
1749
1750
|
|
|
1750
1751
|
> `const` **ApplicationAccessTokenSchema**: `ZodString`
|
|
1751
1752
|
|
|
1752
|
-
Defined in: [sdk/utils/src/validation/access-token.schema.ts:7](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1753
|
+
Defined in: [sdk/utils/src/validation/access-token.schema.ts:7](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/access-token.schema.ts#L7)
|
|
1753
1754
|
|
|
1754
1755
|
Schema for validating application access tokens.
|
|
1755
1756
|
Application access tokens start with 'sm_aat_' prefix.
|
|
@@ -1758,9 +1759,9 @@ Application access tokens start with 'sm_aat_' prefix.
|
|
|
1758
1759
|
|
|
1759
1760
|
#### DotEnvSchema
|
|
1760
1761
|
|
|
1761
|
-
> `const` **DotEnvSchema**: `ZodObject`\<\{ `
|
|
1762
|
+
> `const` **DotEnvSchema**: `ZodObject`\<\{ `SETTLEMINT_ACCESS_TOKEN`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_ACCESSIBLE_PRIVATE_KEY`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_APPLICATION`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_BLOCKCHAIN_NETWORK`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_BLOCKCHAIN_NODE`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_BLOCKSCOUT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_CUSTOM_DEPLOYMENT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_HASURA`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_HASURA_ADMIN_SECRET`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_HASURA_DATABASE_URL`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_HASURA_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_HD_PRIVATE_KEY`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_HD_PRIVATE_KEY_FORWARDER_ADDRESS`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_INSTANCE`: `ZodDefault`\<`ZodUnion`\<readonly \[`ZodString`, `ZodLiteral`\<`"standalone"`\>, `ZodLiteral`\<`"local"`\>\]\>\>; `SETTLEMINT_IPFS`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_IPFS_API_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_IPFS_GATEWAY_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_IPFS_PINNING_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_LOG_LEVEL`: `ZodDefault`\<`ZodEnum`\<\{ `debug`: `"debug"`; `error`: `"error"`; `info`: `"info"`; `none`: `"none"`; `warn`: `"warn"`; \}\>\>; `SETTLEMINT_MINIO`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_MINIO_ACCESS_KEY`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_MINIO_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_MINIO_SECRET_KEY`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_NEW_PROJECT_NAME`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_PORTAL`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_PORTAL_REST_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_PORTAL_WS_ENDPOINT`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_THEGRAPH`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH`: `ZodOptional`\<`ZodString`\>; `SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS`: `ZodPipe`\<`ZodTransform`\<`null` \| `never`[], `unknown`\>, `ZodOptional`\<`ZodArray`\<`ZodString`\>\>\>; `SETTLEMINT_WORKSPACE`: `ZodOptional`\<`ZodString`\>; \}, `$strip`\>
|
|
1762
1763
|
|
|
1763
|
-
Defined in: [sdk/utils/src/validation/dot-env.schema.ts:
|
|
1764
|
+
Defined in: [sdk/utils/src/validation/dot-env.schema.ts:21](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/dot-env.schema.ts#L21)
|
|
1764
1765
|
|
|
1765
1766
|
Schema for validating environment variables used by the SettleMint SDK.
|
|
1766
1767
|
Defines validation rules and types for configuration values like URLs,
|
|
@@ -1770,9 +1771,9 @@ access tokens, workspace names, and service endpoints.
|
|
|
1770
1771
|
|
|
1771
1772
|
#### DotEnvSchemaPartial
|
|
1772
1773
|
|
|
1773
|
-
> `const` **DotEnvSchemaPartial**: `ZodObject`\<\{ `
|
|
1774
|
+
> `const` **DotEnvSchemaPartial**: `ZodObject`\<\{ `SETTLEMINT_ACCESS_TOKEN`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_ACCESSIBLE_PRIVATE_KEY`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_APPLICATION`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_BLOCKCHAIN_NETWORK`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_BLOCKCHAIN_NODE`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_BLOCKSCOUT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_CUSTOM_DEPLOYMENT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_HASURA`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_HASURA_ADMIN_SECRET`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_HASURA_DATABASE_URL`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_HASURA_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_HD_PRIVATE_KEY`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_HD_PRIVATE_KEY_FORWARDER_ADDRESS`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_INSTANCE`: `ZodOptional`\<`ZodDefault`\<`ZodUnion`\<readonly \[`ZodString`, `ZodLiteral`\<`"standalone"`\>, `ZodLiteral`\<`"local"`\>\]\>\>\>; `SETTLEMINT_IPFS`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_IPFS_API_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_IPFS_GATEWAY_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_IPFS_PINNING_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_LOG_LEVEL`: `ZodOptional`\<`ZodDefault`\<`ZodEnum`\<\{ `debug`: `"debug"`; `error`: `"error"`; `info`: `"info"`; `none`: `"none"`; `warn`: `"warn"`; \}\>\>\>; `SETTLEMINT_MINIO`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_MINIO_ACCESS_KEY`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_MINIO_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_MINIO_SECRET_KEY`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_NEW_PROJECT_NAME`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_PORTAL`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_PORTAL_REST_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_PORTAL_WS_ENDPOINT`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_THEGRAPH`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; `SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS`: `ZodOptional`\<`ZodPipe`\<`ZodTransform`\<`null` \| `never`[], `unknown`\>, `ZodOptional`\<`ZodArray`\<`ZodString`\>\>\>\>; `SETTLEMINT_WORKSPACE`: `ZodOptional`\<`ZodOptional`\<`ZodString`\>\>; \}, `$strip`\>
|
|
1774
1775
|
|
|
1775
|
-
Defined in: [sdk/utils/src/validation/dot-env.schema.ts:
|
|
1776
|
+
Defined in: [sdk/utils/src/validation/dot-env.schema.ts:118](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/dot-env.schema.ts#L118)
|
|
1776
1777
|
|
|
1777
1778
|
Partial version of the environment variables schema where all fields are optional.
|
|
1778
1779
|
Useful for validating incomplete configurations during development or build time.
|
|
@@ -1783,7 +1784,7 @@ Useful for validating incomplete configurations during development or build time
|
|
|
1783
1784
|
|
|
1784
1785
|
> `const` **IdSchema**: `ZodUnion`\<readonly \[`ZodString`, `ZodString`\]\>
|
|
1785
1786
|
|
|
1786
|
-
Defined in: [sdk/utils/src/validation/id.schema.ts:17](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1787
|
+
Defined in: [sdk/utils/src/validation/id.schema.ts:17](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/id.schema.ts#L17)
|
|
1787
1788
|
|
|
1788
1789
|
Schema for validating database IDs. Accepts both PostgreSQL UUIDs and MongoDB ObjectIDs.
|
|
1789
1790
|
PostgreSQL UUIDs are 32 hexadecimal characters with hyphens (e.g. 123e4567-e89b-12d3-a456-426614174000).
|
|
@@ -1803,11 +1804,21 @@ const isValidObjectId = IdSchema.safeParse("507f1f77bcf86cd799439011").success;
|
|
|
1803
1804
|
|
|
1804
1805
|
***
|
|
1805
1806
|
|
|
1807
|
+
#### LOCAL\_INSTANCE
|
|
1808
|
+
|
|
1809
|
+
> `const` **LOCAL\_INSTANCE**: `"local"` = `"local"`
|
|
1810
|
+
|
|
1811
|
+
Defined in: [sdk/utils/src/validation/dot-env.schema.ts:14](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/dot-env.schema.ts#L14)
|
|
1812
|
+
|
|
1813
|
+
Use this value to indicate that the resources are not part of the SettleMint platform.
|
|
1814
|
+
|
|
1815
|
+
***
|
|
1816
|
+
|
|
1806
1817
|
#### PersonalAccessTokenSchema
|
|
1807
1818
|
|
|
1808
1819
|
> `const` **PersonalAccessTokenSchema**: `ZodString`
|
|
1809
1820
|
|
|
1810
|
-
Defined in: [sdk/utils/src/validation/access-token.schema.ts:14](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1821
|
+
Defined in: [sdk/utils/src/validation/access-token.schema.ts:14](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/access-token.schema.ts#L14)
|
|
1811
1822
|
|
|
1812
1823
|
Schema for validating personal access tokens.
|
|
1813
1824
|
Personal access tokens start with 'sm_pat_' prefix.
|
|
@@ -1818,7 +1829,7 @@ Personal access tokens start with 'sm_pat_' prefix.
|
|
|
1818
1829
|
|
|
1819
1830
|
> `const` **runsInBrowser**: `boolean` = `isBrowser`
|
|
1820
1831
|
|
|
1821
|
-
Defined in: [sdk/utils/src/runtime/ensure-server.ts:40](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1832
|
+
Defined in: [sdk/utils/src/runtime/ensure-server.ts:40](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/runtime/ensure-server.ts#L40)
|
|
1822
1833
|
|
|
1823
1834
|
Boolean indicating if code is currently running in a browser environment
|
|
1824
1835
|
|
|
@@ -1828,7 +1839,7 @@ Boolean indicating if code is currently running in a browser environment
|
|
|
1828
1839
|
|
|
1829
1840
|
> `const` **runsOnServer**: `boolean` = `!isBrowser`
|
|
1830
1841
|
|
|
1831
|
-
Defined in: [sdk/utils/src/runtime/ensure-server.ts:45](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1842
|
+
Defined in: [sdk/utils/src/runtime/ensure-server.ts:45](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/runtime/ensure-server.ts#L45)
|
|
1832
1843
|
|
|
1833
1844
|
Boolean indicating if code is currently running in a server environment
|
|
1834
1845
|
|
|
@@ -1838,7 +1849,7 @@ Boolean indicating if code is currently running in a server environment
|
|
|
1838
1849
|
|
|
1839
1850
|
> `const` **STANDALONE\_INSTANCE**: `"standalone"` = `"standalone"`
|
|
1840
1851
|
|
|
1841
|
-
Defined in: [sdk/utils/src/validation/dot-env.schema.ts:10](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1852
|
+
Defined in: [sdk/utils/src/validation/dot-env.schema.ts:10](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/dot-env.schema.ts#L10)
|
|
1842
1853
|
|
|
1843
1854
|
Use this value to indicate that the resources are not part of the SettleMint platform.
|
|
1844
1855
|
|
|
@@ -1848,7 +1859,7 @@ Use this value to indicate that the resources are not part of the SettleMint pla
|
|
|
1848
1859
|
|
|
1849
1860
|
> `const` **UniqueNameSchema**: `ZodString`
|
|
1850
1861
|
|
|
1851
|
-
Defined in: [sdk/utils/src/validation/unique-name.schema.ts:19](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1862
|
+
Defined in: [sdk/utils/src/validation/unique-name.schema.ts:19](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/unique-name.schema.ts#L19)
|
|
1852
1863
|
|
|
1853
1864
|
Schema for validating unique names used across the SettleMint platform.
|
|
1854
1865
|
Only accepts lowercase alphanumeric characters and hyphens.
|
|
@@ -1874,7 +1885,7 @@ const isInvalidName = UniqueNameSchema.safeParse("My Workspace!").success;
|
|
|
1874
1885
|
|
|
1875
1886
|
> `const` **UrlOrPathSchema**: `ZodUnion`\<readonly \[`ZodString`, `ZodString`\]\>
|
|
1876
1887
|
|
|
1877
|
-
Defined in: [sdk/utils/src/validation/url.schema.ts:54](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1888
|
+
Defined in: [sdk/utils/src/validation/url.schema.ts:54](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/url.schema.ts#L54)
|
|
1878
1889
|
|
|
1879
1890
|
Schema that accepts either a full URL or a URL path.
|
|
1880
1891
|
|
|
@@ -1898,7 +1909,7 @@ const isValidPath = UrlOrPathSchema.safeParse("/api/v1/users").success;
|
|
|
1898
1909
|
|
|
1899
1910
|
> `const` **UrlPathSchema**: `ZodString`
|
|
1900
1911
|
|
|
1901
|
-
Defined in: [sdk/utils/src/validation/url.schema.ts:34](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1912
|
+
Defined in: [sdk/utils/src/validation/url.schema.ts:34](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/url.schema.ts#L34)
|
|
1902
1913
|
|
|
1903
1914
|
Schema for validating URL paths.
|
|
1904
1915
|
|
|
@@ -1922,7 +1933,7 @@ const isInvalidPath = UrlPathSchema.safeParse("not-a-path").success;
|
|
|
1922
1933
|
|
|
1923
1934
|
> `const` **UrlSchema**: `ZodString`
|
|
1924
1935
|
|
|
1925
|
-
Defined in: [sdk/utils/src/validation/url.schema.ts:17](https://github.com/settlemint/sdk/blob/v2.3.
|
|
1936
|
+
Defined in: [sdk/utils/src/validation/url.schema.ts:17](https://github.com/settlemint/sdk/blob/v2.3.11/sdk/utils/src/validation/url.schema.ts#L17)
|
|
1926
1937
|
|
|
1927
1938
|
Schema for validating URLs.
|
|
1928
1939
|
|