@base44-preview/cli 0.1.32-pr.661.1ab377a → 0.1.32-pr.662.1bdb1fe

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
@@ -31177,7 +31177,7 @@ function cleanDoc(doc) {
31177
31177
  return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
31178
31178
  }
31179
31179
  function replaceEndOfLine(doc, replacement = literalline) {
31180
- return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join31(replacement, currentDoc.split(`
31180
+ return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join30(replacement, currentDoc.split(`
31181
31181
  `)) : currentDoc);
31182
31182
  }
31183
31183
  function canBreakFn(doc) {
@@ -31257,7 +31257,7 @@ function indentIfBreak(contents, options) {
31257
31257
  negate: options.negate
31258
31258
  };
31259
31259
  }
31260
- function join31(separator, docs) {
31260
+ function join30(separator, docs) {
31261
31261
  assertDoc(separator);
31262
31262
  assertDocArray(docs);
31263
31263
  const parts = [];
@@ -31968,7 +31968,7 @@ var init_doc = __esm(() => {
31968
31968
  MODE_FLAT = Symbol("MODE_FLAT");
31969
31969
  DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
31970
31970
  builders = {
31971
- join: join31,
31971
+ join: join30,
31972
31972
  line,
31973
31973
  softline,
31974
31974
  hardline,
@@ -124807,7 +124807,7 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc2,
124807
124807
  }
124808
124808
  }
124809
124809
  }, ast_path_default, is_object_default, skipWhitespace, skipSpaces, skipToLineEnd, skipEverythingButNewLine, isNewlineCharacter = (character) => character === `
124810
- ` || character === "\r" || character === "\u2028" || character === "\u2029", skip_newline_default, has_newline_default, is_non_empty_array_default, get_sorted_child_nodes_default, childNodesCache, returnFalse = () => false, isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/u.test(text), is_previous_line_empty_default, breakParent2, hardline2, indent2, join33, line22, lineSuffix2, create_print_pre_check_function_default = () => noop_default2, core_options_evaluate_default, arrayToReversed, toReversed, method_to_reversed_default, import_n_readlines, get_interpreter_default, getFileBasename = (file) => {
124810
+ ` || character === "\r" || character === "\u2028" || character === "\u2029", skip_newline_default, has_newline_default, is_non_empty_array_default, get_sorted_child_nodes_default, childNodesCache, returnFalse = () => false, isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/u.test(text), is_previous_line_empty_default, breakParent2, hardline2, indent2, join32, line22, lineSuffix2, create_print_pre_check_function_default = () => noop_default2, core_options_evaluate_default, arrayToReversed, toReversed, method_to_reversed_default, import_n_readlines, get_interpreter_default, getFileBasename = (file) => {
124811
124811
  try {
124812
124812
  return path112.basename(toPath3(file));
124813
124813
  } catch {
@@ -134836,7 +134836,7 @@ ${codeblock}`, options8);
134836
134836
  breakParent: breakParent2,
134837
134837
  hardline: hardline2,
134838
134838
  indent: indent2,
134839
- join: join33,
134839
+ join: join32,
134840
134840
  line: line22,
134841
134841
  lineSuffix: lineSuffix2
134842
134842
  } = builders);
@@ -228838,7 +228838,7 @@ function normalizeBase44Env() {
228838
228838
  loadProjectEnvFiles();
228839
228839
 
228840
228840
  // src/cli/index.ts
228841
- import { dirname as dirname29, join as join41 } from "node:path";
228841
+ import { dirname as dirname29, join as join40 } from "node:path";
228842
228842
  import { fileURLToPath as fileURLToPath7 } from "node:url";
228843
228843
 
228844
228844
  // ../../node_modules/@clack/core/dist/index.mjs
@@ -240339,21 +240339,6 @@ function buildAssetsConfig(assetsConfig, progress) {
240339
240339
  run_worker_first: runWorkerFirst
240340
240340
  };
240341
240341
  }
240342
- // src/core/site/drop.ts
240343
- import { basename as basename6, join as join19 } from "node:path";
240344
- async function requireIndexHtml(siteDir) {
240345
- if (!await pathExists(join19(siteDir, "index.html"))) {
240346
- throw new InvalidInputError(`No index.html found in "${siteDir}" — a static site needs one at the folder root.`);
240347
- }
240348
- }
240349
- async function dropSite(siteDir) {
240350
- await requireIndexHtml(siteDir);
240351
- const name = basename6(siteDir);
240352
- const { projectId } = await createProject(name, `Static site '${name}'`);
240353
- setAppContext({ id: projectId });
240354
- const { appUrl } = await deploySite(siteDir);
240355
- return { appId: projectId, appUrl };
240356
- }
240357
240342
  // ../../node_modules/is-plain-obj/index.js
240358
240343
  function isPlainObject3(value) {
240359
240344
  if (typeof value !== "object" || value === null) {
@@ -246966,14 +246951,14 @@ async function deployAll(projectData, options) {
246966
246951
  return { connectorResults };
246967
246952
  }
246968
246953
  // src/core/project/target.ts
246969
- import { dirname as dirname13, join as join20, resolve as resolve6 } from "node:path";
246954
+ import { dirname as dirname13, join as join19, resolve as resolve6 } from "node:path";
246970
246955
  async function resolveBuildTarget(projectRoot, overrides = {}) {
246971
246956
  const project = await readSettingsIfPresent(projectRoot);
246972
246957
  const root = project?.root ?? projectRoot ?? process.cwd();
246973
246958
  const site = project ? siteOrDefault(project) : DEFAULT_SITE;
246974
246959
  return {
246975
246960
  root,
246976
- configDir: project ? dirname13(project.configPath) : join20(root, PROJECT_SUBDIR),
246961
+ configDir: project ? dirname13(project.configPath) : join19(root, PROJECT_SUBDIR),
246977
246962
  buildCommand: site.buildCommand,
246978
246963
  outputDir: resolve6(root, overrides.outputDir ?? site.outputDirectory ?? DEFAULT_SITE.outputDirectory),
246979
246964
  entitiesDir: project?.entitiesDir ?? "entities",
@@ -247835,7 +247820,7 @@ function getActorsCommand() {
247835
247820
  }
247836
247821
 
247837
247822
  // src/cli/commands/agent-skills/pull.ts
247838
- import { dirname as dirname14, join as join21 } from "node:path";
247823
+ import { dirname as dirname14, join as join20 } from "node:path";
247839
247824
  // src/core/utils/dependencies.ts
247840
247825
  import { spawnSync as spawnSync2 } from "node:child_process";
247841
247826
  function verifyDenoInstalled(context) {
@@ -247924,7 +247909,7 @@ async function pullAction({
247924
247909
  runTask
247925
247910
  }) {
247926
247911
  const { project } = await readProjectConfig();
247927
- const dir = join21(dirname14(project.configPath), project.agentSkillsDir);
247912
+ const dir = join20(dirname14(project.configPath), project.agentSkillsDir);
247928
247913
  const remote = await runTask("Fetching agent skills from Base44", () => fetchAgentSkills(), {
247929
247914
  successMessage: "Agent skills fetched successfully",
247930
247915
  errorMessage: "Failed to fetch agent skills"
@@ -247980,14 +247965,14 @@ function getAgentSkillsCommand() {
247980
247965
  }
247981
247966
 
247982
247967
  // src/cli/commands/agents/pull.ts
247983
- import { dirname as dirname15, join as join22 } from "node:path";
247968
+ import { dirname as dirname15, join as join21 } from "node:path";
247984
247969
  async function pullAgentsAction({
247985
247970
  log,
247986
247971
  runTask
247987
247972
  }) {
247988
247973
  const { project } = await readProjectConfig();
247989
247974
  const configDir = dirname15(project.configPath);
247990
- const agentsDir = join22(configDir, project.agentsDir);
247975
+ const agentsDir = join21(configDir, project.agentsDir);
247991
247976
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
247992
247977
  return await fetchAgents();
247993
247978
  }, {
@@ -248057,12 +248042,12 @@ function getAgentsCommand() {
248057
248042
  }
248058
248043
 
248059
248044
  // src/cli/commands/auth/password-login.ts
248060
- import { dirname as dirname16, join as join23 } from "node:path";
248045
+ import { dirname as dirname16, join as join22 } from "node:path";
248061
248046
  async function passwordLoginAction({ log, runTask }, action) {
248062
248047
  const shouldEnable = action === "enable";
248063
248048
  const { project } = await readProjectConfig();
248064
248049
  const configDir = dirname16(project.configPath);
248065
- const authDir = join23(configDir, project.authDir);
248050
+ const authDir = join22(configDir, project.authDir);
248066
248051
  const updated = await runTask("Updating local auth config", async () => {
248067
248052
  const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
248068
248053
  const merged = { ...current, enableUsernamePassword: shouldEnable };
@@ -248082,14 +248067,14 @@ function getPasswordLoginCommand() {
248082
248067
  }
248083
248068
 
248084
248069
  // src/cli/commands/auth/pull.ts
248085
- import { dirname as dirname17, join as join24 } from "node:path";
248070
+ import { dirname as dirname17, join as join23 } from "node:path";
248086
248071
  async function pullAuthAction({
248087
248072
  log,
248088
248073
  runTask
248089
248074
  }) {
248090
248075
  const { project } = await readProjectConfig();
248091
248076
  const configDir = dirname17(project.configPath);
248092
- const authDir = join24(configDir, project.authDir);
248077
+ const authDir = join23(configDir, project.authDir);
248093
248078
  const remoteConfig = await runTask("Fetching auth config from Base44", async () => {
248094
248079
  return await pullAuthConfig();
248095
248080
  }, {
@@ -248153,7 +248138,7 @@ function getAuthPushCommand() {
248153
248138
  }
248154
248139
 
248155
248140
  // src/cli/commands/auth/social-login.ts
248156
- import { dirname as dirname18, join as join25, resolve as resolve7 } from "node:path";
248141
+ import { dirname as dirname18, join as join24, resolve as resolve7 } from "node:path";
248157
248142
  var PROVIDER_LABELS = {
248158
248143
  google: "Google",
248159
248144
  microsoft: "Microsoft",
@@ -248224,7 +248209,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask }, provider, a
248224
248209
  }
248225
248210
  const { project } = await readProjectConfig();
248226
248211
  const configDir = dirname18(project.configPath);
248227
- const authDir = join25(configDir, project.authDir);
248212
+ const authDir = join24(configDir, project.authDir);
248228
248213
  const { config: updated } = await runTask("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
248229
248214
  if (clientSecret) {
248230
248215
  await runTask("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
@@ -248249,7 +248234,7 @@ function getSocialLoginCommand() {
248249
248234
  }
248250
248235
 
248251
248236
  // src/cli/commands/auth/sso.ts
248252
- import { dirname as dirname19, join as join26, resolve as resolve8 } from "node:path";
248237
+ import { dirname as dirname19, join as join25, resolve as resolve8 } from "node:path";
248253
248238
  var SSOConfigFileSchema = object({
248254
248239
  provider: _enum(Object.values(KNOWN_SSO_PROVIDERS)),
248255
248240
  clientId: string2(),
@@ -248413,7 +248398,7 @@ async function ssoEnableAction({ isNonInteractive, runTask }, options) {
248413
248398
  }
248414
248399
  const { project } = await readProjectConfig();
248415
248400
  const configDir = dirname19(project.configPath);
248416
- const authDir = join26(configDir, project.authDir);
248401
+ const authDir = join25(configDir, project.authDir);
248417
248402
  await runTask("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
248418
248403
  await runTask("Saving SSO credentials", async () => pushSSOSecrets(secrets));
248419
248404
  return {
@@ -248429,7 +248414,7 @@ async function ssoDisableAction({ log, runTask }, options) {
248429
248414
  }
248430
248415
  const { project } = await readProjectConfig();
248431
248416
  const configDir = dirname19(project.configPath);
248432
- const authDir = join26(configDir, project.authDir);
248417
+ const authDir = join25(configDir, project.authDir);
248433
248418
  const updated = await runTask("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
248434
248419
  await runTask("Removing SSO credentials", async () => deleteSSOSecrets());
248435
248420
  if (!hasAnyLoginMethod(updated)) {
@@ -249311,13 +249296,13 @@ function getConnectorsListAvailableCommand() {
249311
249296
  }
249312
249297
 
249313
249298
  // src/cli/commands/connectors/pull.ts
249314
- import { dirname as dirname20, join as join27, resolve as resolve9 } from "node:path";
249299
+ import { dirname as dirname20, join as join26, resolve as resolve9 } from "node:path";
249315
249300
  async function resolveConnectorsDir(options) {
249316
249301
  if (!getAppContext().projectRoot) {
249317
249302
  return resolve9(options.dir ?? "connectors");
249318
249303
  }
249319
249304
  const { project } = await readProjectConfig();
249320
- return join27(dirname20(project.configPath), project.connectorsDir);
249305
+ return join26(dirname20(project.configPath), project.connectorsDir);
249321
249306
  }
249322
249307
  async function pullConnectorsAction({ log, runTask, jsonMode }, options) {
249323
249308
  const connectorsDir = await resolveConnectorsDir(options);
@@ -249497,23 +249482,6 @@ function getDashboardCommand() {
249497
249482
  return new Command2("dashboard").description("Manage app dashboard").addCommand(getDashboardOpenCommand());
249498
249483
  }
249499
249484
 
249500
- // src/cli/commands/drop.ts
249501
- import { resolve as resolve11 } from "node:path";
249502
- async function dropAction({ runTask, jsonMode }, dir) {
249503
- const { appId, appUrl } = await runTask("Creating app and deploying site...", async () => await dropSite(resolve11(dir)), {
249504
- successMessage: theme.colors.base44Orange("Site deployed successfully"),
249505
- errorMessage: "Drop failed"
249506
- });
249507
- return {
249508
- outroMessage: `Visit your site at: ${theme.colors.links(appUrl)}`,
249509
- stdout: jsonMode ? `${JSON.stringify({ appId, appUrl }, null, 2)}
249510
- ` : undefined
249511
- };
249512
- }
249513
- function getDropCommand() {
249514
- return new Base44Command("drop", { requireAppContext: false }).description("Host a folder of static files (index.html at its root) on Base44 as a new app").argument("[dir]", "Folder to deploy", ".").action(dropAction);
249515
- }
249516
-
249517
249485
  // src/cli/commands/entities/push.ts
249518
249486
  async function pushEntitiesAction({ isNonInteractive, log, runTask }, options) {
249519
249487
  const { entities } = await readProjectConfig();
@@ -249721,11 +249689,11 @@ function getListCommand() {
249721
249689
  }
249722
249690
 
249723
249691
  // src/cli/commands/functions/pull.ts
249724
- import { dirname as dirname21, join as join28 } from "node:path";
249692
+ import { dirname as dirname21, join as join27 } from "node:path";
249725
249693
  async function pullFunctionsAction({ log, runTask }, name) {
249726
249694
  const { project, functions } = await readProjectConfig();
249727
249695
  const configDir = dirname21(project.configPath);
249728
- const functionsDir = join28(configDir, project.functionsDir);
249696
+ const functionsDir = join27(configDir, project.functionsDir);
249729
249697
  const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
249730
249698
  const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
249731
249699
  const { functions } = await listDeployedFunctions();
@@ -249835,11 +249803,11 @@ function getBuildCommand() {
249835
249803
  }
249836
249804
 
249837
249805
  // src/cli/commands/project/create.ts
249838
- import { basename as basename7, resolve as resolve12 } from "node:path";
249806
+ import { basename as basename6, resolve as resolve11 } from "node:path";
249839
249807
  var import_kebabCase = __toESM(require_kebabCase(), 1);
249840
249808
 
249841
249809
  // src/cli/commands/project/scaffold-shared.ts
249842
- import { join as join29 } from "node:path";
249810
+ import { join as join28 } from "node:path";
249843
249811
  var DEFAULT_TEMPLATE_ID = "backend-only";
249844
249812
  async function getTemplateById(templateId) {
249845
249813
  const templates = await listTemplates();
@@ -249902,7 +249870,7 @@ async function completeProjectSetup({
249902
249870
  env: { VITE_BASE44_APP_ID: projectId }
249903
249871
  })`${buildCommand}`;
249904
249872
  updateMessage("Deploying site...");
249905
- return await deploySite(join29(resolvedPath, outputDirectory));
249873
+ return await deploySite(join28(resolvedPath, outputDirectory));
249906
249874
  }, {
249907
249875
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
249908
249876
  errorMessage: "Failed to deploy site"
@@ -250000,8 +249968,8 @@ async function createInteractive(options, ctx) {
250000
249968
  name: () => {
250001
249969
  return options.name ? Promise.resolve(options.name) : Ze({
250002
249970
  message: "What is the name of your project?",
250003
- placeholder: basename7(process.cwd()),
250004
- initialValue: basename7(process.cwd()),
249971
+ placeholder: basename6(process.cwd()),
249972
+ initialValue: basename6(process.cwd()),
250005
249973
  validate: (value) => {
250006
249974
  if (!value || value.trim().length === 0) {
250007
249975
  return "Every project deserves a name";
@@ -250031,7 +249999,7 @@ async function createInteractive(options, ctx) {
250031
249999
  }, ctx);
250032
250000
  }
250033
250001
  async function createNonInteractive(options, ctx) {
250034
- ctx.log.info(`Creating a new project at ${resolve12(options.path)}`);
250002
+ ctx.log.info(`Creating a new project at ${resolve11(options.path)}`);
250035
250003
  const template = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
250036
250004
  return await executeCreate({
250037
250005
  template,
@@ -250055,7 +250023,7 @@ async function executeCreate({
250055
250023
  }, ctx) {
250056
250024
  const { log, runTask } = ctx;
250057
250025
  const name = rawName.trim();
250058
- const resolvedPath = resolve12(projectPath);
250026
+ const resolvedPath = resolve11(projectPath);
250059
250027
  const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
250060
250028
  const { projectId } = await runTask("Setting up your project...", async () => {
250061
250029
  return await createProjectFiles({
@@ -250696,7 +250664,7 @@ function getLogsCommand() {
250696
250664
  }
250697
250665
 
250698
250666
  // src/cli/commands/project/scaffold.ts
250699
- import { basename as basename8, resolve as resolve13 } from "node:path";
250667
+ import { basename as basename7, resolve as resolve12 } from "node:path";
250700
250668
  function resolveAppId(options) {
250701
250669
  const appId = options.appId;
250702
250670
  if (!appId) {
@@ -250712,8 +250680,8 @@ function resolveAppId(options) {
250712
250680
  async function scaffoldAction(ctx, name, options, command) {
250713
250681
  const { log, runTask } = ctx;
250714
250682
  const appId = resolveAppId(command.optsWithGlobals());
250715
- const resolvedPath = resolve13("./");
250716
- const projectName = (name ?? basename8(resolvedPath)).trim();
250683
+ const resolvedPath = resolve12("./");
250684
+ const projectName = (name ?? basename7(resolvedPath)).trim();
250717
250685
  const template = await getTemplateById("backend-only");
250718
250686
  log.info(`Scaffolding project at ${resolvedPath}`);
250719
250687
  const { projectId } = await runTask("Setting up your project...", async () => {
@@ -250918,7 +250886,7 @@ async function setEnvironmentVersion(environment, versionId, options = {}) {
250918
250886
  }
250919
250887
  // src/core/version/artifacts.ts
250920
250888
  import { createHash as createHash3 } from "node:crypto";
250921
- import { join as join30, resolve as resolve14 } from "node:path";
250889
+ import { join as join29, resolve as resolve13 } from "node:path";
250922
250890
 
250923
250891
  // src/core/version/functions.ts
250924
250892
  import { createHash as createHash2 } from "node:crypto";
@@ -253193,6 +253161,10 @@ var STATIC_EGRESS_ENABLED_ENV = "BASE44_STATIC_EGRESS_ENABLED";
253193
253161
  var STATIC_EGRESS_DIAGNOSTIC_LIMIT = 5;
253194
253162
  var staticEgressFetchInstalled = false;
253195
253163
  var staticEgressDiagnosticCount = 0;
253164
+ var dedicatedEgressResponses = /* @__PURE__ */ new WeakSet();
253165
+ function isDedicatedEgressResponse(response) {
253166
+ return dedicatedEgressResponses.has(response);
253167
+ }
253196
253168
  function inputKind(input) {
253197
253169
  if (typeof input === "string") return "string";
253198
253170
  return input instanceof URL ? "url" : "request";
@@ -253294,7 +253266,10 @@ function createRequestScopedStaticEgressFetch(originalFetch, readEnvironment) {
253294
253266
  return originalFetch(input, init);
253295
253267
  }
253296
253268
  logStaticEgressDecision("dedicated", input, binding, enableSecret);
253297
- return binding.fetch(input, init);
253269
+ return binding.fetch(input, init).then((response) => {
253270
+ dedicatedEgressResponses.add(response);
253271
+ return response;
253272
+ });
253298
253273
  };
253299
253274
  }
253300
253275
  function installStaticEgressFetch() {
@@ -253306,6 +253281,112 @@ function installStaticEgressFetch() {
253306
253281
  staticEgressFetchInstalled = true;
253307
253282
  }
253308
253283
 
253284
+ // src/edge-errors.ts
253285
+ var EDGE_ERRORS_HEADER = "X-B44-Edge-Errors";
253286
+ var MAX_EDGE_ERRORS = 5;
253287
+ var MAX_INSPECTED_BODY_BYTES = 8192;
253288
+ var BODY_READ_TIMEOUT_MS = 500;
253289
+ var PLAIN_TEXT_EDGE_ERROR = /^error code: (\\d{3,4})\\s*$/;
253290
+ var SAFE_VALUE = /^[\\x20-\\x7e]{1,253}$/;
253291
+ function safe(value) {
253292
+ return typeof value === "string" && SAFE_VALUE.test(value) ? value : void 0;
253293
+ }
253294
+ function parseEdgeErrorBody(body) {
253295
+ const plain = PLAIN_TEXT_EDGE_ERROR.exec(body);
253296
+ if (plain) return { code: Number(plain[1]) };
253297
+ if (!body.trimStart().startsWith("{")) return null;
253298
+ try {
253299
+ const json = JSON.parse(body);
253300
+ if (json === null || typeof json !== "object") return null;
253301
+ const fields = json;
253302
+ if (fields.cloudflare_error !== true || !Number.isInteger(fields.error_code)) return null;
253303
+ return {
253304
+ code: fields.error_code,
253305
+ name: safe(fields.error_name),
253306
+ category: safe(fields.error_category),
253307
+ zone: safe(fields.zone)
253308
+ };
253309
+ } catch {
253310
+ return null;
253311
+ }
253312
+ }
253313
+ async function readEdgeError(response) {
253314
+ if (response.status < 400) return null;
253315
+ const length = Number(response.headers.get("content-length"));
253316
+ if (!response.headers.get("cf-ray") || !(length > 0 && length <= MAX_INSPECTED_BODY_BYTES)) {
253317
+ return null;
253318
+ }
253319
+ let timer;
253320
+ try {
253321
+ const body = await Promise.race([
253322
+ response.clone().text(),
253323
+ new Promise((resolve2) => {
253324
+ timer = setTimeout(() => resolve2(null), BODY_READ_TIMEOUT_MS);
253325
+ })
253326
+ ]);
253327
+ return body === null ? null : parseEdgeErrorBody(body);
253328
+ } finally {
253329
+ clearTimeout(timer);
253330
+ }
253331
+ }
253332
+ function targetOrigin(input) {
253333
+ try {
253334
+ const raw = input instanceof URL ? input.href : typeof input === "string" ? input : input.url;
253335
+ return new URL(raw).origin;
253336
+ } catch {
253337
+ return null;
253338
+ }
253339
+ }
253340
+ async function recordEdgeError(input, response, startedAt) {
253341
+ const store = currentWorkerRuntimeContext();
253342
+ if (!store) return;
253343
+ const body = await readEdgeError(response);
253344
+ const target = targetOrigin(input);
253345
+ if (!body || !target) return;
253346
+ const record = store.edgeErrors ??= { errors: [], dropped: 0 };
253347
+ if (record.errors.length >= MAX_EDGE_ERRORS) {
253348
+ record.dropped += 1;
253349
+ return;
253350
+ }
253351
+ record.errors.push({
253352
+ ...body,
253353
+ target,
253354
+ status: response.status,
253355
+ ray: safe(response.headers.get("cf-ray")) ?? "",
253356
+ egress: isDedicatedEgressResponse(response) ? "dedicated" : "shared",
253357
+ elapsed_ms: Date.now() - startedAt
253358
+ });
253359
+ }
253360
+ function createEdgeErrorFetch(innerFetch) {
253361
+ return async (input, init) => {
253362
+ const startedAt = Date.now();
253363
+ const response = await innerFetch(input, init);
253364
+ try {
253365
+ await recordEdgeError(input, response, startedAt);
253366
+ } catch {
253367
+ }
253368
+ return response;
253369
+ };
253370
+ }
253371
+ var edgeErrorFetchInstalled = false;
253372
+ function installEdgeErrorFetch() {
253373
+ if (edgeErrorFetchInstalled) return;
253374
+ globalThis.fetch = createEdgeErrorFetch(globalThis.fetch.bind(globalThis));
253375
+ edgeErrorFetchInstalled = true;
253376
+ }
253377
+ function attachEdgeErrors(response) {
253378
+ const record = currentWorkerRuntimeContext()?.edgeErrors;
253379
+ if (!record || !(response instanceof Response)) return response;
253380
+ if (response.status === 101 || response.webSocket) return response;
253381
+ try {
253382
+ const wrapped = new Response(response.body, response);
253383
+ wrapped.headers.set(EDGE_ERRORS_HEADER, JSON.stringify(record));
253384
+ return wrapped;
253385
+ } catch {
253386
+ return response;
253387
+ }
253388
+ }
253389
+
253309
253390
  // src/static-egress-tcp-core.mjs
253310
253391
  function normalizeHost(host) {
253311
253392
  return host.toLowerCase().replace(/^\\[(.*)\\]$/, "$1").replace(/\\.$/, "");
@@ -253459,7 +253540,9 @@ function resolveHandler(functionName) {
253459
253540
  return handler;
253460
253541
  }
253461
253542
  export {
253543
+ attachEdgeErrors,
253462
253544
  getRegisteredHandler,
253545
+ installEdgeErrorFetch,
253463
253546
  installStaticEgressFetch,
253464
253547
  registerLazy,
253465
253548
  resolveHandler
@@ -256352,10 +256435,10 @@ var INVOCATION_LOGS_PATCH = [
256352
256435
  "};",
256353
256436
  "const _b44CrashResponse = (e) => {",
256354
256437
  " const c = _b44Context();",
256355
- " if (!c || !c.invocationLogs) return null;",
256438
+ " if (!c || !(c.invocationLogs || c.edgeErrors)) return null;",
256356
256439
  " const m = String(e instanceof Error ? e.message : e).toLowerCase();",
256357
256440
  " if (m.includes('cpu time limit') || m.includes('too many subrequests')) return null;",
256358
- " return _b44AttachInvocationLogs(new Response(JSON.stringify({ error: 'user-exception', detail: 'user worker threw an exception' }), { status: 500, headers: { 'Content-Type': 'application/json' } }));",
256441
+ " return _b44AttachInvocationLogs(_b44AttachEdgeErrors(new Response(JSON.stringify({ error: 'user-exception', detail: 'user worker threw an exception' }), { status: 500, headers: { 'Content-Type': 'application/json' } })));",
256359
256442
  "};"
256360
256443
  ].join(`
256361
256444
  `);
@@ -256399,7 +256482,7 @@ var TELEMETRY_PATCH = [
256399
256482
  var TELEMETRY_STORE_FIELDS = "reqId: crypto.randomUUID(), respondedAt: null, inflight: new Map(), inflightTotal: 0, hadRejection: false, hadNonOk: false, logBudget: 5";
256400
256483
 
256401
256484
  // ../functions-compiler/src/version.ts
256402
- var COMPILER_VERSION = "0.1.6";
256485
+ var COMPILER_VERSION = "0.1.7";
256403
256486
 
256404
256487
  // ../functions-compiler/src/worker-entry.ts
256405
256488
  function denoShimSource() {
@@ -256504,20 +256587,22 @@ registerLazy(${JSON.stringify(functionName)}, () => import(${JSON.stringify(user
256504
256587
  function buildAppEntrySource(functionModules, telemetry, runtimeSecrets = false) {
256505
256588
  const moduleImports = functionModules.map((file) => `import "./${file}";`).join(`
256506
256589
  `);
256507
- const handlerExpr = `_b44AttachInvocationLogs(${telemetry ? "_b44AttachTelemetry(await handler(request, info))" : "await handler(request, info)"})`;
256590
+ const handlerExpr = `_b44AttachInvocationLogs(_b44AttachEdgeErrors(${telemetry ? "_b44AttachTelemetry(await handler(request, info))" : "await handler(request, info)"}))`;
256508
256591
  const guard = activationGuard(runtimeSecrets);
256509
256592
  const returnExpr = guard(handlerExpr);
256510
256593
  return `// Auto-generated by the base44 bundler. Do not edit.
256511
256594
 
256512
256595
  import { currentWorkerRuntimeContext as _b44Context, runWithWorkerEnvironment as _b44Run } from ${JSON.stringify(RUNTIME_CONTEXT_SPECIFIER)};
256513
- import { installStaticEgressFetch, resolveHandler } from "./${SHIM_FILENAME}";${activationImport(runtimeSecrets)}
256596
+ import { attachEdgeErrors as _b44AttachEdgeErrors, installEdgeErrorFetch, installStaticEgressFetch, resolveHandler } from "./${SHIM_FILENAME}";${activationImport(runtimeSecrets)}
256514
256597
  ${moduleImports}
256515
256598
 
256516
256599
  ${consolePatch(runtimeSecrets)}
256517
256600
  ${INVOCATION_LOGS_PATCH}
256518
- // Static egress reads workerEnv from the active request store. Install it
256519
- // before telemetry so telemetry remains the outermost fetch wrapper.
256601
+ // Static egress reads workerEnv from the active request store. Install it and
256602
+ // the edge-error recorder before telemetry so telemetry remains the outermost
256603
+ // fetch wrapper.
256520
256604
  installStaticEgressFetch();
256605
+ installEdgeErrorFetch();
256521
256606
  ${telemetry ? TELEMETRY_PATCH : ""}
256522
256607
 
256523
256608
  export default {
@@ -261639,7 +261724,7 @@ async function collectBuildOutput(outputDir, options = {}) {
261639
261724
  }
261640
261725
  async function describeSiteWorker(built) {
261641
261726
  const { config, modules } = built;
261642
- const entry = resolve14(config.configDir, config.main);
261727
+ const entry = resolve13(config.configDir, config.main);
261643
261728
  const main = modules.find((m) => m.absolutePath === entry)?.name;
261644
261729
  if (!main) {
261645
261730
  throw new InvalidInputError(`The Worker's entry module ${config.main} is not among the ${modules.length} modules collected from ${config.configDir}.`);
@@ -261670,14 +261755,14 @@ async function readRawResources(dir) {
261670
261755
  const payloads = {};
261671
261756
  for (const relativePath of files.sort()) {
261672
261757
  const name = relativePath.replace(/\.jsonc?$/, "");
261673
- payloads[name] = await readJsonFile(join30(dir, ...relativePath.split("/")));
261758
+ payloads[name] = await readJsonFile(join29(dir, ...relativePath.split("/")));
261674
261759
  }
261675
261760
  return payloads;
261676
261761
  }
261677
261762
  async function collectResources(configDir, dirs) {
261678
261763
  const [entities, agents] = await Promise.all([
261679
- readRawResources(join30(configDir, dirs.entitiesDir)),
261680
- readRawResources(join30(configDir, dirs.agentsDir))
261764
+ readRawResources(join29(configDir, dirs.entitiesDir)),
261765
+ readRawResources(join29(configDir, dirs.agentsDir))
261681
261766
  ]);
261682
261767
  return { entities, agents };
261683
261768
  }
@@ -261689,7 +261774,7 @@ async function collectArtifacts(target) {
261689
261774
  entryFile: ENTRY2
261690
261775
  }),
261691
261776
  ...siteWorker ? { siteWorker } : {},
261692
- backendBundles: await tagStep2("build", () => compileBackendBundles(target.root, join30(target.configDir, target.functionsDir))),
261777
+ backendBundles: await tagStep2("build", () => compileBackendBundles(target.root, join29(target.configDir, target.functionsDir))),
261693
261778
  ...await collectResources(target.configDir, target)
261694
261779
  };
261695
261780
  }
@@ -262147,7 +262232,7 @@ function getSecretsListCommand() {
262147
262232
  }
262148
262233
 
262149
262234
  // src/cli/commands/secrets/set.ts
262150
- import { resolve as resolve15 } from "node:path";
262235
+ import { resolve as resolve14 } from "node:path";
262151
262236
  function parseEntries(entries) {
262152
262237
  const secrets = {};
262153
262238
  for (const entry of entries) {
@@ -262178,7 +262263,7 @@ async function setSecretsAction({ log, runTask }, entries, options) {
262178
262263
  validateInput(entries, options);
262179
262264
  let secrets;
262180
262265
  if (options.envFile) {
262181
- secrets = await parseEnvFile(resolve15(options.envFile));
262266
+ secrets = await parseEnvFile(resolve14(options.envFile));
262182
262267
  if (Object.keys(secrets).length === 0) {
262183
262268
  throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
262184
262269
  }
@@ -262207,7 +262292,7 @@ function getSecretsCommand() {
262207
262292
  }
262208
262293
 
262209
262294
  // src/cli/commands/site/deploy.ts
262210
- import { resolve as resolve16 } from "node:path";
262295
+ import { resolve as resolve15 } from "node:path";
262211
262296
  async function deployAction2(ctx, options) {
262212
262297
  const { isNonInteractive } = ctx;
262213
262298
  if (isNonInteractive && !options.yes) {
@@ -262276,7 +262361,7 @@ async function deployTarball({ runTask }, project) {
262276
262361
  }
262277
262362
  function siteOutputDir(project) {
262278
262363
  const { outputDirectory = DEFAULT_SITE.outputDirectory } = siteOrDefault(project);
262279
- return resolve16(project.root, outputDirectory);
262364
+ return resolve15(project.root, outputDirectory);
262280
262365
  }
262281
262366
  function getSiteDeployCommand() {
262282
262367
  const command = new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)");
@@ -262620,10 +262705,10 @@ function toPascalCase(name) {
262620
262705
  return name.split(/[-_\s]+/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
262621
262706
  }
262622
262707
  // src/core/types/update-project.ts
262623
- import { join as join34 } from "node:path";
262708
+ import { join as join33 } from "node:path";
262624
262709
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
262625
262710
  async function updateProjectConfig(projectRoot) {
262626
- const tsconfigPath = join34(projectRoot, "tsconfig.json");
262711
+ const tsconfigPath = join33(projectRoot, "tsconfig.json");
262627
262712
  if (!await pathExists(tsconfigPath)) {
262628
262713
  return false;
262629
262714
  }
@@ -263104,7 +263189,7 @@ function getWorkspaceCommand() {
263104
263189
  // src/cli/dev/dev-server/main.ts
263105
263190
  var import_cors = __toESM(require_lib4(), 1);
263106
263191
  var import_express6 = __toESM(require_express(), 1);
263107
- import { dirname as dirname27, join as join39 } from "node:path";
263192
+ import { dirname as dirname27, join as join38 } from "node:path";
263108
263193
 
263109
263194
  // ../../node_modules/get-port/index.js
263110
263195
  import net from "node:net";
@@ -263234,7 +263319,7 @@ var $tmpName = promisify12(tmp.tmpName);
263234
263319
 
263235
263320
  // src/cli/dev/dev-server/function-manager.ts
263236
263321
  import { spawn as spawn3 } from "node:child_process";
263237
- import { dirname as dirname24, join as join35 } from "node:path";
263322
+ import { dirname as dirname24, join as join34 } from "node:path";
263238
263323
  import { pathToFileURL as pathToFileURL6 } from "node:url";
263239
263324
 
263240
263325
  // src/cli/dev/dev-server/base-function-manager.ts
@@ -263339,7 +263424,7 @@ class FunctionManager extends BaseFunctionManager {
263339
263424
  }
263340
263425
  spawnFunction(func, port) {
263341
263426
  this.logger.log(`Spawning function "${func.name}" on port ${port}`);
263342
- const importMapPath = join35(dirname24(this.wrapperPath), "import-map.json");
263427
+ const importMapPath = join34(dirname24(this.wrapperPath), "import-map.json");
263343
263428
  const process2 = spawn3("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
263344
263429
  env: {
263345
263430
  ...globalThis.process.env,
@@ -263413,7 +263498,7 @@ class FunctionManager extends BaseFunctionManager {
263413
263498
  import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
263414
263499
  import { isBuiltin as isBuiltin3 } from "node:module";
263415
263500
  import { homedir as homedir4 } from "node:os";
263416
- import { join as join36 } from "node:path";
263501
+ import { join as join35 } from "node:path";
263417
263502
  import { pathToFileURL as pathToFileURL7 } from "node:url";
263418
263503
  var depsPromise;
263419
263504
  function loadDeps() {
@@ -263534,9 +263619,9 @@ export default {
263534
263619
  };
263535
263620
  `;
263536
263621
  function ensureBundlerConfig() {
263537
- const dir = join36(homedir4(), ".base44", "function-bundler");
263622
+ const dir = join35(homedir4(), ".base44", "function-bundler");
263538
263623
  mkdirSync2(dir, { recursive: true });
263539
- const configPath = join36(dir, "deno.json");
263624
+ const configPath = join35(dir, "deno.json");
263540
263625
  writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
263541
263626
  `);
263542
263627
  return configPath;
@@ -266865,8 +266950,8 @@ async function createDevServer(options) {
266865
266950
  broadcastEntityEvent(io, appId, entityName, event);
266866
266951
  };
266867
266952
  const base44ConfigWatcher = new WatchBase44({
266868
- functions: join39(dirname27(project.configPath), project.functionsDir),
266869
- entities: join39(dirname27(project.configPath), project.entitiesDir)
266953
+ functions: join38(dirname27(project.configPath), project.functionsDir),
266954
+ entities: join38(dirname27(project.configPath), project.entitiesDir)
266870
266955
  }, devLogger);
266871
266956
  base44ConfigWatcher.on("change", async (name) => {
266872
266957
  try {
@@ -267069,7 +267154,7 @@ function readExecEnvTarget(env = process.env) {
267069
267154
  // src/core/exec/run-script.ts
267070
267155
  import { spawn as spawn4 } from "node:child_process";
267071
267156
  import { readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
267072
- import { join as join40 } from "node:path";
267157
+ import { join as join39 } from "node:path";
267073
267158
  var SDK_SPECIFIER = '"npm:@base44/sdk"';
267074
267159
  function wrapperSource(sdkVersion) {
267075
267160
  const source = readFileSync4(getExecWrapperPath(), "utf-8");
@@ -267105,7 +267190,7 @@ async function runScript(options) {
267105
267190
  writeFileSync3(tempWrapper.path, wrapperSource(sdkVersion), "utf-8");
267106
267191
  const configDir = await $dir({ unsafeCleanup: true });
267107
267192
  cleanupFns.push(configDir.cleanup);
267108
- const configPath = join40(configDir.path, "deno.json");
267193
+ const configPath = join39(configDir.path, "deno.json");
267109
267194
  writeFileSync3(configPath, JSON.stringify(DENO_CONFIG), "utf-8");
267110
267195
  try {
267111
267196
  const exitCode = await new Promise((resolvePromise) => {
@@ -267226,7 +267311,7 @@ Examples:
267226
267311
  }
267227
267312
 
267228
267313
  // src/cli/commands/project/eject.ts
267229
- import { resolve as resolve20 } from "node:path";
267314
+ import { resolve as resolve19 } from "node:path";
267230
267315
  var import_kebabCase2 = __toESM(require_kebabCase(), 1);
267231
267316
  async function eject(ctx, options, command) {
267232
267317
  const { log, runTask, isNonInteractive } = ctx;
@@ -267290,7 +267375,7 @@ async function eject(ctx, options, command) {
267290
267375
  Ne("Operation cancelled.");
267291
267376
  throw new CLIExitError(0);
267292
267377
  }
267293
- const resolvedPath = resolve20(selectedPath);
267378
+ const resolvedPath = resolve19(selectedPath);
267294
267379
  await runTask("Downloading your project's code...", async (updateMessage) => {
267295
267380
  await createProjectFilesForExistingProject({
267296
267381
  projectId,
@@ -267363,7 +267448,6 @@ function createProgram(context) {
267363
267448
  program.addCommand(getDashboardCommand());
267364
267449
  program.addCommand(getBuildCommand());
267365
267450
  program.addCommand(getDeployCommand3());
267366
- program.addCommand(getDropCommand());
267367
267451
  program.addCommand(getVisibilityCommand());
267368
267452
  program.addCommand(getLinkCommand());
267369
267453
  program.addCommand(getEjectCommand());
@@ -271396,7 +271480,7 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
271396
271480
  // src/cli/index.ts
271397
271481
  var __dirname4 = dirname29(fileURLToPath7(import.meta.url));
271398
271482
  async function runCLI(options) {
271399
- ensureNpmAssets(join41(__dirname4, "../assets"));
271483
+ ensureNpmAssets(join40(__dirname4, "../assets"));
271400
271484
  const errorReporter = new ErrorReporter;
271401
271485
  errorReporter.registerProcessErrorHandlers();
271402
271486
  const jsonMode = process.argv.includes("--json");
@@ -271435,4 +271519,4 @@ export {
271435
271519
  runCLI
271436
271520
  };
271437
271521
 
271438
- //# debugId=274F425C0531293164756E2164756E21
271522
+ //# debugId=07CB780E430930C364756E2164756E21