@base44-preview/cli 0.1.5-pr.570.f3b8004 → 0.1.5-pr.571.4d6a59e

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.
@@ -9,8 +9,6 @@
9
9
  * - BASE44_APP_ID: App identifier from .app.jsonc
10
10
  * - BASE44_ACCESS_TOKEN: User's access token
11
11
  * - BASE44_APP_BASE_URL: App's published URL / subdomain (used for function calls)
12
- * - BASE44_PRIVILEGED: When "true", adds the X-Bypass-RLS header (bypass RLS)
13
- * - BASE44_DATA_ENV: When set, adds the X-Data-Env header (target data environment)
14
12
  */
15
13
 
16
14
  export {};
@@ -19,8 +17,6 @@ const scriptPath = Deno.env.get("SCRIPT_PATH");
19
17
  const appId = Deno.env.get("BASE44_APP_ID");
20
18
  const accessToken = Deno.env.get("BASE44_ACCESS_TOKEN");
21
19
  const appBaseUrl = Deno.env.get("BASE44_APP_BASE_URL");
22
- const isPrivileged = Deno.env.get("BASE44_PRIVILEGED") === "true";
23
- const dataEnv = Deno.env.get("BASE44_DATA_ENV");
24
20
 
25
21
  if (!scriptPath) {
26
22
  console.error("SCRIPT_PATH environment variable is required");
@@ -39,20 +35,10 @@ if (!appBaseUrl) {
39
35
 
40
36
  import { createClient } from "npm:@base44/sdk";
41
37
 
42
- const customHeaders: Record<string, string> = {};
43
- if (isPrivileged) customHeaders["X-Bypass-RLS"] = "true";
44
- // QUESTION(@netanelgilad): backend get_data_environment_from_request honors only
45
- // "dev" and "prod" on X-Data-Env ("share" is host-derived, unknown values fall
46
- // through to prod). It applies to entity CRUD, but for backend-function invocations
47
- // a caller-supplied "dev" is dropped by trusted_request_data_env (prod/no-signal
48
- // pass through). Intended scope for --data-env?
49
- if (dataEnv) customHeaders["X-Data-Env"] = dataEnv;
50
-
51
38
  const base44 = createClient({
52
39
  appId,
53
40
  token: accessToken,
54
41
  serverUrl: appBaseUrl,
55
- headers: customHeaders,
56
42
  });
57
43
 
58
44
  (globalThis as any).base44 = base44;
@@ -2,4 +2,8 @@ import { createClient } from '@base44/sdk';
2
2
 
3
3
  export const base44 = createClient({
4
4
  appId: '<%= projectId %>',
5
+ // `base44 dev` injects VITE_BASE44_APP_BASE_URL (http://localhost:<port>) so the
6
+ // SDK targets the local dev backend; unset in prod builds, so it falls back to
7
+ // the SDK's default server.
8
+ serverUrl: import.meta.env.VITE_BASE44_APP_BASE_URL || undefined,
5
9
  });
package/dist/cli/index.js CHANGED
@@ -258458,7 +258458,7 @@ function getDevCommand() {
258458
258458
  import { spawn as spawn4 } from "node:child_process";
258459
258459
  import { copyFileSync, writeFileSync as writeFileSync2 } from "node:fs";
258460
258460
  async function runScript(options8) {
258461
- const { appId, code: code2, local, privileged, dataEnv } = options8;
258461
+ const { appId, code: code2, local } = options8;
258462
258462
  verifyDenoInstalled("to run scripts with exec");
258463
258463
  const cleanupFns = [];
258464
258464
  const tempScript = await $file({ postfix: ".ts" });
@@ -258477,9 +258477,7 @@ async function runScript(options8) {
258477
258477
  SCRIPT_PATH: scriptPath,
258478
258478
  BASE44_APP_ID: appId,
258479
258479
  BASE44_ACCESS_TOKEN: appUserToken,
258480
- BASE44_APP_BASE_URL: appBaseUrl,
258481
- ...privileged ? { BASE44_PRIVILEGED: "true" } : {},
258482
- ...dataEnv ? { BASE44_DATA_ENV: dataEnv } : {}
258480
+ BASE44_APP_BASE_URL: appBaseUrl
258483
258481
  },
258484
258482
  stdio: "inherit"
258485
258483
  });
@@ -258544,20 +258542,14 @@ async function execAction({ app, isNonInteractive }, options8) {
258544
258542
  throw noInputError;
258545
258543
  }
258546
258544
  const local = options8.local ? await resolveLocalTarget(options8.port !== undefined ? parsePort(options8.port) : DEFAULT_DEV_SERVER_PORT) : undefined;
258547
- const { exitCode } = await runScript({
258548
- appId: app.id,
258549
- code: code2,
258550
- local,
258551
- privileged: options8.privileged,
258552
- dataEnv: options8.dataEnv
258553
- });
258545
+ const { exitCode } = await runScript({ appId: app.id, code: code2, local });
258554
258546
  if (exitCode !== 0) {
258555
258547
  process.exitCode = exitCode;
258556
258548
  }
258557
258549
  return {};
258558
258550
  }
258559
258551
  function getExecCommand() {
258560
- return new Base44Command("exec").description("Run a script with the Base44 SDK pre-authenticated as the current user").option("--local", "Run against the local `base44 dev` server instead of the deployed app").option("--port <number>", `Port the local dev server is on (with --local; defaults to ${DEFAULT_DEV_SERVER_PORT})`).option("--privileged", "Run with admin privileges (bypass RLS). Requires app owner/editor role.").option("--data-env <environment>", "Data environment to run against (e.g. dev, prod)").addHelpText("after", `
258552
+ return new Base44Command("exec").description("Run a script with the Base44 SDK pre-authenticated as the current user").option("--local", "Run against the local `base44 dev` server instead of the deployed app").option("--port <number>", `Port the local dev server is on (with --local; defaults to ${DEFAULT_DEV_SERVER_PORT})`).addHelpText("after", `
258561
258553
  Examples:
258562
258554
  Run a script file:
258563
258555
  $ cat ./script.ts | base44 exec
@@ -258566,10 +258558,7 @@ Examples:
258566
258558
  $ echo "const users = await base44.entities.User.list()" | base44 exec
258567
258559
 
258568
258560
  Against the local dev server (base44 dev must be running):
258569
- $ echo "await base44.entities.Task.create({ title: 'seed' })" | base44 exec --local
258570
-
258571
- With privileged access (bypass RLS):
258572
- $ echo "const all = await base44.entities.Task.list()" | base44 exec --privileged`).action(execAction);
258561
+ $ echo "await base44.entities.Task.create({ title: 'seed' })" | base44 exec --local`).action(execAction);
258573
258562
  }
258574
258563
 
258575
258564
  // src/cli/commands/project/eject.ts
@@ -262963,4 +262952,4 @@ export {
262963
262952
  CLIExitError
262964
262953
  };
262965
262954
 
262966
- //# debugId=6F90C592BC20AEC764756E2164756E21
262955
+ //# debugId=8BDA6B1F446714F764756E2164756E21