@base44-preview/cli 0.0.45-pr.357.80ca1b5 → 0.0.45-pr.357.b936fac
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/dist/assets/deno-runtime/exec.ts +55 -0
- package/dist/cli/index.js +1682 -1593
- package/dist/cli/index.js.map +58 -56
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deno Exec Wrapper
|
|
3
|
+
*
|
|
4
|
+
* This script is executed by Deno to run user scripts with the Base44 SDK
|
|
5
|
+
* pre-authenticated and available as a global `base44` variable.
|
|
6
|
+
*
|
|
7
|
+
* Environment variables:
|
|
8
|
+
* - SCRIPT_PATH: Absolute path (or file:// URL) to the user's script
|
|
9
|
+
* - BASE44_APP_ID: App identifier from .app.jsonc
|
|
10
|
+
* - BASE44_ACCESS_TOKEN: User's access token
|
|
11
|
+
* - BASE44_APP_BASE_URL: App's published URL / subdomain (used for function calls)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export {};
|
|
15
|
+
|
|
16
|
+
const scriptPath = Deno.env.get("SCRIPT_PATH");
|
|
17
|
+
const appId = Deno.env.get("BASE44_APP_ID");
|
|
18
|
+
const accessToken = Deno.env.get("BASE44_ACCESS_TOKEN");
|
|
19
|
+
const appBaseUrl = Deno.env.get("BASE44_APP_BASE_URL");
|
|
20
|
+
|
|
21
|
+
if (!scriptPath) {
|
|
22
|
+
console.error("SCRIPT_PATH environment variable is required");
|
|
23
|
+
Deno.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!appId || !accessToken) {
|
|
27
|
+
console.error("BASE44_APP_ID and BASE44_ACCESS_TOKEN are required");
|
|
28
|
+
Deno.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!appBaseUrl) {
|
|
32
|
+
console.error("BASE44_APP_BASE_URL environment variable is required");
|
|
33
|
+
Deno.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
import { createClient } from "npm:@base44/sdk";
|
|
37
|
+
|
|
38
|
+
const base44 = createClient({
|
|
39
|
+
appId,
|
|
40
|
+
token: accessToken,
|
|
41
|
+
serverUrl: appBaseUrl,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
(globalThis as any).base44 = base44;
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
await import(scriptPath);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error("Failed to execute script:", error);
|
|
50
|
+
Deno.exit(1);
|
|
51
|
+
} finally {
|
|
52
|
+
// Clean up the SDK client (clears analytics heartbeat interval,
|
|
53
|
+
// disconnects socket) so the process can exit naturally.
|
|
54
|
+
base44.cleanup();
|
|
55
|
+
}
|