@base44-preview/cli 0.0.44-pr.419.4194a5c → 0.0.45-pr.357.604c676
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 +1 -5
- package/dist/assets/deno-runtime/main.ts +72 -0
- package/dist/cli/index.js +196 -74
- package/dist/cli/index.js.map +8 -6
- package/dist/deno-runtime/exec.ts +55 -0
- package/package.json +2 -1
- package/dist/assets/deno-runtime/main.js +0 -31
- package/dist/assets/deno-runtime/main.js.map +0 -10
package/README.md
CHANGED
|
@@ -53,14 +53,10 @@ The CLI will guide you through project setup. For step-by-step tutorials, see th
|
|
|
53
53
|
| [`whoami`](https://docs.base44.com/developers/references/cli/commands/whoami) | Display the current authenticated user |
|
|
54
54
|
| [`agents pull`](https://docs.base44.com/developers/references/cli/commands/agents-pull) | Pull agents from Base44 to local files |
|
|
55
55
|
| [`agents push`](https://docs.base44.com/developers/references/cli/commands/agents-push) | Push local agents to Base44 |
|
|
56
|
-
| [`connectors list-available`](https://docs.base44.com/developers/references/cli/commands/connectors-list-available) | List all available integration types |
|
|
57
56
|
| [`connectors pull`](https://docs.base44.com/developers/references/cli/commands/connectors-pull) | Pull connectors from Base44 to local files |
|
|
58
57
|
| [`connectors push`](https://docs.base44.com/developers/references/cli/commands/connectors-push) | Push local connectors to Base44 |
|
|
59
58
|
| [`entities push`](https://docs.base44.com/developers/references/cli/commands/entities-push) | Push local entities to Base44 |
|
|
60
|
-
| `functions
|
|
61
|
-
| [`functions deploy`](https://docs.base44.com/developers/references/cli/commands/functions-deploy) | Deploy functions to Base44 |
|
|
62
|
-
| `functions list` | List all deployed functions |
|
|
63
|
-
| `functions pull` | Pull deployed functions from Base44 |
|
|
59
|
+
| [`functions deploy`](https://docs.base44.com/developers/references/cli/commands/functions-deploy) | Deploy local functions to Base44 |
|
|
64
60
|
| [`secrets list`](https://docs.base44.com/developers/references/cli/commands/secrets-list) | List project secret names |
|
|
65
61
|
| [`secrets set`](https://docs.base44.com/developers/references/cli/commands/secrets-set) | Set one or more project secrets |
|
|
66
62
|
| [`secrets delete`](https://docs.base44.com/developers/references/cli/commands/secrets-delete) | Delete a project secret |
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deno Function Wrapper
|
|
3
|
+
*
|
|
4
|
+
* This script is executed by Deno to run user functions.
|
|
5
|
+
* It patches Deno.serve to inject a dynamic port before importing the user's function.
|
|
6
|
+
*
|
|
7
|
+
* Environment variables:
|
|
8
|
+
* - FUNCTION_PATH: Absolute path to the user's function entry file
|
|
9
|
+
* - FUNCTION_PORT: Port number for the function to listen on
|
|
10
|
+
* - FUNCTION_NAME: Name of the function (for logging)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Make this file a module for top-level await support
|
|
14
|
+
export {};
|
|
15
|
+
|
|
16
|
+
const functionPath = Deno.env.get("FUNCTION_PATH");
|
|
17
|
+
const port = parseInt(Deno.env.get("FUNCTION_PORT") || "8000", 10);
|
|
18
|
+
const functionName = Deno.env.get("FUNCTION_NAME") || "unknown";
|
|
19
|
+
|
|
20
|
+
if (!functionPath) {
|
|
21
|
+
console.error("[wrapper] FUNCTION_PATH environment variable is required");
|
|
22
|
+
Deno.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Store the original Deno.serve
|
|
26
|
+
const originalServe = Deno.serve.bind(Deno);
|
|
27
|
+
|
|
28
|
+
// Patch Deno.serve to inject our port and add onListen callback
|
|
29
|
+
// @ts-expect-error - We're intentionally overriding Deno.serve
|
|
30
|
+
Deno.serve = (
|
|
31
|
+
optionsOrHandler:
|
|
32
|
+
| Deno.ServeOptions
|
|
33
|
+
| Deno.ServeHandler
|
|
34
|
+
| (Deno.ServeOptions & { handler: Deno.ServeHandler }),
|
|
35
|
+
maybeHandler?: Deno.ServeHandler,
|
|
36
|
+
): Deno.HttpServer<Deno.NetAddr> => {
|
|
37
|
+
const onListen = () => {
|
|
38
|
+
// This message is used by FunctionManager to detect when the function is ready
|
|
39
|
+
console.log(`[${functionName}] Listening on http://localhost:${port}`);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Handle the different Deno.serve signatures:
|
|
43
|
+
// 1. Deno.serve(handler)
|
|
44
|
+
// 2. Deno.serve(options, handler)
|
|
45
|
+
// 3. Deno.serve({ ...options, handler })
|
|
46
|
+
if (typeof optionsOrHandler === "function") {
|
|
47
|
+
// Signature: Deno.serve(handler)
|
|
48
|
+
return originalServe({ port, onListen }, optionsOrHandler);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (maybeHandler) {
|
|
52
|
+
// Signature: Deno.serve(options, handler)
|
|
53
|
+
return originalServe({ ...optionsOrHandler, port, onListen }, maybeHandler);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Signature: Deno.serve({ ...options, handler })
|
|
57
|
+
const options = optionsOrHandler as Deno.ServeOptions & {
|
|
58
|
+
handler: Deno.ServeHandler;
|
|
59
|
+
};
|
|
60
|
+
return originalServe({ ...options, port, onListen });
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
console.log(`[${functionName}] Starting function from ${functionPath}`);
|
|
64
|
+
|
|
65
|
+
// Dynamically import the user's function
|
|
66
|
+
// The function will call Deno.serve which is now patched to use our port
|
|
67
|
+
try {
|
|
68
|
+
await import(functionPath);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error(`[${functionName}] Failed to load function:`, error);
|
|
71
|
+
Deno.exit(1);
|
|
72
|
+
}
|