@cjkihl/with-coolify-env 1.0.0

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 ADDED
@@ -0,0 +1,255 @@
1
+ # @cjkihl/with-coolify-env
2
+
3
+ A robust Node.js utility for loading environment variables from [Coolify](https://coolify.io/) and executing commands with those variables loaded. Perfect for CI/CD pipelines, development workflows, and production deployments.
4
+
5
+ ## Features
6
+
7
+ - 🔐 **Secure**: Loads environment variables from Coolify's secure API
8
+ - 🚀 **Flexible**: Works as both a library and CLI tool
9
+ - 🔄 **Fallback Support**: Uses environment variables as configuration fallbacks
10
+ - 🛡️ **Production Safe**: Configurable to skip loading in production environments
11
+ - ⚡ **Fast**: Efficient API calls with timeout protection
12
+ - 📝 **Well Documented**: Comprehensive TypeScript types and JSDoc comments
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @cjkihl/with-coolify-env
18
+ ```
19
+
20
+ Or with yarn:
21
+
22
+ ```bash
23
+ yarn add @cjkihl/with-coolify-env
24
+ ```
25
+
26
+ Or with bun:
27
+
28
+ ```bash
29
+ bun add @cjkihl/with-coolify-env
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ### As a Library
35
+
36
+ ```typescript
37
+ import { loadEnv } from '@cjkihl/with-coolify-env';
38
+
39
+ // Basic usage with environment variables
40
+ await loadEnv({
41
+ command: 'npm',
42
+ args: ['start']
43
+ });
44
+
45
+ // Explicit configuration
46
+ await loadEnv({
47
+ endpoint: 'https://coolify.example.com',
48
+ appId: 'my-app-id',
49
+ token: 'my-api-token',
50
+ command: 'node',
51
+ args: ['server.js']
52
+ });
53
+ ```
54
+
55
+ ### As a CLI Tool
56
+
57
+ ```bash
58
+ # Basic usage
59
+ with-coolify-env npm start
60
+
61
+ # With explicit configuration
62
+ with-coolify-env --endpoint=https://coolify.example.com --app-id=my-app node server.js
63
+
64
+ # Skip production check
65
+ with-coolify-env --skip-production=false npm run build
66
+ ```
67
+
68
+ ## Configuration
69
+
70
+ ### Environment Variables
71
+
72
+ You can configure the tool using environment variables:
73
+
74
+ ```bash
75
+ export COOLIFY_ENDPOINT="https://coolify.example.com"
76
+ export COOLIFY_APP_ID="my-app-id"
77
+ export COOLIFY_TOKEN="my-api-token"
78
+ ```
79
+
80
+ ### Configuration Options
81
+
82
+ | Option | Type | Default | Description |
83
+ |--------|------|---------|-------------|
84
+ | `endpoint` | `string` | `process.env.COOLIFY_ENDPOINT` | Coolify API endpoint URL |
85
+ | `appId` | `string` | `process.env.COOLIFY_APP_ID` | Coolify application ID |
86
+ | `token` | `string` | `process.env.COOLIFY_TOKEN` | Coolify API token |
87
+ | `skipInProduction` | `boolean` | `true` | Skip loading env vars in production |
88
+ | `inheritStdio` | `boolean` | `true` | Inherit stdio from parent process |
89
+ | `command` | `string` | - | Command to execute (required) |
90
+ | `args` | `string[]` | `[]` | Arguments for the command |
91
+
92
+ ## API Reference
93
+
94
+ ### `loadEnv(config?: WithCoolifyEnvConfig): Promise<void>`
95
+
96
+ Loads environment variables from Coolify and executes a command with those variables.
97
+
98
+ #### Parameters
99
+
100
+ - `config` (optional): Configuration object
101
+
102
+ #### Returns
103
+
104
+ A promise that resolves when the child process exits successfully, or rejects with an error.
105
+
106
+ #### Throws
107
+
108
+ - `Error`: When no command is provided
109
+ - `Error`: When the child process fails to execute or exits with a non-zero code
110
+ - `Error`: When Coolify API requests fail
111
+
112
+ ### `WithCoolifyEnvConfig` Interface
113
+
114
+ ```typescript
115
+ interface WithCoolifyEnvConfig {
116
+ endpoint?: string;
117
+ appId?: string;
118
+ token?: string;
119
+ skipInProduction?: boolean;
120
+ inheritStdio?: boolean;
121
+ command?: string;
122
+ args?: string[];
123
+ }
124
+ ```
125
+
126
+ ## CLI Usage
127
+
128
+ ### Command Line Options
129
+
130
+ ```bash
131
+ with-coolify-env [options] <command> [args...]
132
+ ```
133
+
134
+ #### Options
135
+
136
+ - `--endpoint=<url>`: Coolify API endpoint URL
137
+ - `--app-id=<id>`: Coolify application ID
138
+ - `--token=<token>`: Coolify API token
139
+ - `--skip-production`: Skip loading env vars in production (default: true)
140
+ - `--inherit-stdio=<bool>`: Inherit stdio from parent process (default: true)
141
+ - `--help`: Show help message
142
+
143
+ ### Examples
144
+
145
+ ```bash
146
+ # Start a Node.js application
147
+ with-coolify-env npm start
148
+
149
+ # Run a build with explicit configuration
150
+ with-coolify-env \
151
+ --endpoint=https://coolify.example.com \
152
+ --app-id=my-app \
153
+ --token=my-token \
154
+ npm run build
155
+
156
+ # Execute a custom script
157
+ with-coolify-env node scripts/deploy.js
158
+
159
+ # Force loading in production
160
+ with-coolify-env --skip-production=false npm start
161
+ ```
162
+
163
+ ## Use Cases
164
+
165
+ ### Development Workflow
166
+
167
+ ```bash
168
+ # Load environment variables and start development server
169
+ with-coolify-env npm run dev
170
+ ```
171
+
172
+ ### CI/CD Pipeline
173
+
174
+ ```bash
175
+ # In your CI script
176
+ with-coolify-env \
177
+ --endpoint=$COOLIFY_ENDPOINT \
178
+ --app-id=$COOLIFY_APP_ID \
179
+ --token=$COOLIFY_TOKEN \
180
+ npm run build
181
+ ```
182
+
183
+ ### Docker Containers
184
+
185
+ ```dockerfile
186
+ # In your Dockerfile
187
+ RUN npm install -g @cjkihl/with-coolify-env
188
+
189
+ # In your entrypoint script
190
+ with-coolify-env node server.js
191
+ ```
192
+
193
+ ## Error Handling
194
+
195
+ The library provides detailed error messages for common issues:
196
+
197
+ ### Missing Configuration
198
+
199
+ ```bash
200
+ Error: Missing required Coolify configuration: endpoint, appId, token.
201
+ Please provide these values either in the config or as environment variables
202
+ (COOLIFY_ENDPOINT, COOLIFY_APP_ID, COOLIFY_TOKEN).
203
+ ```
204
+
205
+ ### API Errors
206
+
207
+ ```bash
208
+ Error: Failed to fetch environment variables from Coolify: HTTP 401 Unauthorized
209
+ Response: {"error": "Invalid token"}
210
+ ```
211
+
212
+ ### Command Execution Errors
213
+
214
+ ```bash
215
+ Error: Command failed with exit code 1
216
+ Command: npm start
217
+ Error output:
218
+ npm ERR! missing script: start
219
+ ```
220
+
221
+ ## Troubleshooting
222
+
223
+ ### Common Issues
224
+
225
+ 1. **Authentication Errors**: Ensure your Coolify token is valid and has the necessary permissions
226
+ 2. **Network Timeouts**: The API request has a 30-second timeout. Check your network connection
227
+ 3. **Invalid App ID**: Verify that the application ID exists in your Coolify instance
228
+ 4. **Production Environment**: By default, the tool skips loading in production. Use `skipInProduction: false` to override
229
+
230
+ ### Debug Mode
231
+
232
+ Enable debug logging by setting the `DEBUG` environment variable:
233
+
234
+ ```bash
235
+ DEBUG=* with-coolify-env npm start
236
+ ```
237
+
238
+ ## Security Considerations
239
+
240
+ - **Token Security**: Never commit API tokens to version control
241
+ - **Environment Variables**: Use environment variables for sensitive configuration
242
+ - **Network Security**: Ensure HTTPS is used for Coolify endpoints in production
243
+ - **Token Permissions**: Use tokens with minimal required permissions
244
+
245
+ ## Contributing
246
+
247
+ Contributions are welcome! Please feel free to submit a Pull Request.
248
+
249
+ ## License
250
+
251
+ MIT License - see the [LICENSE](LICENSE) file for details.
252
+
253
+ ## Support
254
+
255
+ If you encounter any issues or have questions, please [open an issue](https://github.com/cjkihl/cjkihl/issues) on GitHub.
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Example usage of the with-coolify-env package
4
+ *
5
+ * This file demonstrates how to use the package both as a library
6
+ * and shows the expected behavior in different scenarios.
7
+ */
8
+ import { loadEnv } from "./index.pub.js";
9
+ /**
10
+ * Example 1: Basic usage with environment variables
11
+ *
12
+ * This example assumes you have set the following environment variables:
13
+ * - COOLIFY_ENDPOINT
14
+ * - COOLIFY_APP_ID
15
+ * - COOLIFY_TOKEN
16
+ */
17
+ async function basicExample() {
18
+ console.log("Example 1: Basic usage with environment variables");
19
+ try {
20
+ await loadEnv({
21
+ args: ["Hello from Coolify!"],
22
+ command: "echo",
23
+ });
24
+ }
25
+ catch (error) {
26
+ console.error("Basic example failed:", error instanceof Error ? error.message : error);
27
+ }
28
+ }
29
+ /**
30
+ * Example 2: Explicit configuration
31
+ */
32
+ async function explicitConfigExample() {
33
+ console.log("\nExample 2: Explicit configuration");
34
+ const config = {
35
+ appId: "my-app-id",
36
+ args: ["--version"],
37
+ command: "node",
38
+ endpoint: "https://coolify.example.com",
39
+ token: "my-api-token",
40
+ };
41
+ try {
42
+ await loadEnv(config);
43
+ }
44
+ catch (error) {
45
+ console.error("Explicit config example failed:", error instanceof Error ? error.message : error);
46
+ }
47
+ }
48
+ /**
49
+ * Example 3: Production environment handling
50
+ */
51
+ async function productionExample() {
52
+ console.log("\nExample 3: Production environment handling");
53
+ // Simulate production environment
54
+ const originalNodeEnv = process.env.NODE_ENV;
55
+ process.env.NODE_ENV = "production";
56
+ try {
57
+ await loadEnv({
58
+ args: ["This should be skipped in production"],
59
+ command: "echo",
60
+ });
61
+ }
62
+ catch (error) {
63
+ console.error("Production example failed:", error instanceof Error ? error.message : error);
64
+ }
65
+ finally {
66
+ // Restore original NODE_ENV
67
+ process.env.NODE_ENV = originalNodeEnv;
68
+ }
69
+ }
70
+ /**
71
+ * Example 4: Force loading in production
72
+ */
73
+ async function forceProductionExample() {
74
+ console.log("\nExample 4: Force loading in production");
75
+ // Simulate production environment
76
+ const originalNodeEnv = process.env.NODE_ENV;
77
+ process.env.NODE_ENV = "production";
78
+ try {
79
+ await loadEnv({
80
+ args: ["This should run even in production"],
81
+ command: "echo",
82
+ skipInProduction: false,
83
+ });
84
+ }
85
+ catch (error) {
86
+ console.error("Force production example failed:", error instanceof Error ? error.message : error);
87
+ }
88
+ finally {
89
+ // Restore original NODE_ENV
90
+ process.env.NODE_ENV = originalNodeEnv;
91
+ }
92
+ }
93
+ /**
94
+ * Example 5: Error handling demonstration
95
+ */
96
+ async function errorHandlingExample() {
97
+ console.log("\nExample 5: Error handling demonstration");
98
+ try {
99
+ // This will fail because no command is provided
100
+ await loadEnv({});
101
+ }
102
+ catch (error) {
103
+ console.log("Expected error caught:", error instanceof Error ? error.message : error);
104
+ }
105
+ }
106
+ /**
107
+ * Main function to run all examples
108
+ */
109
+ async function runExamples() {
110
+ console.log("Running with-coolify-env examples...\n");
111
+ await basicExample();
112
+ await explicitConfigExample();
113
+ await productionExample();
114
+ await forceProductionExample();
115
+ await errorHandlingExample();
116
+ console.log("\nExamples completed!");
117
+ }
118
+ // Run examples if this file is executed directly
119
+ if (import.meta.url === `file://${process.argv[1]}`) {
120
+ runExamples().catch(console.error);
121
+ }
122
+ export { basicExample, explicitConfigExample, productionExample, forceProductionExample, errorHandlingExample, runExamples, };
123
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","sourceRoot":"","sources":["../../example.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAA6B,MAAM,gBAAgB,CAAC;AAEpE;;;;;;;GAOG;AACH,KAAK,UAAU,YAAY;IAC1B,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IAEjE,IAAI,CAAC;QACJ,MAAM,OAAO,CAAC;YACb,IAAI,EAAE,CAAC,qBAAqB,CAAC;YAC7B,OAAO,EAAE,MAAM;SACf,CAAC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CACZ,uBAAuB,EACvB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;IACH,CAAC;AACF,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,qBAAqB;IACnC,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAyB;QACpC,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,CAAC,WAAW,CAAC;QACnB,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,6BAA6B;QACvC,KAAK,EAAE,cAAc;KACrB,CAAC;IAEF,IAAI,CAAC;QACJ,MAAM,OAAO,CAAC,MA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,oBAAoB,EACpB,WAAW,GACX,CAAC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Fetches environment variables from a Coolify instance
3
+ *
4
+ * This function makes an authenticated API request to Coolify to retrieve
5
+ * environment variables for a specific application. The response is expected
6
+ * to be a JSON array of objects with `key` and `value` properties.
7
+ *
8
+ * @param endpoint - The Coolify API endpoint URL (e.g., "https://coolify.example.com")
9
+ * @param appId - The Coolify application ID to fetch environment variables for
10
+ * @param token - The Coolify API token for authentication
11
+ * @returns A promise that resolves to an array of environment variables
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const envs = await fetchCoolifyEnvs(
16
+ * "https://coolify.example.com",
17
+ * "my-app-id",
18
+ * "my-api-token"
19
+ * );
20
+ *
21
+ * for (const env of envs) {
22
+ * console.log(`${env.key}=${env.value}`);
23
+ * }
24
+ * ```
25
+ *
26
+ * @throws {Error} When required parameters (endpoint, appId, token) are missing
27
+ * @throws {Error} When the API request fails or returns a non-OK status
28
+ * @throws {Error} When the response cannot be parsed as JSON
29
+ */
30
+ export async function fetchCoolifyEnvs(endpoint, appId, token) {
31
+ // Validate required parameters
32
+ if (!endpoint || !token || !appId) {
33
+ const missingParams = [];
34
+ if (!endpoint)
35
+ missingParams.push("endpoint");
36
+ if (!appId)
37
+ missingParams.push("appId");
38
+ if (!token)
39
+ missingParams.push("token");
40
+ throw new Error(`Missing required Coolify configuration: ${missingParams.join(", ")}. ` +
41
+ "Please provide these values either in the config or as environment variables " +
42
+ "(COOLIFY_ENDPOINT, COOLIFY_APP_ID, COOLIFY_TOKEN).");
43
+ }
44
+ // Construct the API URL
45
+ const url = `${endpoint}/api/v1/applications/${appId}/envs`;
46
+ console.log(`Fetching environment variables from Coolify at ${url}`);
47
+ // Prepare request headers
48
+ const headers = {
49
+ Authorization: `Bearer ${token}`,
50
+ "Content-Type": "application/json",
51
+ };
52
+ try {
53
+ // Make the API request
54
+ const response = await fetch(url, {
55
+ headers,
56
+ method: "GET",
57
+ // Add timeout for better error handling
58
+ signal: AbortSignal.timeout(30000), // 30 second timeout
59
+ });
60
+ const text = await response.text();
61
+ // Check if the request was successful
62
+ if (!response.ok) {
63
+ throw new Error("Failed to fetch environment variables from Coolify: " +
64
+ `HTTP ${response.status} ${response.statusText}\n` +
65
+ `Response: ${text}`);
66
+ }
67
+ // Parse the JSON response
68
+ try {
69
+ const parsed = JSON.parse(text);
70
+ // Validate the response structure
71
+ if (!Array.isArray(parsed)) {
72
+ throw new Error("Invalid response format: expected an array of environment variables");
73
+ }
74
+ // Filter out invalid entries
75
+ const validEnvs = parsed.filter((env) => env && typeof env.key === "string" && typeof env.value === "string");
76
+ console.log(`Successfully loaded ${validEnvs.length} environment variables from Coolify`);
77
+ return validEnvs;
78
+ }
79
+ catch (parseError) {
80
+ throw new Error(`Failed to parse Coolify API response as JSON: ${parseError}\n` +
81
+ `Response: ${text}`);
82
+ }
83
+ }
84
+ catch (error) {
85
+ // Handle network errors and other exceptions
86
+ if (error instanceof Error) {
87
+ if (error.name === "AbortError") {
88
+ throw new Error("Request to Coolify API timed out after 30 seconds");
89
+ }
90
+ throw new Error(`Error fetching Coolify environment variables: ${error.message}`);
91
+ }
92
+ throw new Error(`Unexpected error fetching Coolify environment variables: ${error}`);
93
+ }
94
+ }
95
+ //# sourceMappingURL=fetch-coolify-env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-coolify-env.js","sourceRoot":"","sources":["../../fetch-coolify-env.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,QAA4B,EAC5B,KAAyB,EACzB,KAAyB;IAEzB,+BAA+B;IAC/B,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;QACnC,MAAM,aAAa,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,QAAQ;YAAE,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;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,KAAK,CACd,qEAAqE,CACrE,CAAC;YACH,CAAC;YAED,6BAA6B;YAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAC9B,CAAC,GAAG,EAAE,EAAE,CACP,GAAG,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ,CACpE,CAAC;YAEF,OAAO,CAAC,GAAG,CACV,uBAAuB,SAAS,CAAC,MAAM,qCAAqC,CAC5E,CAAC;YACF,OAAO,SAAS,CAAC;QAClB,CAAC;QAAC,OAAO,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CACd,iDAAiD,UAAU,IAAI;gBAC9D,aAAa,IAAI,EAAE,CACpB,CAAC;QACH,CAAC;IACF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,6CAA6C;QAC7C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC5B,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBACjC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YACtE,CAAC;YACD,MAAM,IAAI,KAAK,CACd,iDAAiD,KAAK,CAAC,OAAO,EAAE,CAChE,CAAC;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CACd,4DAA4D,KAAK,EAAE,CACnE,CAAC;IACH,CAAC;AACF,CAAC"}
@@ -0,0 +1,120 @@
1
+ import { spawn } from "node:child_process";
2
+ import { fetchCoolifyEnvs } from "./fetch-coolify-env.js";
3
+ /**
4
+ * Default configuration values
5
+ * Uses environment variables as fallbacks for Coolify credentials
6
+ */
7
+ const defaultConfig = {
8
+ appId: process.env.COOLIFY_APP_ID || "",
9
+ args: [],
10
+ command: "",
11
+ endpoint: process.env.COOLIFY_ENDPOINT || "",
12
+ inheritStdio: true,
13
+ skipInProduction: true,
14
+ token: process.env.COOLIFY_TOKEN || "",
15
+ };
16
+ /**
17
+ * Loads environment variables from Coolify and executes a command with those variables
18
+ *
19
+ * This function fetches environment variables from a Coolify instance using the provided
20
+ * credentials, loads them into the current process environment, and then spawns a child
21
+ * process with the specified command and arguments.
22
+ *
23
+ * @param config - Configuration options for loading environment variables and executing the command
24
+ * @returns A promise that resolves when the child process exits successfully, or rejects with an error
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * // Basic usage with environment variables
29
+ * await loadEnv({
30
+ * command: "npm",
31
+ * args: ["start"]
32
+ * });
33
+ *
34
+ * // Explicit configuration
35
+ * await loadEnv({
36
+ * endpoint: "https://coolify.example.com",
37
+ * appId: "my-app-id",
38
+ * token: "my-token",
39
+ * command: "node",
40
+ * args: ["server.js"]
41
+ * });
42
+ *
43
+ * // Skip production check
44
+ * await loadEnv({
45
+ * skipInProduction: false,
46
+ * command: "npm",
47
+ * args: ["run", "build"]
48
+ * });
49
+ * ```
50
+ *
51
+ * @throws {Error} When no command is provided
52
+ * @throws {Error} When the child process fails to execute or exits with a non-zero code
53
+ * @throws {Error} When Coolify API requests fail
54
+ */
55
+ export async function loadEnv(config = {}) {
56
+ const finalConfig = { ...defaultConfig, ...config };
57
+ // Check for required command first
58
+ const command = finalConfig.command;
59
+ if (!command) {
60
+ throw new Error("No command provided to execute");
61
+ }
62
+ // Skip loading environment variables in production if configured to do so
63
+ if (finalConfig.skipInProduction && process.env.NODE_ENV === "production") {
64
+ console.log("Skipping loading env file because the process is running in the Prod environment");
65
+ }
66
+ else {
67
+ // Fetch and load environment variables from Coolify
68
+ const envs = await fetchCoolifyEnvs(finalConfig.endpoint, finalConfig.appId, finalConfig.token);
69
+ // Load environment variables into the current process
70
+ for (const env of envs) {
71
+ if (env.key && env.value) {
72
+ process.env[env.key] = env.value;
73
+ }
74
+ }
75
+ }
76
+ console.log("Spawning process with arguments:", command, finalConfig.args);
77
+ return new Promise((resolve, reject) => {
78
+ let stderrOutput = "";
79
+ // Spawn the child process with the loaded environment variables
80
+ const proc = spawn(command, finalConfig.args ?? [], {
81
+ env: process.env,
82
+ shell: true,
83
+ stdio: finalConfig.inheritStdio ? "inherit" : "pipe",
84
+ });
85
+ // Capture stderr output if not inheriting stdio
86
+ if (!finalConfig.inheritStdio) {
87
+ proc.stderr?.on("data", (data) => {
88
+ stderrOutput += data.toString();
89
+ });
90
+ }
91
+ // Handle process exit
92
+ proc.on("exit", (code) => {
93
+ if (code === 0) {
94
+ resolve();
95
+ }
96
+ else {
97
+ const errorMessage = [
98
+ `Command failed with exit code ${code}`,
99
+ `Command: ${command} ${finalConfig.args?.join(" ") || ""}`,
100
+ stderrOutput
101
+ ? `Error output:\n${stderrOutput}`
102
+ : "No error output available",
103
+ ].join("\n");
104
+ reject(new Error(errorMessage));
105
+ }
106
+ });
107
+ // Handle process errors
108
+ proc.on("error", (err) => {
109
+ const errorMessage = [
110
+ `Failed to execute command: ${err.message}`,
111
+ `Command: ${command} ${finalConfig.args?.join(" ") || ""}`,
112
+ stderrOutput
113
+ ? `Error output:\n${stderrOutput}`
114
+ : "No error output available",
115
+ ].join("\n");
116
+ reject(new Error(errorMessage));
117
+ });
118
+ });
119
+ }
120
+ //# sourceMappingURL=index.pub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.pub.js","sourceRoot":"","sources":["../../index.pub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAsB1D;;;GAGG;AACH,MAAM,aAAa,GAAmC;IACrD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE;IACvC,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE;IAC5C,YAAY,EAAE,IAAI;IAClB,gBAAgB,EAAE,IAAI;IACtB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE;CACtC,CAAC;AAEF;;;;;;;;;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I,CAAC,CAAC;YACb,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Basic test for the with-coolify-env package
4
+ *
5
+ * This test verifies that the package can be imported and used
6
+ * without actually making API calls to Coolify.
7
+ */
8
+ import { loadEnv } from "./index.pub.js";
9
+ /**
10
+ * Test configuration validation
11
+ */
12
+ function testConfigValidation() {
13
+ console.log("Testing configuration validation...");
14
+ // Test that the interface is properly exported
15
+ const config = {
16
+ appId: "test-app",
17
+ args: ["test"],
18
+ command: "echo",
19
+ endpoint: "https://test.example.com",
20
+ token: "test-token",
21
+ };
22
+ console.log("✓ Configuration interface works correctly");
23
+ return config;
24
+ }
25
+ /**
26
+ * Test error handling for missing command
27
+ */
28
+ async function testMissingCommand() {
29
+ console.log("\nTesting missing command error...");
30
+ try {
31
+ await loadEnv({});
32
+ console.log("✗ Should have thrown an error for missing command");
33
+ return false;
34
+ }
35
+ catch (error) {
36
+ if (error instanceof Error &&
37
+ error.message.includes("No command provided")) {
38
+ console.log("✓ Correctly throws error for missing command");
39
+ return true;
40
+ }
41
+ console.log("✗ Unexpected error:", error);
42
+ return false;
43
+ }
44
+ }
45
+ /**
46
+ * Test that the package can be imported and basic functionality works
47
+ */
48
+ async function testBasicFunctionality() {
49
+ console.log("\nTesting basic functionality...");
50
+ // Test error handling
51
+ const errorHandlingWorks = await testMissingCommand();
52
+ if (errorHandlingWorks) {
53
+ console.log("\n✓ All basic tests passed!");
54
+ console.log("✓ Package is properly structured and exported");
55
+ console.log("✓ Error handling works correctly");
56
+ return true;
57
+ }
58
+ console.log("\n✗ Some tests failed");
59
+ return false;
60
+ }
61
+ // Run the test if this file is executed directly
62
+ if (import.meta.url === `file://${process.argv[1]}`) {
63
+ testBasicFunctionality()
64
+ .then((success) => {
65
+ process.exit(success ? 0 : 1);
66
+ })
67
+ .catch((error) => {
68
+ console.error("Test failed with error:", error);
69
+ process.exit(1);
70
+ });
71
+ }
72
+ export { testConfigValidation, testMissingCommand, testBasicFunctionality };
73
+ //# sourceMappingURL=test-basic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-basic.js","sourceRoot":"","sources":["../../test-basic.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAA6B,MAAM,gBAAgB,CAAC;AAEpE;;GAEG;AACH,SAAS,oBAAoB;IAC5B,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IAEnD,+CAA+C;IAC/C,MAAM,MAAM,GAAyB;QACpC,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,CAAC,MAAM,CAAC;QACd,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,0BAA0B;QACpC,KAAK,EAAE,YAAY;KACnB,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,kBAAkB;IAChC,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAElD,IAAI,CAAC;QACJ,MAAM,OAAO,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;QACjE,OAAO,KAAK,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IACC,KAAK,YAAY,KAAK;YACtB,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAC5C,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;YAC5D,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,sBAAsB;IACpC,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAEhD,sBAAsB;IACtB,MAAM,kBAAkB,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAEtD,IAAI,kBAAkB,EAAE,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;QAC7D,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACrC,OAAO,KAAK,CAAC;AACd,CAAC;AAED,iDAAiD;AACjD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACrD,sBAAsB,EAAE;SACtB,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAChB,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+ import { loadEnv } from "./index.pub.js";
3
+ /**
4
+ * CLI interface for the Coolify environment loader
5
+ *
6
+ * This script provides a command-line interface for loading environment variables
7
+ * from Coolify and executing commands with those variables loaded.
8
+ *
9
+ * Usage:
10
+ * with-coolify-env [options] <command> [args...]
11
+ *
12
+ * Options:
13
+ * --endpoint=<url> Coolify API endpoint URL
14
+ * --app-id=<id> Coolify application ID
15
+ * --token=<token> Coolify API token
16
+ * --skip-production Skip loading env vars in production (default: true)
17
+ * --inherit-stdio=<bool> Inherit stdio from parent process (default: true)
18
+ * --help Show this help message
19
+ *
20
+ * Environment Variables:
21
+ * COOLIFY_ENDPOINT Coolify API endpoint URL (fallback)
22
+ * COOLIFY_APP_ID Coolify application ID (fallback)
23
+ * COOLIFY_TOKEN Coolify API token (fallback)
24
+ *
25
+ * Examples:
26
+ * with-coolify-env npm start
27
+ * with-coolify-env --endpoint=https://coolify.example.com --app-id=my-app node server.js
28
+ * with-coolify-env --skip-production=false npm run build
29
+ */
30
+ /**
31
+ * Shows the help message and exits
32
+ */
33
+ function showHelp() {
34
+ console.log(`
35
+ Usage: with-coolify-env [options] <command> [args...]
36
+
37
+ Load environment variables from Coolify and execute a command with those variables.
38
+
39
+ Options:
40
+ --endpoint=<url> Coolify API endpoint URL
41
+ --app-id=<id> Coolify application ID
42
+ --token=<token> Coolify API token
43
+ --skip-production Skip loading env vars in production (default: true)
44
+ --inherit-stdio=<bool> Inherit stdio from parent process (default: true)
45
+ --help Show this help message
46
+
47
+ Environment Variables (used as fallbacks):
48
+ COOLIFY_ENDPOINT Coolify API endpoint URL
49
+ COOLIFY_APP_ID Coolify application ID
50
+ COOLIFY_TOKEN Coolify API token
51
+
52
+ Examples:
53
+ with-coolify-env npm start
54
+ with-coolify-env --endpoint=https://coolify.example.com --app-id=my-app node server.js
55
+ with-coolify-env --skip-production=false npm run build
56
+ `);
57
+ process.exit(0);
58
+ }
59
+ /**
60
+ * Parses command line arguments and extracts options and command
61
+ *
62
+ * @param args - Command line arguments array
63
+ * @returns Object containing parsed options and command with arguments
64
+ */
65
+ function parseArgs(args) {
66
+ const options = {};
67
+ const command = [];
68
+ // Parse options
69
+ for (let i = 0; i < args.length; i++) {
70
+ const arg = args[i];
71
+ if (!arg)
72
+ continue;
73
+ // Handle help flag
74
+ if (arg === "--help" || arg === "-h") {
75
+ showHelp();
76
+ }
77
+ // Parse option flags
78
+ if (arg.startsWith("--")) {
79
+ const [key, value] = arg.slice(2).split("=");
80
+ if (!key)
81
+ continue;
82
+ // Handle boolean flags
83
+ if (value === undefined) {
84
+ options[key] = true;
85
+ }
86
+ else {
87
+ // Handle string values
88
+ options[key] = value;
89
+ }
90
+ }
91
+ else {
92
+ // Everything after the first non-option argument is part of the command
93
+ command.push(...args.slice(i));
94
+ break;
95
+ }
96
+ }
97
+ return { command, options };
98
+ }
99
+ /**
100
+ * Converts CLI options to the configuration format expected by loadEnv
101
+ *
102
+ * @param options - Parsed CLI options
103
+ * @returns Configuration object for loadEnv
104
+ */
105
+ function convertOptionsToConfig(options) {
106
+ return {
107
+ appId: options["app-id"],
108
+ endpoint: options.endpoint,
109
+ inheritStdio: options["inherit-stdio"] !== false,
110
+ skipInProduction: options["skip-production"] !== false,
111
+ token: options.token,
112
+ };
113
+ }
114
+ // Main execution
115
+ try {
116
+ const args = process.argv.slice(2);
117
+ // Show help if no arguments provided
118
+ if (args.length === 0) {
119
+ showHelp();
120
+ }
121
+ const { options, command } = parseArgs(args);
122
+ // Validate that a command was provided
123
+ if (command.length === 0) {
124
+ console.error("Error: No command provided");
125
+ console.error("Use --help for usage information");
126
+ process.exit(1);
127
+ }
128
+ // Convert options to configuration format
129
+ const config = convertOptionsToConfig(options);
130
+ // Execute loadEnv with the parsed config and remaining command
131
+ loadEnv({
132
+ ...config,
133
+ args: command.slice(1),
134
+ command: command[0],
135
+ }).catch((error) => {
136
+ console.error("Error:", error.message);
137
+ process.exit(1);
138
+ });
139
+ }
140
+ catch (error) {
141
+ console.error("Unexpected error:", error instanceof Error ? error.message : error);
142
+ process.exit(1);
143
+ }
144
+ //# sourceMappingURL=with-env.bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with-env.bin.js","sourceRoot":"","sources":["../../with-env.bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAA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C,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACJ,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IAChB,OAAO,CAAC,KAAK,CACZ,mBAAmB,EACnB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC"}
@@ -0,0 +1 @@
1
+ {"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../node_modules/typescript/lib/lib.esnext.float16.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../fetch-coolify-env.ts","../index.pub.ts","../example.ts","../test-basic.ts","../with-env.bin.ts","../../../node_modules/bun-types/globals.d.ts","../../../node_modules/bun-types/s3.d.ts","../../../node_modules/undici-types/utility.d.ts","../../../node_modules/undici-types/header.d.ts","../../../node_modules/undici-types/readable.d.ts","../../../node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/dom-events.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/sea.d.ts","../../../node_modules/@types/node/sqlite.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/undici-types/fetch.d.ts","../../../node_modules/undici-types/formdata.d.ts","../../../node_modules/undici-types/connector.d.ts","../../../node_modules/undici-types/client.d.ts","../../../node_modules/undici-types/errors.d.ts","../../../node_modules/undici-types/dispatcher.d.ts","../../../node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/undici-types/global-origin.d.ts","../../../node_modules/undici-types/pool-stats.d.ts","../../../node_modules/undici-types/pool.d.ts","../../../node_modules/undici-types/handlers.d.ts","../../../node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/undici-types/h2c-client.d.ts","../../../node_modules/undici-types/agent.d.ts","../../../node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/undici-types/mock-call-history.d.ts","../../../node_modules/undici-types/mock-agent.d.ts","../../../node_modules/undici-types/mock-client.d.ts","../../../node_modules/undici-types/mock-pool.d.ts","../../../node_modules/undici-types/mock-errors.d.ts","../../../node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/undici-types/retry-handler.d.ts","../../../node_modules/undici-types/retry-agent.d.ts","../../../node_modules/undici-types/api.d.ts","../../../node_modules/undici-types/cache-interceptor.d.ts","../../../node_modules/undici-types/interceptors.d.ts","../../../node_modules/undici-types/util.d.ts","../../../node_modules/undici-types/cookies.d.ts","../../../node_modules/undici-types/patch.d.ts","../../../node_modules/undici-types/websocket.d.ts","../../../node_modules/undici-types/eventsource.d.ts","../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/undici-types/content-type.d.ts","../../../node_modules/undici-types/cache.d.ts","../../../node_modules/undici-types/index.d.ts","../../../node_modules/bun-types/fetch.d.ts","../../../node_modules/bun-types/bun.d.ts","../../../node_modules/bun-types/extensions.d.ts","../../../node_modules/bun-types/devserver.d.ts","../../../node_modules/bun-types/ffi.d.ts","../../../node_modules/bun-types/html-rewriter.d.ts","../../../node_modules/bun-types/jsc.d.ts","../../../node_modules/bun-types/sqlite.d.ts","../../../node_modules/bun-types/test.d.ts","../../../node_modules/bun-types/wasm.d.ts","../../../node_modules/bun-types/overrides.d.ts","../../../node_modules/bun-types/deprecated.d.ts","../../../node_modules/bun-types/redis.d.ts","../../../node_modules/bun-types/shell.d.ts","../../../node_modules/bun-types/bun.ns.d.ts","../../../node_modules/bun-types/index.d.ts","../../../node_modules/@types/bun/index.d.ts"],"fileIdsList":[[65,66,72,77,164,165,167,173,175,176,177,179],[65,66,72,74,77,164,165,167,173,175,176,177],[65,66,72,76,77,164,165,167,173,175,176,177],[65,66,77,164,165,167,173,175,176,177],[65,66,72,77,82,112,164,165,167,173,175,176,177],[65,66,72,77,78,83,89,90,97,109,120,164,165,167,173,175,176,177],[65,66,72,77,78,79,89,97,164,165,167,173,175,176,177],[65,66,72,77,164,165,167,173,175,176,177],[65,66,72,77,80,121,164,165,167,173,175,176,177],[65,66,72,77,81,82,90,98,164,165,167,173,175,176,177],[65,66,72,77,82,109,117,164,165,167,173,175,176,177],[65,66,72,77,83,85,89,97,164,165,167,173,175,176,177],[65,66,72,76,77,84,164,165,167,173,175,176,177],[65,66,72,77,85,86,164,165,167,173,175,176,177],[65,66,72,77,87,89,164,165,167,173,175,176,177],[65,66,72,76,77,89,164,165,167,173,175,176,177],[65,66,72,77,89,90,91,109,120,164,165,167,173,175,176,177],[65,66,72,77,89,90,91,104,109,112,164,165,167,173,174,175,176,177],[65,66,72,77,163,164,165,167,173,175,176,177],[65,66,72,77,85,89,92,97,109,120,163,164,165,167,173,175,176,177],[65,66,72,77,89,90,92,93,97,109,117,120,164,165,167,173,175,176,177],[65,66,72,77,92,94,109,117,120,164,165,167,173,175,176,177],[65,66,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,164,165,167,173,175,176,177],[65,66,72,77,89,95,164,165,167,173,175,176,177],[65,66,72,77,96,120,164,165,167,173,175,176,177],[65,66,72,77,85,89,97,109,164,165,167,173,175,176,177],[65,66,72,77,98,164,165,167,173,175,176,177],[65,66,72,77,99,164,165,167,173,175,176,177],[65,66,72,76,77,100,164,165,167,173,175,176,177],[65,66,72,74,75,76,77,78,79,80,81,82,83,84,85,86,87,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,164,165,167,173,174,175,176,177],[65,66,72,77,102,164,165,167,173,175,176,177],[65,66,72,77,103,164,165,167,173,175,176,177],[65,66,72,77,89,104,105,164,165,167,173,175,176,177],[65,66,72,77,104,106,121,123,164,165,167,173,175,176,177],[65,66,72,77,89,109,110,112,164,165,167,173,175,176,177],[65,66,72,77,111,112,164,165,167,173,175,176,177],[65,66,72,77,109,110,164,165,167,173,175,176,177],[65,66,72,77,112,164,165,167,173,175,176,177],[65,66,72,77,113,164,165,167,173,175,176,177],[65,66,72,74,77,109,164,165,167,173,175,176,177],[65,66,72,77,89,115,116,164,165,167,173,175,176,177],[65,66,72,77,115,116,164,165,167,173,175,176,177],[65,66,72,77,82,97,109,117,164,165,167,173,174,175,176,177],[65,66,72,77,118,164,165,167,173,175,176,177],[65,66,72,77,97,119,164,165,167,173,175,176,177],[65,66,72,77,92,103,120,164,165,167,173,175,176,177],[65,66,72,77,82,121,164,165,167,173,175,176,177],[65,66,72,77,109,122,164,165,167,173,175,176,177],[65,66,72,77,96,123,164,165,167,173,175,176,177],[65,66,72,77,124,164,165,167,173,175,176,177],[65,66,72,77,89,91,100,109,112,120,122,123,125,164,165,167,173,175,176,177],[65,66,72,77,109,126,164,165,167,173,175,176,177],[65,66,72,77,82,90,92,117,121,125,163,164,167,168,173,174,175,176,177],[65,66,72,77,164,165,167,173,176,177],[65,66,72,77,164,165,173,175,176,177],[65,66,72,77,163,165,167,173,175,176,177],[66,72,77,82,100,109,112,117,121,125,164,165,167,173,175,176,177],[65,66,72,77,127,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178],[65,66,72,77,82,90,91,98,117,126,164,165,167,173,175,176,177],[65,66,72,77,164,165,167,173,175,177],[65,72,77,90,164,165,167,173,175,176,177],[65,66,72,77,164,165,167,173,175,176],[65,66,72,77,164,165,167,175,176,177],[65,66,72,77,120,133,137,164,165,167,173,175,176,177],[65,66,72,77,109,120,133,164,165,167,173,175,176,177],[65,66,72,77,109,164,165,167,173,175,176,177],[65,66,72,77,128,164,165,167,173,175,176,177],[65,66,72,77,120,130,133,164,165,167,173,175,176,177],[65,66,72,77,97,117,164,165,167,173,174,175,176,177],[65,66,72,77,127,164,165,167,173,175,176,177],[65,66,72,77,127,128,164,165,167,173,175,176,177],[65,66,72,77,97,120,130,133,164,165,167,173,175,176,177],[65,66,67,68,69,72,77,89,109,120,129,132,164,165,167,173,175,176,177],[65,66,72,77,133,141,164,165,167,173,175,176,177],[65,66,68,72,77,131,164,165,167,173,175,176,177],[65,66,72,77,133,157,158,164,165,167,173,175,176,177],[65,66,68,72,77,112,120,127,129,133,164,165,167,173,175,176,177],[65,66,72,77,133,164,165,167,173,175,176,177],[65,66,67,72,77,164,165,167,173,175,176,177],[65,66,72,77,128,129,130,131,132,133,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,158,159,160,161,162,164,165,167,173,175,176,177],[65,66,72,77,85,133,150,153,164,165,167,173,175,176,177],[65,66,72,77,133,141,142,143,164,165,167,173,175,176,177],[65,66,72,77,131,133,142,144,164,165,167,173,175,176,177],[65,66,72,77,132,164,165,167,173,175,176,177],[65,66,68,72,77,128,133,164,165,167,173,175,176,177],[65,66,72,77,133,137,142,144,164,165,167,173,175,176,177],[65,66,72,77,137,164,165,167,173,175,176,177],[65,66,72,77,120,131,133,136,164,165,167,173,175,176,177],[65,66,68,72,77,130,133,141,164,165,167,173,175,176,177],[65,66,72,77,133,150,164,165,167,173,175,176,177],[65,66,72,77,112,125,127,128,133,157,164,165,167,173,175,176,177],[61,65,66,72,77,164,165,167,173,175,176,177],[60,65,66,72,77,78,164,165,167,173,175,176,177]],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"73b1d8aaebfb74b74aceb8996295c571daa83788f0fbc04b965b795603eb7205","signature":"78fe27068eafe7002b9a8e3e27a33d0aa49f1e1de26a709dbb97c6700674f479","impliedFormat":99},{"version":"a5126daa80a51b0c20932594da6356a29c8a82d165a45e5b0cb7461c6bffccc4","signature":"25590e9107aca23b20c7592bc56b3fe63509b5e6002eb030d6e440ce510e0b67","impliedFormat":99},{"version":"c6ee5b07d64ae47a1e535ed540c9cb968c21200aa96eb0ad505516b54397a806","signature":"204dbe91edc038846bce4ae3298102d3b7d94933265b3e074e608b43289e1933","impliedFormat":99},{"version":"e0771b67ad52580c15f79376b030036ee531c9393a83a6c37404d39264b82c43","signature":"25d2ff5bdda02cb89ea095dfc6824eebfa61801defd968171e0f9f800bd30cc6","impliedFormat":99},{"version":"d0a1f973c4406e2103075b48ca8152cc22667ca6694e4f3f3f376169cd2702c1","signature":"43e818adf60173644896298637f47b01d5819b17eda46eaa32d0c7d64724d012","impliedFormat":99},{"version":"309f3a357cc08760a602bd9b1177d4474426e6e2897a7295c898920198d968fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"ee31fab138939ef1903831933d524de9944511759778eedaaed56d6eb7f8697d","impliedFormat":1},{"version":"cdcf9ea426ad970f96ac930cd176d5c69c6c24eebd9fc580e1572d6c6a88f62c","impliedFormat":1},{"version":"23cd712e2ce083d68afe69224587438e5914b457b8acf87073c22494d706a3d0","impliedFormat":1},{"version":"487b694c3de27ddf4ad107d4007ad304d29effccf9800c8ae23c2093638d906a","impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0671b50bb99cc7ad46e9c68fa0e7f15ba4bc898b59c31a17ea4611fab5095da","affectsGlobalScope":true,"impliedFormat":1},{"version":"d802f0e6b5188646d307f070d83512e8eb94651858de8a82d1e47f60fb6da4e2","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4b4faedc57701ae727d78ba4a83e466a6e3bdcbe40efbf913b17e860642897c","affectsGlobalScope":true,"impliedFormat":1},{"version":"2424a70c49eed193731493c5fcaac6f0ddcc5a31326b9a93e5c31b501f42949d","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"72c1f5e0a28e473026074817561d1bc9647909cf253c8d56c41d1df8d95b85f7","impliedFormat":1},{"version":"59c893bb05d8d6da5c6b85b6670f459a66f93215246a92b6345e78796b86a9a7","affectsGlobalScope":true,"impliedFormat":1},{"version":"938f94db8400d0b479626b9006245a833d50ce8337f391085fad4af540279567","impliedFormat":1},{"version":"c4e8e8031808b158cfb5ac5c4b38d4a26659aec4b57b6a7e2ba0a141439c208c","impliedFormat":1},{"version":"2c91d8366ff2506296191c26fd97cc1990bab3ee22576275d28b654a21261a44","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"12fb9c13f24845000d7bd9660d11587e27ef967cbd64bd9df19ae3e6aa9b52d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"289e9894a4668c61b5ffed09e196c1f0c2f87ca81efcaebdf6357cfb198dac14","impliedFormat":1},{"version":"25a1105595236f09f5bce42398be9f9ededc8d538c258579ab662d509aa3b98e","impliedFormat":1},{"version":"9de8df30f620738193bd68ee503dc76e5f47fc426fe971cfbd89c109fd90b32e","impliedFormat":1},{"version":"e009777bef4b023a999b2e5b9a136ff2cde37dc3f77c744a02840f05b18be8ff","impliedFormat":1},{"version":"ad1cc0ed328f3f708771272021be61ab146b32ecf2b78f3224959ff1e2cd2a5c","impliedFormat":1},{"version":"71450bbc2d82821d24ca05699a533e72758964e9852062c53b30f31c36978ab8","affectsGlobalScope":true,"impliedFormat":1},{"version":"62f572306e0b173cc5dfc4c583471151f16ef3779cf27ab96922c92ec82a3bc8","affectsGlobalScope":true,"impliedFormat":1},{"version":"737c453548d197cd68e723e73d564d39f930c8183db4a9fa8f8f16f9c7ebd2cf","impliedFormat":1},{"version":"e64c11d651e1cba17954e0a6e1d7a3dcb5b3aa289ec0763177bf2ed05492c439","impliedFormat":1},{"version":"ecfb45485e692f3eb3d0aef6e460adeabf670cef2d07e361b2be20cecfd0046b","impliedFormat":1},{"version":"161f09445a8b4ba07f62ae54b27054e4234e7957062e34c6362300726dabd315","impliedFormat":1},{"version":"77fced47f495f4ff29bb49c52c605c5e73cd9b47d50080133783032769a9d8a6","impliedFormat":1},{"version":"e6057f9e7b0c64d4527afeeada89f313f96a53291705f069a9193c18880578cb","impliedFormat":1},{"version":"3cdbad1bb6929fd0220715d7da689c0b69df42c8239036ff75afe4f2232222ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"0f5cda0282e1d18198e2887387eb2f026372ebc4e11c4e4516fef8a19ee4d514","impliedFormat":1},{"version":"e99b0e71f07128fc32583e88ccd509a1aaa9524c290efb2f48c22f9bf8ba83b1","impliedFormat":1},{"version":"76957a6d92b94b9e2852cf527fea32ad2dc0ef50f67fe2b14bd027c9ceef2d86","impliedFormat":1},{"version":"237581f5ec4620a17e791d3bb79bad3af01e27a274dbee875ac9b0721a4fe97d","affectsGlobalScope":true,"impliedFormat":1},{"version":"a8a99a5e6ed33c4a951b67cc1fd5b64fd6ad719f5747845c165ca12f6c21ba16","affectsGlobalScope":true,"impliedFormat":1},{"version":"a58a15da4c5ba3df60c910a043281256fa52d36a0fcdef9b9100c646282e88dd","impliedFormat":1},{"version":"b36beffbf8acdc3ebc58c8bb4b75574b31a2169869c70fc03f82895b93950a12","impliedFormat":1},{"version":"de263f0089aefbfd73c89562fb7254a7468b1f33b61839aafc3f035d60766cb4","impliedFormat":1},{"version":"70b57b5529051497e9f6482b76d91c0dcbb103d9ead8a0549f5bab8f65e5d031","impliedFormat":1},{"version":"e6d81b1f7ab11dc1b1ad7ad29fcfad6904419b36baf55ed5e80df48d56ac3aff","impliedFormat":1},{"version":"1013eb2e2547ad8c100aca52ef9df8c3f209edee32bb387121bb3227f7c00088","impliedFormat":1},{"version":"b6b8e3736383a1d27e2592c484a940eeb37ec4808ba9e74dd57679b2453b5865","impliedFormat":1},{"version":"d6f36b683c59ac0d68a1d5ee906e578e2f5e9a285bca80ff95ce61cdc9ddcdeb","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093","impliedFormat":1},{"version":"27e4532aaaa1665d0dd19023321e4dc12a35a741d6b8e1ca3517fcc2544e0efe","affectsGlobalScope":true,"impliedFormat":1},{"version":"ea713aa14a670b1ea0fbaaca4fd204e645f71ca7653a834a8ec07ee889c45de6","impliedFormat":1},{"version":"cd9c0ecbe36a3be0775bfc16ae30b95af2a4a1f10e7949ceab284c98750bcebd","affectsGlobalScope":true,"impliedFormat":1},{"version":"2918b7c516051c30186a1055ebcdb3580522be7190f8a2fff4100ea714c7c366","affectsGlobalScope":true,"impliedFormat":1},{"version":"ae86f30d5d10e4f75ce8dcb6e1bd3a12ecec3d071a21e8f462c5c85c678efb41","impliedFormat":1},{"version":"982efeb2573605d4e6d5df4dc7e40846bda8b9e678e058fc99522ab6165c479e","impliedFormat":1},{"version":"e03460fe72b259f6d25ad029f085e4bedc3f90477da4401d8fbc1efa9793230e","impliedFormat":1},{"version":"4286a3a6619514fca656089aee160bb6f2e77f4dd53dc5a96b26a0b4fc778055","impliedFormat":1},{"version":"d67fc92a91171632fc74f413ce42ff1aa7fbcc5a85b127101f7ec446d2039a1f","affectsGlobalScope":true,"impliedFormat":1},{"version":"d40e4631100dbc067268bce96b07d7aff7f28a541b1bfb7ef791c64a696b3d33","affectsGlobalScope":true,"impliedFormat":1},{"version":"64bc5859f99559a3587c031ec6862c671f6fdd54e61d43d8ffd02a9422092677","impliedFormat":1},{"version":"42180b657831d1b8fead051698618b31da623fb71ff37f002cb9d932cfa775f1","impliedFormat":1},{"version":"4f98d6fb4fe7cbeaa04635c6eaa119d966285d4d39f0eb55b2654187b0b27446","impliedFormat":1},{"version":"e4c653466d0497d87fa9ffd00e59a95f33bc1c1722c3f5c84dab2e950c18da70","affectsGlobalScope":true,"impliedFormat":1},{"version":"e6dcc3b933e864e91d4bea94274ad69854d5d2a1311a4b0e20408a57af19e95d","impliedFormat":1},{"version":"a51f786b9f3c297668f8f322a6c58f85d84948ef69ade32069d5d63ec917221c","impliedFormat":1},{"version":"e525f9e67f5ddba7b5548430211cae2479070b70ef1fd93550c96c10529457bd","impliedFormat":1},{"version":"ccf4552357ce3c159ef75f0f0114e80401702228f1898bdc9402214c9499e8c0","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"17fe9131bec653b07b0a1a8b99a830216e3e43fe0ea2605be318dc31777c8bbf","impliedFormat":1},{"version":"3c8e93af4d6ce21eb4c8d005ad6dc02e7b5e6781f429d52a35290210f495a674","impliedFormat":1},{"version":"2c9875466123715464539bfd69bcaccb8ff6f3e217809428e0d7bd6323416d01","impliedFormat":1},{"version":"ea6bc8de8b59f90a7a3960005fd01988f98fd0784e14bc6922dde2e93305ec7d","impliedFormat":1},{"version":"36107995674b29284a115e21a0618c4c2751b32a8766dd4cb3ba740308b16d59","impliedFormat":1},{"version":"914a0ae30d96d71915fc519ccb4efbf2b62c0ddfb3a3fc6129151076bc01dc60","impliedFormat":1},{"version":"2472ef4c28971272a897fdb85d4155df022e1f5d9a474a526b8fc2ef598af94e","impliedFormat":1},{"version":"6c8e442ba33b07892169a14f7757321e49ab0f1032d676d321a1fdab8a67d40c","impliedFormat":1},{"version":"b41767d372275c154c7ea6c9d5449d9a741b8ce080f640155cc88ba1763e35b3","impliedFormat":1},{"version":"1cd673d367293fc5cb31cd7bf03d598eb368e4f31f39cf2b908abbaf120ab85a","impliedFormat":1},{"version":"19851a6596401ca52d42117108d35e87230fc21593df5c4d3da7108526b6111c","impliedFormat":1},{"version":"3825bf209f1662dfd039010a27747b73d0ef379f79970b1d05601ec8e8a4249f","impliedFormat":1},{"version":"0b6e25234b4eec6ed96ab138d96eb70b135690d7dd01f3dd8a8ab291c35a683a","impliedFormat":1},{"version":"40bfc70953be2617dc71979c14e9e99c5e65c940a4f1c9759ddb90b0f8ff6b1a","impliedFormat":1},{"version":"da52342062e70c77213e45107921100ba9f9b3a30dd019444cf349e5fb3470c4","impliedFormat":1},{"version":"e9ace91946385d29192766bf783b8460c7dbcbfc63284aa3c9cae6de5155c8bc","impliedFormat":1},{"version":"40b463c6766ca1b689bfcc46d26b5e295954f32ad43e37ee6953c0a677e4ae2b","impliedFormat":1},{"version":"561c60d8bfe0fec2c08827d09ff039eca0c1f9b50ef231025e5a549655ed0298","impliedFormat":1},{"version":"1e30c045732e7db8f7a82cf90b516ebe693d2f499ce2250a977ec0d12e44a529","impliedFormat":1},{"version":"84b736594d8760f43400202859cda55607663090a43445a078963031d47e25e7","impliedFormat":1},{"version":"499e5b055a5aba1e1998f7311a6c441a369831c70905cc565ceac93c28083d53","impliedFormat":1},{"version":"54c3e2371e3d016469ad959697fd257e5621e16296fa67082c2575d0bf8eced0","impliedFormat":1},{"version":"beb8233b2c220cfa0feea31fbe9218d89fa02faa81ef744be8dce5acb89bb1fd","impliedFormat":1},{"version":"78b29846349d4dfdd88bd6650cc5d2baaa67f2e89dc8a80c8e26ef7995386583","impliedFormat":1},{"version":"5d0375ca7310efb77e3ef18d068d53784faf62705e0ad04569597ae0e755c401","impliedFormat":1},{"version":"59af37caec41ecf7b2e76059c9672a49e682c1a2aa6f9d7dc78878f53aa284d6","impliedFormat":1},{"version":"addf417b9eb3f938fddf8d81e96393a165e4be0d4a8b6402292f9c634b1cb00d","impliedFormat":1},{"version":"e38d4fdf79e1eadd92ed7844c331dbaa40f29f21541cfee4e1acff4db09cda33","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"7c10a32ae6f3962672e6869ee2c794e8055d8225ef35c91c0228e354b4e5d2d3","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"99f569b42ea7e7c5fe404b2848c0893f3e1a56e0547c1cd0f74d5dbb9a9de27e","impliedFormat":1},{"version":"e45cc72cc9e7ad726ec83141fa4cd221d432062de34586ff107a0442ae28bf19","impliedFormat":1},{"version":"1f9f1685e6bbb5120a4f7587c33c066e833aaa144c6c324daa0839ff1b9c2467","impliedFormat":1},{"version":"3083591fd0a77addd337b02f9fcf0d4f009e41c79fa42f862d6fcf76f3fceb48","impliedFormat":1},{"version":"34810cb47e6bee7cd4bad2f174793f5926ba5889c5d180e29b02c1871a820476","affectsGlobalScope":true,"impliedFormat":1},{"version":"7115f1157a00937d712e042a011eb85e9d80b13eff78bac5f210ee852f96879d","impliedFormat":1},{"version":"0ac74c7586880e26b6a599c710b59284a284e084a2bbc82cd40fb3fbfdea71ae","affectsGlobalScope":true,"impliedFormat":1},{"version":"2ce12357dadbb8efc4e4ec4dab709c8071bf992722fc9adfea2fe0bd5b50923f","impliedFormat":1},{"version":"d021d871089c519030a098fa3d32f5d95059b699b0fc6c45c85a96f92cae233c","impliedFormat":1},{"version":"a21a5564fa4fc44ea813ce3055030b0060df12acca6a183d77b2090429be618a","impliedFormat":1},{"version":"b05b9ef20d18697e468c3ae9cecfff3f47e8976f9522d067047e3f236db06a41","affectsGlobalScope":true,"impliedFormat":1},{"version":"eec5e9a5629f6740aac21e49783a373a3767770ad559cd41285ebbb0db39a4a2","affectsGlobalScope":true,"impliedFormat":1},{"version":"1745f0b1ab53f414b4f8ebb2c6a902fda28d40f454edac8e92b4d7c974a2051c","affectsGlobalScope":true,"impliedFormat":1},{"version":"d11d2c2c666882bb2f8206cbde115ae9687002d0b08df4e4f46e4b7ca7c0af4e","impliedFormat":1},{"version":"1a7a729938558fe198d979d3f53dece9c9112124b7b081a7fa0adcc98bf15fd8","impliedFormat":1},{"version":"067f76ab5254b1bdfc94154730b7a30c12e3aad8b9d04ec62c0d6b7a1f40ea0e","affectsGlobalScope":true,"impliedFormat":1},{"version":"f67f24b0d972d7d0f52a4e2f4f8ffd5cd786cb411044693026731918df935371","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be812b06e518320ba82e2aff3ac2ca37370a9df917db708f081b9043fa3315","impliedFormat":1}],"root":[[60,64]],"options":{"allowJs":true,"checkJs":true,"composite":true,"declaration":true,"declarationDir":"./types","declarationMap":true,"esModuleInterop":true,"module":199,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitOverride":true,"noImplicitReturns":true,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./output","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9,"tsBuildInfoFile":"./tsbuildinfo.json","verbatimModuleSyntax":true},"referencedMap":[[180,1],[74,2],[75,2],[76,3],[72,4],[77,5],[78,6],[79,7],[70,8],[80,9],[81,10],[82,11],[83,12],[84,13],[85,14],[86,14],[88,8],[87,15],[89,16],[90,17],[91,18],[73,19],[71,8],[92,20],[93,21],[94,22],[127,23],[95,24],[96,25],[97,26],[98,27],[99,28],[100,29],[101,30],[102,31],[103,32],[104,33],[105,33],[106,34],[107,8],[108,8],[109,35],[111,36],[110,37],[112,38],[113,39],[114,40],[115,41],[116,42],[117,43],[118,44],[119,45],[120,46],[121,47],[122,48],[123,49],[124,50],[125,51],[126,52],[165,53],[178,8],[175,54],[167,55],[166,8],[164,56],[168,8],[65,57],[169,8],[179,58],[170,8],[174,59],[176,60],[66,61],[177,62],[171,8],[172,8],[173,63],[58,8],[59,8],[11,8],[10,8],[2,8],[12,8],[13,8],[14,8],[15,8],[16,8],[17,8],[18,8],[19,8],[3,8],[20,8],[21,8],[4,8],[22,8],[26,8],[23,8],[24,8],[25,8],[27,8],[28,8],[29,8],[5,8],[30,8],[31,8],[32,8],[33,8],[6,8],[37,8],[34,8],[35,8],[36,8],[38,8],[7,8],[39,8],[44,8],[45,8],[40,8],[41,8],[42,8],[43,8],[8,8],[49,8],[46,8],[47,8],[48,8],[50,8],[9,8],[51,8],[52,8],[53,8],[55,8],[54,8],[1,8],[56,8],[57,8],[141,64],[152,65],[139,64],[153,66],[162,67],[131,68],[130,69],[161,70],[156,71],[160,72],[133,73],[149,74],[132,75],[159,76],[128,77],[129,71],[134,78],[135,8],[140,68],[138,78],[68,79],[163,80],[154,81],[144,82],[143,78],[145,83],[147,84],[142,85],[146,86],[157,70],[136,87],[137,88],[148,89],[69,66],[151,90],[150,78],[155,8],[67,8],[158,91],[62,92],[60,8],[61,93],[63,92],[64,92]],"latestChangedDtsFile":"./types/with-env.bin.d.ts","version":"5.8.3"}
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Example usage of the with-coolify-env package
4
+ *
5
+ * This file demonstrates how to use the package both as a library
6
+ * and shows the expected behavior in different scenarios.
7
+ */
8
+ /**
9
+ * Example 1: Basic usage with environment variables
10
+ *
11
+ * This example assumes you have set the following environment variables:
12
+ * - COOLIFY_ENDPOINT
13
+ * - COOLIFY_APP_ID
14
+ * - COOLIFY_TOKEN
15
+ */
16
+ declare function basicExample(): Promise<void>;
17
+ /**
18
+ * Example 2: Explicit configuration
19
+ */
20
+ declare function explicitConfigExample(): Promise<void>;
21
+ /**
22
+ * Example 3: Production environment handling
23
+ */
24
+ declare function productionExample(): Promise<void>;
25
+ /**
26
+ * Example 4: Force loading in production
27
+ */
28
+ declare function forceProductionExample(): Promise<void>;
29
+ /**
30
+ * Example 5: Error handling demonstration
31
+ */
32
+ declare function errorHandlingExample(): Promise<void>;
33
+ /**
34
+ * Main function to run all examples
35
+ */
36
+ declare function runExamples(): Promise<void>;
37
+ export { basicExample, explicitConfigExample, productionExample, forceProductionExample, errorHandlingExample, runExamples, };
38
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../example.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAIH;;;;;;;GAOG;AACH,iBAAe,YAAY,kBAc1B;AAED;;GAEG;AACH,iBAAe,qBAAqB,kBAmBnC;AAED;;GAEG;AACH,iBAAe,iBAAiB,kBAqB/B;AAED;;GAEG;AACH,iBAAe,sBAAsB,kBAsBpC;AAED;;GAEG;AACH,iBAAe,oBAAoB,kBAYlC;AAED;;GAEG;AACH,iBAAe,WAAW,kBAUzB;AAOD,OAAO,EACN,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,GACX,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Represents an environment variable from Coolify
3
+ */
4
+ export interface CoolifyEnv {
5
+ /** The environment variable key/name */
6
+ key: string;
7
+ /** The environment variable value */
8
+ value: string;
9
+ }
10
+ /**
11
+ * Fetches environment variables from a Coolify instance
12
+ *
13
+ * This function makes an authenticated API request to Coolify to retrieve
14
+ * environment variables for a specific application. The response is expected
15
+ * to be a JSON array of objects with `key` and `value` properties.
16
+ *
17
+ * @param endpoint - The Coolify API endpoint URL (e.g., "https://coolify.example.com")
18
+ * @param appId - The Coolify application ID to fetch environment variables for
19
+ * @param token - The Coolify API token for authentication
20
+ * @returns A promise that resolves to an array of environment variables
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const envs = await fetchCoolifyEnvs(
25
+ * "https://coolify.example.com",
26
+ * "my-app-id",
27
+ * "my-api-token"
28
+ * );
29
+ *
30
+ * for (const env of envs) {
31
+ * console.log(`${env.key}=${env.value}`);
32
+ * }
33
+ * ```
34
+ *
35
+ * @throws {Error} When required parameters (endpoint, appId, token) are missing
36
+ * @throws {Error} When the API request fails or returns a non-OK status
37
+ * @throws {Error} When the response cannot be parsed as JSON
38
+ */
39
+ export declare function fetchCoolifyEnvs(endpoint: string | undefined, appId: string | undefined, token: string | undefined): Promise<CoolifyEnv[]>;
40
+ //# sourceMappingURL=fetch-coolify-env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-coolify-env.d.ts","sourceRoot":"","sources":["../../fetch-coolify-env.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,gBAAgB,CACrC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,EAAE,MAAM,GAAG,SAAS,GACvB,OAAO,CAAC,UAAU,EAAE,CAAC,CAsFvB"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Configuration options for the Coolify environment loader
3
+ */
4
+ export interface WithCoolifyEnvConfig {
5
+ /** The Coolify API endpoint URL (e.g., "https://coolify.example.com") */
6
+ endpoint?: string;
7
+ /** The Coolify application ID to fetch environment variables for */
8
+ appId?: string;
9
+ /** The Coolify API token for authentication */
10
+ token?: string;
11
+ /** Whether to skip loading environment variables in production (default: true) */
12
+ skipInProduction?: boolean;
13
+ /** Whether to inherit stdio from the parent process (default: true) */
14
+ inheritStdio?: boolean;
15
+ /** The command to execute after loading environment variables */
16
+ command?: string;
17
+ /** Arguments to pass to the command */
18
+ args?: string[];
19
+ }
20
+ /**
21
+ * Loads environment variables from Coolify and executes a command with those variables
22
+ *
23
+ * This function fetches environment variables from a Coolify instance using the provided
24
+ * credentials, loads them into the current process environment, and then spawns a child
25
+ * process with the specified command and arguments.
26
+ *
27
+ * @param config - Configuration options for loading environment variables and executing the command
28
+ * @returns A promise that resolves when the child process exits successfully, or rejects with an error
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * // Basic usage with environment variables
33
+ * await loadEnv({
34
+ * command: "npm",
35
+ * args: ["start"]
36
+ * });
37
+ *
38
+ * // Explicit configuration
39
+ * await loadEnv({
40
+ * endpoint: "https://coolify.example.com",
41
+ * appId: "my-app-id",
42
+ * token: "my-token",
43
+ * command: "node",
44
+ * args: ["server.js"]
45
+ * });
46
+ *
47
+ * // Skip production check
48
+ * await loadEnv({
49
+ * skipInProduction: false,
50
+ * command: "npm",
51
+ * args: ["run", "build"]
52
+ * });
53
+ * ```
54
+ *
55
+ * @throws {Error} When no command is provided
56
+ * @throws {Error} When the child process fails to execute or exits with a non-zero code
57
+ * @throws {Error} When Coolify API requests fail
58
+ */
59
+ export declare function loadEnv(config?: WithCoolifyEnvConfig): Promise<void>;
60
+ //# sourceMappingURL=index.pub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.pub.d.ts","sourceRoot":"","sources":["../../index.pub.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,uEAAuE;IACvE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAsB,OAAO,CAC5B,MAAM,GAAE,oBAAyB,GAC/B,OAAO,CAAC,IAAI,CAAC,CA6Ef"}
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Basic test for the with-coolify-env package
4
+ *
5
+ * This test verifies that the package can be imported and used
6
+ * without actually making API calls to Coolify.
7
+ */
8
+ import { type WithCoolifyEnvConfig } from "./index.pub.js";
9
+ /**
10
+ * Test configuration validation
11
+ */
12
+ declare function testConfigValidation(): WithCoolifyEnvConfig;
13
+ /**
14
+ * Test error handling for missing command
15
+ */
16
+ declare function testMissingCommand(): Promise<boolean>;
17
+ /**
18
+ * Test that the package can be imported and basic functionality works
19
+ */
20
+ declare function testBasicFunctionality(): Promise<boolean>;
21
+ export { testConfigValidation, testMissingCommand, testBasicFunctionality };
22
+ //# sourceMappingURL=test-basic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-basic.d.ts","sourceRoot":"","sources":["../../test-basic.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAW,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEpE;;GAEG;AACH,iBAAS,oBAAoB,yBAc5B;AAED;;GAEG;AACH,iBAAe,kBAAkB,qBAkBhC;AAED;;GAEG;AACH,iBAAe,sBAAsB,qBAcpC;AAcD,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=with-env.bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with-env.bin.d.ts","sourceRoot":"","sources":["../../with-env.bin.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@cjkihl/with-coolify-env",
3
+ "version": "1.0.0",
4
+ "description": "Load environment variables from Coolify and execute commands with those variables",
5
+ "keywords": [
6
+ "coolify",
7
+ "environment",
8
+ "variables",
9
+ "api",
10
+ "cli",
11
+ "deployment",
12
+ "configuration",
13
+ "env"
14
+ ],
15
+ "homepage": "https://github.com/cjkihl/cjkihl#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/cjkihl/cjkihl/issues"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/cjkihl/cjkihl.git"
22
+ },
23
+ "funding": {
24
+ "type": "github",
25
+ "url": "https://github.com/sponsors/cjkihl"
26
+ },
27
+ "license": "MIT",
28
+ "author": "@cjkihl",
29
+ "type": "module",
30
+ "exports": {
31
+ ".": {
32
+ "default": "./dist/output/index.pub.js",
33
+ "types": "./dist/types/index.pub.d.ts"
34
+ }
35
+ },
36
+ "bin": {
37
+ "with-env": "./dist/output/with-env.bin.js"
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "README.md"
42
+ ],
43
+ "scripts": {
44
+ "build": "tsc && bun ../create-exports/create-exports.bin.ts"
45
+ },
46
+ "dependencies": {
47
+ "@cjkihl/find-root": "1.0.0",
48
+ "dotenv": "^16.5.0"
49
+ },
50
+ "engines": {
51
+ "node": ">=18.0.0"
52
+ },
53
+ "publishConfig": {
54
+ "access": "public"
55
+ }
56
+ }