@settlemint/sdk-utils 2.3.2-pr6cb5dd2e → 2.3.2-pr74f654b5

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.
Files changed (89) hide show
  1. package/README.md +51 -7
  2. package/dist/environment.cjs +25 -408
  3. package/dist/environment.d.cts +3 -176
  4. package/dist/environment.d.ts +3 -176
  5. package/dist/environment.js +4 -0
  6. package/dist/filesystem.cjs +39 -123
  7. package/dist/filesystem.d.cts +4 -59
  8. package/dist/filesystem.d.ts +4 -59
  9. package/dist/filesystem.js +5 -0
  10. package/dist/http.cjs +35 -147
  11. package/dist/http.d.cts +4 -50
  12. package/dist/http.d.ts +4 -50
  13. package/dist/http.js +5 -0
  14. package/dist/index.cjs +27 -184
  15. package/dist/index.d.cts +4 -122
  16. package/dist/index.d.ts +4 -122
  17. package/dist/index.js +7 -0
  18. package/dist/json.cjs +83 -0
  19. package/dist/json.cjs.map +1 -0
  20. package/dist/json.d.cts +56 -0
  21. package/dist/json.d.ts +56 -0
  22. package/dist/json.js +80 -0
  23. package/dist/json.js.map +1 -0
  24. package/dist/logging.cjs +34 -141
  25. package/dist/logging.d.cts +4 -70
  26. package/dist/logging.d.ts +4 -70
  27. package/dist/logging.js +5 -0
  28. package/dist/package-manager.cjs +51 -196
  29. package/dist/package-manager.d.cts +7 -114
  30. package/dist/package-manager.d.ts +7 -114
  31. package/dist/package-manager.js +9 -0
  32. package/dist/retry.cjs +69 -0
  33. package/dist/retry.cjs.map +1 -0
  34. package/dist/retry.d.cts +19 -0
  35. package/dist/retry.d.ts +19 -0
  36. package/dist/retry.js +46 -0
  37. package/dist/retry.js.map +1 -0
  38. package/dist/runtime.cjs +38 -42
  39. package/dist/runtime.d.cts +2 -32
  40. package/dist/runtime.d.ts +2 -32
  41. package/dist/runtime.js +3 -0
  42. package/dist/string.cjs +76 -0
  43. package/dist/string.cjs.map +1 -0
  44. package/dist/string.d.cts +58 -0
  45. package/dist/string.d.ts +58 -0
  46. package/dist/string.js +72 -0
  47. package/dist/string.js.map +1 -0
  48. package/dist/terminal.cjs +91 -258
  49. package/dist/terminal.d.cts +11 -219
  50. package/dist/terminal.d.ts +11 -219
  51. package/dist/terminal.js +12 -0
  52. package/dist/url.cjs +25 -0
  53. package/dist/url.cjs.map +1 -0
  54. package/dist/url.d.cts +20 -0
  55. package/dist/url.d.ts +20 -0
  56. package/dist/url.js +24 -0
  57. package/dist/url.js.map +1 -0
  58. package/dist/validation.cjs +89 -183
  59. package/dist/validation.d.cts +7 -239
  60. package/dist/validation.d.ts +7 -239
  61. package/dist/validation.js +8 -0
  62. package/package.json +6 -6
  63. package/dist/environment.cjs.map +0 -1
  64. package/dist/environment.mjs +0 -383
  65. package/dist/environment.mjs.map +0 -1
  66. package/dist/filesystem.cjs.map +0 -1
  67. package/dist/filesystem.mjs +0 -105
  68. package/dist/filesystem.mjs.map +0 -1
  69. package/dist/http.cjs.map +0 -1
  70. package/dist/http.mjs +0 -129
  71. package/dist/http.mjs.map +0 -1
  72. package/dist/index.cjs.map +0 -1
  73. package/dist/index.mjs +0 -156
  74. package/dist/index.mjs.map +0 -1
  75. package/dist/logging.cjs.map +0 -1
  76. package/dist/logging.mjs +0 -123
  77. package/dist/logging.mjs.map +0 -1
  78. package/dist/package-manager.cjs.map +0 -1
  79. package/dist/package-manager.mjs +0 -167
  80. package/dist/package-manager.mjs.map +0 -1
  81. package/dist/runtime.cjs.map +0 -1
  82. package/dist/runtime.mjs +0 -23
  83. package/dist/runtime.mjs.map +0 -1
  84. package/dist/terminal.cjs.map +0 -1
  85. package/dist/terminal.mjs +0 -230
  86. package/dist/terminal.mjs.map +0 -1
  87. package/dist/validation.cjs.map +0 -1
  88. package/dist/validation.mjs +0 -159
  89. package/dist/validation.mjs.map +0 -1
@@ -1,219 +1,11 @@
1
- import { SpawnOptionsWithoutStdio } from 'node:child_process';
2
- import { Spinner } from 'yocto-spinner';
3
-
4
- /**
5
- * Prints the SettleMint ASCII art logo to the console in magenta color.
6
- * Used for CLI branding and visual identification.
7
- *
8
- * @example
9
- * import { ascii } from "@settlemint/sdk-utils/terminal";
10
- *
11
- * // Prints the SettleMint logo
12
- * ascii();
13
- */
14
- declare const ascii: () => void;
15
-
16
- /**
17
- * Error class used to indicate that the operation was cancelled.
18
- * This error is used to signal that the operation should be aborted.
19
- */
20
- declare class CancelError extends Error {
21
- }
22
- /**
23
- * Displays an error message in red inverse text and throws a CancelError.
24
- * Used to terminate execution with a visible error message.
25
- * Any sensitive tokens in the message are masked before display.
26
- *
27
- * @param msg - The error message to display
28
- * @returns never - Function does not return as it throws an error
29
- * @example
30
- * import { cancel } from "@settlemint/sdk-utils/terminal";
31
- *
32
- * // Exits process with error message
33
- * cancel("An error occurred");
34
- */
35
- declare const cancel: (msg: string) => never;
36
-
37
- /**
38
- * Options for executing a command, extending SpawnOptionsWithoutStdio
39
- */
40
- interface ExecuteCommandOptions extends SpawnOptionsWithoutStdio {
41
- /** Whether to suppress output to stdout/stderr */
42
- silent?: boolean;
43
- }
44
- /**
45
- * Error class for command execution errors
46
- * @extends Error
47
- */
48
- declare class CommandError extends Error {
49
- readonly code: number;
50
- readonly output: string[];
51
- /**
52
- * Constructs a new CommandError
53
- * @param message - The error message
54
- * @param code - The exit code of the command
55
- * @param output - The output of the command
56
- */
57
- constructor(message: string, code: number, output: string[]);
58
- }
59
- /**
60
- * Executes a command with the given arguments in a child process.
61
- * Pipes stdin to the child process and captures stdout/stderr output.
62
- * Masks any sensitive tokens in the output before displaying or returning.
63
- *
64
- * @param command - The command to execute
65
- * @param args - Array of arguments to pass to the command
66
- * @param options - Options for customizing command execution
67
- * @returns Array of output strings from stdout and stderr
68
- * @throws {CommandError} If the process fails to start or exits with non-zero code
69
- * @example
70
- * import { executeCommand } from "@settlemint/sdk-utils/terminal";
71
- *
72
- * // Execute git clone
73
- * await executeCommand("git", ["clone", "repo-url"]);
74
- *
75
- * // Execute silently
76
- * await executeCommand("npm", ["install"], { silent: true });
77
- */
78
- declare function executeCommand(command: string, args: string[], options?: ExecuteCommandOptions): Promise<string[]>;
79
-
80
- /**
81
- * Displays an introductory message in magenta text with padding.
82
- * Any sensitive tokens in the message are masked before display.
83
- *
84
- * @param msg - The message to display as introduction
85
- * @example
86
- * import { intro } from "@settlemint/sdk-utils/terminal";
87
- *
88
- * // Display intro message
89
- * intro("Starting deployment...");
90
- */
91
- declare const intro: (msg: string) => void;
92
-
93
- /**
94
- * Displays a list of items in a formatted manner, supporting nested items.
95
- *
96
- * @param title - The title of the list
97
- * @param items - The items to display, can be strings or arrays for nested items
98
- * @returns The formatted list
99
- * @example
100
- * import { list } from "@settlemint/sdk-utils/terminal";
101
- *
102
- * // Simple list
103
- * list("Use cases", ["use case 1", "use case 2", "use case 3"]);
104
- *
105
- * // Nested list
106
- * list("Providers", [
107
- * "AWS",
108
- * ["us-east-1", "eu-west-1"],
109
- * "Azure",
110
- * ["eastus", "westeurope"]
111
- * ]);
112
- */
113
- declare function list(title: string, items: Array<string | string[]>): void;
114
-
115
- /**
116
- * Displays a note message with optional warning level formatting.
117
- * Regular notes are displayed in normal text, while warnings are shown in yellow.
118
- * Any sensitive tokens in the message are masked before display.
119
- *
120
- * @param message - The message to display as a note
121
- * @param level - The note level: "info" (default) or "warn" for warning styling
122
- * @example
123
- * import { note } from "@settlemint/sdk-utils/terminal";
124
- *
125
- * // Display info note
126
- * note("Operation completed successfully");
127
- *
128
- * // Display warning note
129
- * note("Low disk space remaining", "warn");
130
- */
131
- declare const note: (message: string, level?: "info" | "warn") => void;
132
-
133
- /**
134
- * Displays a closing message in green inverted text with padding.
135
- * Any sensitive tokens in the message are masked before display.
136
- *
137
- * @param msg - The message to display as conclusion
138
- * @example
139
- * import { outro } from "@settlemint/sdk-utils/terminal";
140
- *
141
- * // Display outro message
142
- * outro("Deployment completed successfully!");
143
- */
144
- declare const outro: (msg: string) => void;
145
-
146
- /**
147
- * Error class used to indicate that the spinner operation failed.
148
- * This error is used to signal that the operation should be aborted.
149
- */
150
- declare class SpinnerError extends Error {
151
- readonly originalError: Error;
152
- constructor(message: string, originalError: Error);
153
- }
154
- /**
155
- * Options for configuring the spinner behavior
156
- */
157
- interface SpinnerOptions<R> {
158
- /** Message to display when spinner starts */
159
- startMessage: string;
160
- /** Async task to execute while spinner is active */
161
- task: (spinner?: Spinner) => Promise<R>;
162
- /** Message to display when spinner completes successfully */
163
- stopMessage: string;
164
- }
165
- /**
166
- * Displays a loading spinner while executing an async task.
167
- * Shows progress with start/stop messages and handles errors.
168
- * Spinner is disabled in CI environments.
169
- *
170
- * @param options - Configuration options for the spinner
171
- * @returns The result from the executed task
172
- * @throws Will exit process with code 1 if task fails
173
- * @example
174
- * import { spinner } from "@settlemint/sdk-utils/terminal";
175
- *
176
- * // Show spinner during async task
177
- * const result = await spinner({
178
- * startMessage: "Deploying...",
179
- * task: async () => {
180
- * // Async work here
181
- * return "success";
182
- * },
183
- * stopMessage: "Deployed successfully!"
184
- * });
185
- */
186
- declare const spinner: <R>(options: SpinnerOptions<R>) => Promise<R>;
187
-
188
- /**
189
- * Displays data in a formatted table in the terminal.
190
- *
191
- * @param title - Title to display above the table
192
- * @param data - Array of objects to display in table format
193
- * @example
194
- * import { table } from "@settlemint/sdk-utils/terminal";
195
- *
196
- * const data = [
197
- * { name: "Item 1", value: 100 },
198
- * { name: "Item 2", value: 200 }
199
- * ];
200
- *
201
- * table("My Table", data);
202
- */
203
- declare function table(title: string, data: unknown[]): void;
204
-
205
- /**
206
- * Masks sensitive SettleMint tokens in output text by replacing them with asterisks.
207
- * Handles personal access tokens (PAT), application access tokens (AAT), and service account tokens (SAT).
208
- *
209
- * @param output - The text string that may contain sensitive tokens
210
- * @returns The text with any sensitive tokens masked with asterisks
211
- * @example
212
- * import { maskTokens } from "@settlemint/sdk-utils/terminal";
213
- *
214
- * // Masks a token in text
215
- * const masked = maskTokens("Token: sm_pat_****"); // "Token: ***"
216
- */
217
- declare const maskTokens: (output: string) => string;
218
-
219
- export { CancelError, CommandError, type ExecuteCommandOptions, SpinnerError, type SpinnerOptions, ascii, cancel, executeCommand, intro, list, maskTokens, note, outro, spinner, table };
1
+ import { ascii } from "./terminal/ascii.js";
2
+ import { CancelError, cancel } from "./terminal/cancel.js";
3
+ import { CommandError, ExecuteCommandOptions, executeCommand } from "./terminal/execute-command.js";
4
+ import { intro } from "./terminal/intro.js";
5
+ import { list } from "./terminal/list.js";
6
+ import { note } from "./terminal/note.js";
7
+ import { outro } from "./terminal/outro.js";
8
+ import { SpinnerError, SpinnerOptions, spinner } from "./terminal/spinner.js";
9
+ import { table } from "./terminal/table.js";
10
+ import { maskTokens } from "./logging/mask-tokens.js";
11
+ export { CancelError, CommandError, ExecuteCommandOptions, SpinnerError, SpinnerOptions, ascii, cancel, executeCommand, intro, list, maskTokens, note, outro, spinner, table };
@@ -0,0 +1,12 @@
1
+ import { ascii } from "./terminal/ascii.js";
2
+ import { CancelError, cancel } from "./terminal/cancel.js";
3
+ import { CommandError, executeCommand } from "./terminal/execute-command.js";
4
+ import { intro } from "./terminal/intro.js";
5
+ import { list } from "./terminal/list.js";
6
+ import { note } from "./terminal/note.js";
7
+ import { outro } from "./terminal/outro.js";
8
+ import { SpinnerError, spinner } from "./terminal/spinner.js";
9
+ import { table } from "./terminal/table.js";
10
+ import { maskTokens } from "./logging/mask-tokens.js";
11
+
12
+ export { CancelError, CommandError, SpinnerError, ascii, cancel, executeCommand, intro, list, maskTokens, note, outro, spinner, table };
package/dist/url.cjs ADDED
@@ -0,0 +1,25 @@
1
+
2
+ //#region src/url.ts
3
+ /**
4
+ * Extracts the base URL before a specific segment in a URL.
5
+ *
6
+ * @param baseUrl - The base URL to extract the path from
7
+ * @param pathSegment - The path segment to start from
8
+ * @returns The base URL before the specified segment
9
+ * @example
10
+ * ```typescript
11
+ * import { extractBaseUrlBeforeSegment } from "@settlemint/sdk-utils/url";
12
+ *
13
+ * const baseUrl = extractBaseUrlBeforeSegment("https://example.com/api/v1/subgraphs/name/my-subgraph", "/subgraphs");
14
+ * // Returns: "https://example.com/api/v1"
15
+ * ```
16
+ */
17
+ function extractBaseUrlBeforeSegment(baseUrl, pathSegment) {
18
+ const url = new URL(baseUrl);
19
+ const segmentIndex = url.pathname.indexOf(pathSegment);
20
+ return url.origin + (segmentIndex >= 0 ? url.pathname.substring(0, segmentIndex) : url.pathname);
21
+ }
22
+
23
+ //#endregion
24
+ exports.extractBaseUrlBeforeSegment = extractBaseUrlBeforeSegment;
25
+ //# sourceMappingURL=url.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.cjs","names":["baseUrl: string","pathSegment: string"],"sources":["../src/url.ts"],"sourcesContent":["/**\n * Extracts the base URL before a specific segment in a URL.\n *\n * @param baseUrl - The base URL to extract the path from\n * @param pathSegment - The path segment to start from\n * @returns The base URL before the specified segment\n * @example\n * ```typescript\n * import { extractBaseUrlBeforeSegment } from \"@settlemint/sdk-utils/url\";\n *\n * const baseUrl = extractBaseUrlBeforeSegment(\"https://example.com/api/v1/subgraphs/name/my-subgraph\", \"/subgraphs\");\n * // Returns: \"https://example.com/api/v1\"\n * ```\n */\nexport function extractBaseUrlBeforeSegment(baseUrl: string, pathSegment: string) {\n const url = new URL(baseUrl);\n const segmentIndex = url.pathname.indexOf(pathSegment);\n return url.origin + (segmentIndex >= 0 ? url.pathname.substring(0, segmentIndex) : url.pathname);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,SAAgB,4BAA4BA,SAAiBC,aAAqB;CAChF,MAAM,MAAM,IAAI,IAAI;CACpB,MAAM,eAAe,IAAI,SAAS,QAAQ,YAAY;AACtD,QAAO,IAAI,UAAU,gBAAgB,IAAI,IAAI,SAAS,UAAU,GAAG,aAAa,GAAG,IAAI;AACxF"}
package/dist/url.d.cts ADDED
@@ -0,0 +1,20 @@
1
+ //#region src/url.d.ts
2
+ /**
3
+ * Extracts the base URL before a specific segment in a URL.
4
+ *
5
+ * @param baseUrl - The base URL to extract the path from
6
+ * @param pathSegment - The path segment to start from
7
+ * @returns The base URL before the specified segment
8
+ * @example
9
+ * ```typescript
10
+ * import { extractBaseUrlBeforeSegment } from "@settlemint/sdk-utils/url";
11
+ *
12
+ * const baseUrl = extractBaseUrlBeforeSegment("https://example.com/api/v1/subgraphs/name/my-subgraph", "/subgraphs");
13
+ * // Returns: "https://example.com/api/v1"
14
+ * ```
15
+ */
16
+ declare function extractBaseUrlBeforeSegment(baseUrl: string, pathSegment: string): string;
17
+
18
+ //#endregion
19
+ export { extractBaseUrlBeforeSegment };
20
+ //# sourceMappingURL=url.d.cts.map
package/dist/url.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ //#region src/url.d.ts
2
+ /**
3
+ * Extracts the base URL before a specific segment in a URL.
4
+ *
5
+ * @param baseUrl - The base URL to extract the path from
6
+ * @param pathSegment - The path segment to start from
7
+ * @returns The base URL before the specified segment
8
+ * @example
9
+ * ```typescript
10
+ * import { extractBaseUrlBeforeSegment } from "@settlemint/sdk-utils/url";
11
+ *
12
+ * const baseUrl = extractBaseUrlBeforeSegment("https://example.com/api/v1/subgraphs/name/my-subgraph", "/subgraphs");
13
+ * // Returns: "https://example.com/api/v1"
14
+ * ```
15
+ */
16
+ declare function extractBaseUrlBeforeSegment(baseUrl: string, pathSegment: string): string;
17
+
18
+ //#endregion
19
+ export { extractBaseUrlBeforeSegment };
20
+ //# sourceMappingURL=url.d.ts.map
package/dist/url.js ADDED
@@ -0,0 +1,24 @@
1
+ //#region src/url.ts
2
+ /**
3
+ * Extracts the base URL before a specific segment in a URL.
4
+ *
5
+ * @param baseUrl - The base URL to extract the path from
6
+ * @param pathSegment - The path segment to start from
7
+ * @returns The base URL before the specified segment
8
+ * @example
9
+ * ```typescript
10
+ * import { extractBaseUrlBeforeSegment } from "@settlemint/sdk-utils/url";
11
+ *
12
+ * const baseUrl = extractBaseUrlBeforeSegment("https://example.com/api/v1/subgraphs/name/my-subgraph", "/subgraphs");
13
+ * // Returns: "https://example.com/api/v1"
14
+ * ```
15
+ */
16
+ function extractBaseUrlBeforeSegment(baseUrl, pathSegment) {
17
+ const url = new URL(baseUrl);
18
+ const segmentIndex = url.pathname.indexOf(pathSegment);
19
+ return url.origin + (segmentIndex >= 0 ? url.pathname.substring(0, segmentIndex) : url.pathname);
20
+ }
21
+
22
+ //#endregion
23
+ export { extractBaseUrlBeforeSegment };
24
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","names":["baseUrl: string","pathSegment: string"],"sources":["../src/url.ts"],"sourcesContent":["/**\n * Extracts the base URL before a specific segment in a URL.\n *\n * @param baseUrl - The base URL to extract the path from\n * @param pathSegment - The path segment to start from\n * @returns The base URL before the specified segment\n * @example\n * ```typescript\n * import { extractBaseUrlBeforeSegment } from \"@settlemint/sdk-utils/url\";\n *\n * const baseUrl = extractBaseUrlBeforeSegment(\"https://example.com/api/v1/subgraphs/name/my-subgraph\", \"/subgraphs\");\n * // Returns: \"https://example.com/api/v1\"\n * ```\n */\nexport function extractBaseUrlBeforeSegment(baseUrl: string, pathSegment: string) {\n const url = new URL(baseUrl);\n const segmentIndex = url.pathname.indexOf(pathSegment);\n return url.origin + (segmentIndex >= 0 ? url.pathname.substring(0, segmentIndex) : url.pathname);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB,4BAA4BA,SAAiBC,aAAqB;CAChF,MAAM,MAAM,IAAI,IAAI;CACpB,MAAM,eAAe,IAAI,SAAS,QAAQ,YAAY;AACtD,QAAO,IAAI,UAAU,gBAAgB,IAAI,IAAI,SAAS,UAAU,GAAG,aAAa,GAAG,IAAI;AACxF"}
@@ -1,196 +1,102 @@
1
- "use strict";
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
8
  var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
17
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
19
22
 
20
- // src/validation.ts
21
- var validation_exports = {};
22
- __export(validation_exports, {
23
- AccessTokenSchema: () => AccessTokenSchema,
24
- ApplicationAccessTokenSchema: () => ApplicationAccessTokenSchema,
25
- DotEnvSchema: () => DotEnvSchema,
26
- DotEnvSchemaPartial: () => DotEnvSchemaPartial,
27
- IdSchema: () => IdSchema,
28
- PersonalAccessTokenSchema: () => PersonalAccessTokenSchema,
29
- UniqueNameSchema: () => UniqueNameSchema,
30
- UrlOrPathSchema: () => UrlOrPathSchema,
31
- UrlPathSchema: () => UrlPathSchema,
32
- UrlSchema: () => UrlSchema,
33
- validate: () => validate
34
- });
35
- module.exports = __toCommonJS(validation_exports);
23
+ //#endregion
24
+ const src_validation_validate_js = __toESM(require("./validation/validate.js"));
25
+ const src_validation_access_token_schema_js = __toESM(require("./validation/access-token.schema.js"));
26
+ const src_validation_dot_env_schema_js = __toESM(require("./validation/dot-env.schema.js"));
27
+ const src_validation_id_schema_js = __toESM(require("./validation/id.schema.js"));
28
+ const src_validation_unique_name_schema_js = __toESM(require("./validation/unique-name.schema.js"));
29
+ const src_validation_url_schema_js = __toESM(require("./validation/url.schema.js"));
36
30
 
37
- // src/validation/validate.ts
38
- var import_v4 = require("zod/v4");
39
- function validate(schema, value) {
40
- try {
41
- return schema.parse(value);
42
- } catch (error) {
43
- if (error instanceof import_v4.ZodError) {
44
- const formattedErrors = error.issues.map((err) => `- ${err.path.join(".")}: ${err.message}`).join("\n");
45
- throw new Error(`Validation error${error.issues.length > 1 ? "s" : ""}:
46
- ${formattedErrors}`);
47
- }
48
- throw error;
31
+ Object.defineProperty(exports, 'AccessTokenSchema', {
32
+ enumerable: true,
33
+ get: function () {
34
+ return src_validation_access_token_schema_js.AccessTokenSchema;
49
35
  }
50
- }
51
-
52
- // src/validation/access-token.schema.ts
53
- var import_v42 = require("zod/v4");
54
- var ApplicationAccessTokenSchema = import_v42.z.string().regex(/^sm_aat_.*$/);
55
- var PersonalAccessTokenSchema = import_v42.z.string().regex(/^sm_pat_.*$/);
56
- var AccessTokenSchema = import_v42.z.string().regex(/^sm_pat_.*|sm_aat_.*$/);
57
-
58
- // src/json.ts
59
- function tryParseJson(value, defaultValue = null) {
60
- try {
61
- const parsed = JSON.parse(value);
62
- if (parsed === void 0 || parsed === null) {
63
- return defaultValue;
64
- }
65
- return parsed;
66
- } catch (err) {
67
- return defaultValue;
36
+ });
37
+ Object.defineProperty(exports, 'ApplicationAccessTokenSchema', {
38
+ enumerable: true,
39
+ get: function () {
40
+ return src_validation_access_token_schema_js.ApplicationAccessTokenSchema;
68
41
  }
69
- }
70
-
71
- // src/validation/dot-env.schema.ts
72
- var import_v45 = require("zod/v4");
73
-
74
- // src/validation/unique-name.schema.ts
75
- var import_v43 = require("zod/v4");
76
- var UniqueNameSchema = import_v43.z.string().regex(/^[a-z0-9-]+$/);
77
-
78
- // src/validation/url.schema.ts
79
- var import_v44 = require("zod/v4");
80
- var UrlSchema = import_v44.z.string().url();
81
- var UrlPathSchema = import_v44.z.string().regex(/^\/(?:[a-zA-Z0-9-_]+(?:\/[a-zA-Z0-9-_]+)*\/?)?$/, {
82
- message: "Invalid URL path format. Must start with '/' and can contain letters, numbers, hyphens, and underscores."
83
42
  });
84
- var UrlOrPathSchema = import_v44.z.union([UrlSchema, UrlPathSchema]);
85
-
86
- // src/validation/dot-env.schema.ts
87
- var DotEnvSchema = import_v45.z.object({
88
- /** Base URL of the SettleMint platform instance */
89
- SETTLEMINT_INSTANCE: UrlSchema.default("https://console.settlemint.com"),
90
- /** Application access token for authenticating with SettleMint services */
91
- SETTLEMINT_ACCESS_TOKEN: ApplicationAccessTokenSchema.optional(),
92
- /** @internal */
93
- SETTLEMINT_PERSONAL_ACCESS_TOKEN: PersonalAccessTokenSchema.optional(),
94
- /** Unique name of the workspace */
95
- SETTLEMINT_WORKSPACE: UniqueNameSchema.optional(),
96
- /** Unique name of the application */
97
- SETTLEMINT_APPLICATION: UniqueNameSchema.optional(),
98
- /** Unique name of the blockchain network */
99
- SETTLEMINT_BLOCKCHAIN_NETWORK: UniqueNameSchema.optional(),
100
- /** Chain ID of the blockchain network */
101
- SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID: import_v45.z.string().optional(),
102
- /** Unique name of the blockchain node (should have a private key for signing transactions) */
103
- SETTLEMINT_BLOCKCHAIN_NODE: UniqueNameSchema.optional(),
104
- /** JSON RPC endpoint for the blockchain node */
105
- SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: UrlSchema.optional(),
106
- /** Unique name of the blockchain node or load balancer */
107
- SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: UniqueNameSchema.optional(),
108
- /** JSON RPC endpoint for the blockchain node or load balancer */
109
- SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT: UrlSchema.optional(),
110
- /** Unique name of the Hasura instance */
111
- SETTLEMINT_HASURA: UniqueNameSchema.optional(),
112
- /** Endpoint URL for the Hasura GraphQL API */
113
- SETTLEMINT_HASURA_ENDPOINT: UrlSchema.optional(),
114
- /** Admin secret for authenticating with Hasura */
115
- SETTLEMINT_HASURA_ADMIN_SECRET: import_v45.z.string().optional(),
116
- /** Database connection URL for Hasura */
117
- SETTLEMINT_HASURA_DATABASE_URL: import_v45.z.string().optional(),
118
- /** Unique name of The Graph instance */
119
- SETTLEMINT_THEGRAPH: UniqueNameSchema.optional(),
120
- /** Array of endpoint URLs for The Graph subgraphs */
121
- SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: import_v45.z.preprocess(
122
- (value) => tryParseJson(value, []),
123
- import_v45.z.array(UrlSchema).optional()
124
- ),
125
- /** Default The Graph subgraph to use */
126
- SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: import_v45.z.string().optional(),
127
- /** Unique name of the Smart Contract Portal instance */
128
- SETTLEMINT_PORTAL: UniqueNameSchema.optional(),
129
- /** GraphQL endpoint URL for the Portal */
130
- SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT: UrlSchema.optional(),
131
- /** REST endpoint URL for the Portal */
132
- SETTLEMINT_PORTAL_REST_ENDPOINT: UrlSchema.optional(),
133
- /** WebSocket endpoint URL for the Portal */
134
- SETTLEMINT_PORTAL_WS_ENDPOINT: UrlSchema.optional(),
135
- /** Unique name of the HD private key */
136
- SETTLEMINT_HD_PRIVATE_KEY: UniqueNameSchema.optional(),
137
- /** Address of the HD private key forwarder */
138
- SETTLEMINT_HD_PRIVATE_KEY_FORWARDER_ADDRESS: import_v45.z.string().optional(),
139
- /** Unique name of the accessible private key */
140
- SETTLEMINT_ACCESSIBLE_PRIVATE_KEY: UniqueNameSchema.optional(),
141
- /** Unique name of the MinIO instance */
142
- SETTLEMINT_MINIO: UniqueNameSchema.optional(),
143
- /** Endpoint URL for MinIO */
144
- SETTLEMINT_MINIO_ENDPOINT: UrlSchema.optional(),
145
- /** Access key for MinIO authentication */
146
- SETTLEMINT_MINIO_ACCESS_KEY: import_v45.z.string().optional(),
147
- /** Secret key for MinIO authentication */
148
- SETTLEMINT_MINIO_SECRET_KEY: import_v45.z.string().optional(),
149
- /** Unique name of the IPFS instance */
150
- SETTLEMINT_IPFS: UniqueNameSchema.optional(),
151
- /** API endpoint URL for IPFS */
152
- SETTLEMINT_IPFS_API_ENDPOINT: UrlSchema.optional(),
153
- /** Pinning service endpoint URL for IPFS */
154
- SETTLEMINT_IPFS_PINNING_ENDPOINT: UrlSchema.optional(),
155
- /** Gateway endpoint URL for IPFS */
156
- SETTLEMINT_IPFS_GATEWAY_ENDPOINT: UrlSchema.optional(),
157
- /** Unique name of the custom deployment */
158
- SETTLEMINT_CUSTOM_DEPLOYMENT: UniqueNameSchema.optional(),
159
- /** Endpoint URL for the custom deployment */
160
- SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: UrlSchema.optional(),
161
- /** Unique name of the Blockscout instance */
162
- SETTLEMINT_BLOCKSCOUT: UniqueNameSchema.optional(),
163
- /** GraphQL endpoint URL for Blockscout */
164
- SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT: UrlSchema.optional(),
165
- /** UI endpoint URL for Blockscout */
166
- SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT: UrlSchema.optional(),
167
- /** Name of the new project being created */
168
- SETTLEMINT_NEW_PROJECT_NAME: import_v45.z.string().optional(),
169
- /** The log level to use */
170
- SETTLEMINT_LOG_LEVEL: import_v45.z.enum(["debug", "info", "warn", "error", "none"]).default("warn")
43
+ Object.defineProperty(exports, 'DotEnvSchema', {
44
+ enumerable: true,
45
+ get: function () {
46
+ return src_validation_dot_env_schema_js.DotEnvSchema;
47
+ }
171
48
  });
172
- var DotEnvSchemaPartial = DotEnvSchema.partial();
173
-
174
- // src/validation/id.schema.ts
175
- var import_v46 = require("zod/v4");
176
- var IdSchema = import_v46.z.union([
177
- import_v46.z.string().uuid(),
178
- // PostgreSQL UUID
179
- import_v46.z.string().regex(/^[0-9a-fA-F]{24}$/)
180
- // MongoDB ObjectID
181
- ]);
182
- // Annotate the CommonJS export names for ESM import in node:
183
- 0 && (module.exports = {
184
- AccessTokenSchema,
185
- ApplicationAccessTokenSchema,
186
- DotEnvSchema,
187
- DotEnvSchemaPartial,
188
- IdSchema,
189
- PersonalAccessTokenSchema,
190
- UniqueNameSchema,
191
- UrlOrPathSchema,
192
- UrlPathSchema,
193
- UrlSchema,
194
- validate
49
+ Object.defineProperty(exports, 'DotEnvSchemaPartial', {
50
+ enumerable: true,
51
+ get: function () {
52
+ return src_validation_dot_env_schema_js.DotEnvSchemaPartial;
53
+ }
54
+ });
55
+ Object.defineProperty(exports, 'IdSchema', {
56
+ enumerable: true,
57
+ get: function () {
58
+ return src_validation_id_schema_js.IdSchema;
59
+ }
60
+ });
61
+ Object.defineProperty(exports, 'PersonalAccessTokenSchema', {
62
+ enumerable: true,
63
+ get: function () {
64
+ return src_validation_access_token_schema_js.PersonalAccessTokenSchema;
65
+ }
66
+ });
67
+ Object.defineProperty(exports, 'STANDALONE_INSTANCE', {
68
+ enumerable: true,
69
+ get: function () {
70
+ return src_validation_dot_env_schema_js.STANDALONE_INSTANCE;
71
+ }
72
+ });
73
+ Object.defineProperty(exports, 'UniqueNameSchema', {
74
+ enumerable: true,
75
+ get: function () {
76
+ return src_validation_unique_name_schema_js.UniqueNameSchema;
77
+ }
195
78
  });
196
- //# sourceMappingURL=validation.cjs.map
79
+ Object.defineProperty(exports, 'UrlOrPathSchema', {
80
+ enumerable: true,
81
+ get: function () {
82
+ return src_validation_url_schema_js.UrlOrPathSchema;
83
+ }
84
+ });
85
+ Object.defineProperty(exports, 'UrlPathSchema', {
86
+ enumerable: true,
87
+ get: function () {
88
+ return src_validation_url_schema_js.UrlPathSchema;
89
+ }
90
+ });
91
+ Object.defineProperty(exports, 'UrlSchema', {
92
+ enumerable: true,
93
+ get: function () {
94
+ return src_validation_url_schema_js.UrlSchema;
95
+ }
96
+ });
97
+ Object.defineProperty(exports, 'validate', {
98
+ enumerable: true,
99
+ get: function () {
100
+ return src_validation_validate_js.validate;
101
+ }
102
+ });