@base44-preview/cli 0.0.32-pr.249.38b7e86 → 0.0.32-pr.249.69186d6

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
@@ -178102,6 +178102,18 @@ class InvalidInputError extends UserError {
178102
178102
  code = "INVALID_INPUT";
178103
178103
  }
178104
178104
 
178105
+ class DependencyNotFoundError extends UserError {
178106
+ code = "DEPENDENCY_NOT_FOUND";
178107
+ constructor(message, options) {
178108
+ super(message, {
178109
+ hints: options?.hints ?? [
178110
+ { message: "Install the required dependency and try again" }
178111
+ ],
178112
+ cause: options?.cause
178113
+ });
178114
+ }
178115
+ }
178116
+
178105
178117
  class ApiError extends SystemError {
178106
178118
  code = "API_ERROR";
178107
178119
  statusCode;
@@ -178217,6 +178229,21 @@ class FileReadError extends SystemError {
178217
178229
  });
178218
178230
  }
178219
178231
  }
178232
+
178233
+ class InternalError extends SystemError {
178234
+ code = "INTERNAL_ERROR";
178235
+ constructor(message, options) {
178236
+ super(message, {
178237
+ hints: options?.hints ?? [
178238
+ {
178239
+ message: "This is an unexpected error. Please report it if it persists."
178240
+ }
178241
+ ],
178242
+ cause: options?.cause
178243
+ });
178244
+ }
178245
+ }
178246
+
178220
178247
  class TypeGenerationError extends SystemError {
178221
178248
  code = "TYPE_GENERATION_ERROR";
178222
178249
  entityName;
@@ -195198,9 +195225,9 @@ function getTypesCommand(context) {
195198
195225
  }
195199
195226
 
195200
195227
  // src/cli/dev/dev-server/main.ts
195228
+ import { dirname as dirname12, join as join16 } from "node:path";
195201
195229
  var import_cors = __toESM(require_lib4(), 1);
195202
195230
  var import_express2 = __toESM(require_express(), 1);
195203
- import { dirname as dirname12, join as join16 } from "node:path";
195204
195231
 
195205
195232
  // node_modules/get-port/index.js
195206
195233
  import net from "node:net";
@@ -195390,12 +195417,19 @@ class FunctionManager {
195390
195417
  functionNames() {
195391
195418
  return Array.from(this.functions.keys());
195392
195419
  }
195420
+ getFunction(name2) {
195421
+ return this.functions.get(name2);
195422
+ }
195393
195423
  verifyDenoIsInstalled() {
195394
195424
  if (this.functions.size > 0) {
195395
195425
  try {
195396
195426
  spawn2("deno", ["--version"]);
195397
195427
  } catch {
195398
- throw new Error("Deno is required to run functions. Please install it from https://deno.com/download");
195428
+ throw new DependencyNotFoundError("Deno is required to run functions", {
195429
+ hints: [
195430
+ { message: "Install Deno from https://deno.com/download" }
195431
+ ]
195432
+ });
195399
195433
  }
195400
195434
  }
195401
195435
  }
@@ -195406,7 +195440,9 @@ class FunctionManager {
195406
195440
  }
195407
195441
  const backendFunction = this.functions.get(name2);
195408
195442
  if (!backendFunction) {
195409
- throw new Error(`Function "${name2}" not found`);
195443
+ throw new InvalidInputError(`Function "${name2}" not found`, {
195444
+ hints: [{ message: "Check available functions in your project" }]
195445
+ });
195410
195446
  }
195411
195447
  if (existing && !existing.ready) {
195412
195448
  return this.waitForReady(name2, existing);
@@ -195485,7 +195521,11 @@ class FunctionManager {
195485
195521
  waitForReady(name2, runningFunc) {
195486
195522
  return new Promise((resolve5, reject) => {
195487
195523
  const timeout3 = setTimeout(() => {
195488
- reject(new Error(`Function "${name2}" failed to start within timeout`));
195524
+ reject(new InternalError(`Function "${name2}" failed to start within ${READY_TIMEOUT / 1000}s timeout`, {
195525
+ hints: [
195526
+ { message: "Check the function code for startup errors" }
195527
+ ]
195528
+ }));
195489
195529
  }, READY_TIMEOUT);
195490
195530
  const onData = (data) => {
195491
195531
  const output = data.toString();
@@ -195500,7 +195540,9 @@ class FunctionManager {
195500
195540
  runningFunc.process.on("exit", (code2) => {
195501
195541
  if (!runningFunc.ready) {
195502
195542
  clearTimeout(timeout3);
195503
- reject(new Error(`Function "${name2}" exited with code ${code2}`));
195543
+ reject(new InternalError(`Function "${name2}" exited with code ${code2}`, {
195544
+ hints: [{ message: "Check the function code for errors" }]
195545
+ }));
195504
195546
  }
195505
195547
  });
195506
195548
  });
@@ -195609,6 +195651,9 @@ async function createDevServer(options8) {
195609
195651
  const devLogger = createDevLogger(false);
195610
195652
  const functionManager = new FunctionManager(functions, devLogger);
195611
195653
  functionManager.verifyDenoIsInstalled();
195654
+ if (functionManager.functionNames().length > 0) {
195655
+ M2.info(`Loaded functions: ${functionManager.functionNames().join(", ")}`);
195656
+ }
195612
195657
  const functionRoutes = createFunctionRoutes(functionManager, devLogger);
195613
195658
  app.use("/api/apps/:appId/functions", functionRoutes);
195614
195659
  app.use((req, res, next) => {
@@ -200032,4 +200077,4 @@ export {
200032
200077
  CLIExitError
200033
200078
  };
200034
200079
 
200035
- //# debugId=F7187C428A4270E164756E2164756E21
200080
+ //# debugId=B7317FFB63A141D964756E2164756E21