@base44-preview/cli 0.0.45-pr.357.45a44b4 → 0.0.45-pr.357.7d7d528

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/cli/index.js CHANGED
@@ -239630,6 +239630,20 @@ async function uploadSite(archivePath) {
239630
239630
  }
239631
239631
  return result.data;
239632
239632
  }
239633
+ async function getSiteUrl(projectId) {
239634
+ const id = projectId ?? getAppConfig().id;
239635
+ let response;
239636
+ try {
239637
+ response = await base44Client.get(`api/apps/platform/${id}/published-url`);
239638
+ } catch (error48) {
239639
+ throw await ApiError.fromHttpError(error48, "fetching site URL");
239640
+ }
239641
+ const result = PublishedUrlResponseSchema.safeParse(await response.json());
239642
+ if (!result.success) {
239643
+ throw new SchemaValidationError("Invalid response from server", result.error);
239644
+ }
239645
+ return result.data.url;
239646
+ }
239633
239647
  // src/core/site/config.ts
239634
239648
  async function getSiteFilePaths(outputDir) {
239635
239649
  return await globby("**/*", {
@@ -246810,29 +246824,6 @@ async function deleteSecret(name2) {
246810
246824
  }
246811
246825
  return result.data;
246812
246826
  }
246813
- // src/core/utils/app-info.ts
246814
- async function getAppUserToken() {
246815
- try {
246816
- const response = await getAppClient().get("auth/token").json();
246817
- return response.token;
246818
- } catch (error48) {
246819
- throw await ApiError.fromHttpError(error48, "exchanging platform token for app user token");
246820
- }
246821
- }
246822
- async function getSiteUrl(projectId) {
246823
- const id = projectId ?? getAppConfig().id;
246824
- let response;
246825
- try {
246826
- response = await base44Client.get(`api/apps/platform/${id}/published-url`);
246827
- } catch (error48) {
246828
- throw await ApiError.fromHttpError(error48, "fetching site URL");
246829
- }
246830
- const result = PublishedUrlResponseSchema.safeParse(await response.json());
246831
- if (!result.success) {
246832
- throw new SchemaValidationError("Invalid response from server", result.error);
246833
- }
246834
- return result.data.url;
246835
- }
246836
246827
  // src/core/utils/dependencies.ts
246837
246828
  import { spawnSync as spawnSync2 } from "node:child_process";
246838
246829
  function verifyDenoInstalled(context) {
@@ -251702,17 +251693,33 @@ function getDevCommand() {
251702
251693
  // src/core/exec/run-script.ts
251703
251694
  import { spawn as spawn3 } from "node:child_process";
251704
251695
  import { copyFileSync, writeFileSync as writeFileSync2 } from "node:fs";
251696
+ import { resolve as resolve8 } from "node:path";
251697
+ async function getUserAppToken() {
251698
+ try {
251699
+ const response = await getAppClient().get("auth/token").json();
251700
+ return response.token;
251701
+ } catch (error48) {
251702
+ throw await ApiError.fromHttpError(error48, "exchanging platform token for app user token");
251703
+ }
251704
+ }
251705
251705
  async function runScript(options8) {
251706
- const { code: code2 } = options8;
251706
+ const { filePath, code: code2 } = options8;
251707
251707
  verifyDenoInstalled("to run scripts with exec");
251708
251708
  const cleanupFns = [];
251709
- const tempScript = await $file({ postfix: ".ts" });
251710
- cleanupFns.push(tempScript.cleanup);
251711
- writeFileSync2(tempScript.path, code2, "utf-8");
251712
- const scriptPath = `file://${tempScript.path}`;
251709
+ let scriptPath;
251710
+ if (filePath) {
251711
+ scriptPath = `file://${resolve8(filePath)}`;
251712
+ } else if (code2 !== undefined) {
251713
+ const tempScript = await $file({ postfix: ".ts" });
251714
+ cleanupFns.push(tempScript.cleanup);
251715
+ writeFileSync2(tempScript.path, code2, "utf-8");
251716
+ scriptPath = `file://${tempScript.path}`;
251717
+ } else {
251718
+ throw new Error("Either filePath or code must be provided");
251719
+ }
251713
251720
  const appConfig = getAppConfig();
251714
251721
  const [appUserToken, appBaseUrl] = await Promise.all([
251715
- getAppUserToken(),
251722
+ getUserAppToken(),
251716
251723
  getSiteUrl()
251717
251724
  ]);
251718
251725
  const tempWrapper = await $file({ postfix: ".ts" });
@@ -251748,13 +251755,13 @@ async function runScript(options8) {
251748
251755
  }
251749
251756
  // src/cli/commands/exec.ts
251750
251757
  function readStdin() {
251751
- return new Promise((resolve8, reject) => {
251758
+ return new Promise((resolve9, reject) => {
251752
251759
  let data = "";
251753
251760
  process.stdin.setEncoding("utf-8");
251754
251761
  process.stdin.on("data", (chunk) => {
251755
251762
  data += chunk;
251756
251763
  });
251757
- process.stdin.on("end", () => resolve8(data));
251764
+ process.stdin.on("end", () => resolve9(data));
251758
251765
  process.stdin.on("error", reject);
251759
251766
  });
251760
251767
  }
@@ -251783,7 +251790,7 @@ function getExecCommand() {
251783
251790
  }
251784
251791
 
251785
251792
  // src/cli/commands/project/eject.ts
251786
- import { resolve as resolve8 } from "node:path";
251793
+ import { resolve as resolve9 } from "node:path";
251787
251794
  var import_kebabCase2 = __toESM(require_kebabCase(), 1);
251788
251795
  async function eject(options8) {
251789
251796
  const projects = await listProjects();
@@ -251832,7 +251839,7 @@ async function eject(options8) {
251832
251839
  Ne("Operation cancelled.");
251833
251840
  throw new CLIExitError(0);
251834
251841
  }
251835
- const resolvedPath = resolve8(selectedPath);
251842
+ const resolvedPath = resolve9(selectedPath);
251836
251843
  await runTask("Downloading your project's code...", async (updateMessage) => {
251837
251844
  await createProjectFilesForExistingProject({
251838
251845
  projectId,
@@ -254210,14 +254217,14 @@ async function addSourceContext(frames) {
254210
254217
  return frames;
254211
254218
  }
254212
254219
  function getContextLinesFromFile(path19, ranges, output) {
254213
- return new Promise((resolve9) => {
254220
+ return new Promise((resolve10) => {
254214
254221
  const stream = createReadStream2(path19);
254215
254222
  const lineReaded = createInterface2({
254216
254223
  input: stream
254217
254224
  });
254218
254225
  function destroyStreamAndResolve() {
254219
254226
  stream.destroy();
254220
- resolve9();
254227
+ resolve10();
254221
254228
  }
254222
254229
  let lineNumber = 0;
254223
254230
  let currentRangeIndex = 0;
@@ -255329,15 +255336,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
255329
255336
  return true;
255330
255337
  if (this.featureFlagsPoller === undefined)
255331
255338
  return false;
255332
- return new Promise((resolve9) => {
255339
+ return new Promise((resolve10) => {
255333
255340
  const timeout3 = setTimeout(() => {
255334
255341
  cleanup();
255335
- resolve9(false);
255342
+ resolve10(false);
255336
255343
  }, timeoutMs);
255337
255344
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
255338
255345
  clearTimeout(timeout3);
255339
255346
  cleanup();
255340
- resolve9(count2 > 0);
255347
+ resolve10(count2 > 0);
255341
255348
  });
255342
255349
  });
255343
255350
  }
@@ -256156,4 +256163,4 @@ export {
256156
256163
  CLIExitError
256157
256164
  };
256158
256165
 
256159
- //# debugId=8F3BBCD2474D49E464756E2164756E21
256166
+ //# debugId=38964848BBA4FA0D64756E2164756E21