@base44-preview/cli 0.2.1-pr.672.43c8ae1 → 0.2.2-pr.674.03ac2f7

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
@@ -228838,7 +228838,7 @@ function normalizeBase44Env() {
228838
228838
  loadProjectEnvFiles();
228839
228839
 
228840
228840
  // src/cli/index.ts
228841
- import { dirname as dirname30, join as join41 } from "node:path";
228841
+ import { dirname as dirname31, join as join41 } from "node:path";
228842
228842
  import { fileURLToPath as fileURLToPath7 } from "node:url";
228843
228843
 
228844
228844
  // ../../node_modules/@clack/core/dist/index.mjs
@@ -230718,6 +230718,9 @@ import { randomUUID as randomUUID2 } from "node:crypto";
230718
230718
 
230719
230719
  // src/core/auth/config.ts
230720
230720
  var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
230721
+ import { mkdir as mkdir2, open, stat, unlink as unlink2 } from "node:fs/promises";
230722
+ import { dirname as dirname4 } from "node:path";
230723
+ import { setTimeout as sleep3 } from "node:timers/promises";
230721
230724
 
230722
230725
  // src/core/config.ts
230723
230726
  import { homedir } from "node:os";
@@ -230831,6 +230834,8 @@ function getTestOverrides() {
230831
230834
  // src/core/auth/config.ts
230832
230835
  var TOKEN_REFRESH_BUFFER_MS = 60 * 1000;
230833
230836
  var WORKSPACE_API_KEY_PREFIX = "b44k_";
230837
+ var REFRESH_LOCK_STALE_MS = 30 * 1000;
230838
+ var REFRESH_LOCK_RETRY_MS = 50;
230834
230839
  var refreshPromise = null;
230835
230840
  function getWorkspaceApiKeyFromEnv() {
230836
230841
  const key = process.env.BASE44_API_KEY?.trim();
@@ -230900,23 +230905,56 @@ async function deleteAuth() {
230900
230905
  function isTokenExpired(auth) {
230901
230906
  return Date.now() >= auth.expiresAt - TOKEN_REFRESH_BUFFER_MS;
230902
230907
  }
230908
+ async function withRefreshLock(fn) {
230909
+ const lockPath = `${getAuthFilePath()}.lock`;
230910
+ await mkdir2(dirname4(lockPath), { recursive: true });
230911
+ for (;; ) {
230912
+ try {
230913
+ await (await open(lockPath, "wx")).close();
230914
+ break;
230915
+ } catch (error) {
230916
+ if (error.code !== "EEXIST") {
230917
+ throw error;
230918
+ }
230919
+ const lock = await stat(lockPath).catch(() => null);
230920
+ if (lock && Date.now() - lock.mtimeMs > REFRESH_LOCK_STALE_MS) {
230921
+ await unlink2(lockPath).catch(() => {});
230922
+ } else {
230923
+ await sleep3(REFRESH_LOCK_RETRY_MS);
230924
+ }
230925
+ }
230926
+ }
230927
+ try {
230928
+ return await fn();
230929
+ } finally {
230930
+ await unlink2(lockPath).catch(() => {});
230931
+ }
230932
+ }
230903
230933
  async function refreshAndSaveTokens() {
230904
230934
  if (refreshPromise) {
230905
230935
  return refreshPromise;
230906
230936
  }
230907
230937
  refreshPromise = (async () => {
230908
230938
  try {
230909
- const auth = await readAuth();
230910
- const tokenResponse = await renewAccessToken(auth.refreshToken);
230911
- await writeAuth({
230912
- ...auth,
230913
- accessToken: tokenResponse.accessToken,
230914
- refreshToken: tokenResponse.refreshToken,
230915
- expiresAt: Date.now() + tokenResponse.expiresIn * 1000
230939
+ const staleRefreshToken = (await readAuth()).refreshToken;
230940
+ return await withRefreshLock(async () => {
230941
+ const auth = await readAuth();
230942
+ if (auth.refreshToken !== staleRefreshToken) {
230943
+ return auth.accessToken;
230944
+ }
230945
+ const tokenResponse = await renewAccessToken(auth.refreshToken);
230946
+ await writeAuth({
230947
+ ...auth,
230948
+ accessToken: tokenResponse.accessToken,
230949
+ refreshToken: tokenResponse.refreshToken,
230950
+ expiresAt: Date.now() + tokenResponse.expiresIn * 1000
230951
+ });
230952
+ return tokenResponse.accessToken;
230916
230953
  });
230917
- return tokenResponse.accessToken;
230918
- } catch {
230919
- await deleteAuth();
230954
+ } catch (error) {
230955
+ if (error instanceof ApiError && (error.statusCode === 400 || error.statusCode === 401)) {
230956
+ await deleteAuth();
230957
+ }
230920
230958
  return null;
230921
230959
  } finally {
230922
230960
  refreshPromise = null;
@@ -231988,7 +232026,7 @@ import path6 from "node:path";
231988
232026
 
231989
232027
  // ../../node_modules/tar/dist/esm/list.js
231990
232028
  import fs5 from "node:fs";
231991
- import { dirname as dirname4, parse as parse7 } from "path";
232029
+ import { dirname as dirname5, parse as parse7 } from "path";
231992
232030
 
231993
232031
  // ../../node_modules/tar/dist/esm/options.js
231994
232032
  var argmap = new Map([
@@ -233564,7 +233602,7 @@ var filesFilter = (opt, files) => {
233564
233602
  if (m !== undefined) {
233565
233603
  ret = m;
233566
233604
  } else {
233567
- ret = mapHas(dirname4(file), root);
233605
+ ret = mapHas(dirname5(file), root);
233568
233606
  }
233569
233607
  }
233570
233608
  map.set(file, ret);
@@ -235243,7 +235281,7 @@ var checkCwd = (dir, cb) => {
235243
235281
  cb(er);
235244
235282
  });
235245
235283
  };
235246
- var mkdir2 = (dir, opt, cb) => {
235284
+ var mkdir3 = (dir, opt, cb) => {
235247
235285
  dir = normalizeWindowsPath(dir);
235248
235286
  const umask = opt.umask ?? 18;
235249
235287
  const mode = opt.mode | 448;
@@ -235788,7 +235826,7 @@ class Unpack extends Parser {
235788
235826
  }
235789
235827
  }
235790
235828
  [MKDIR](dir, mode, cb) {
235791
- mkdir2(normalizeWindowsPath(dir), {
235829
+ mkdir3(normalizeWindowsPath(dir), {
235792
235830
  uid: this.uid,
235793
235831
  gid: this.gid,
235794
235832
  processUid: this.processUid,
@@ -236711,7 +236749,7 @@ async function getSiteUrl() {
236711
236749
  }
236712
236750
  // src/core/project/config.ts
236713
236751
  import { existsSync } from "node:fs";
236714
- import { dirname as dirname10, join as join12 } from "node:path";
236752
+ import { dirname as dirname11, join as join12 } from "node:path";
236715
236753
 
236716
236754
  // src/core/project/fallback.ts
236717
236755
  var DEFAULT_SITE = Object.freeze({
@@ -236780,13 +236818,13 @@ function isPlainObject2(value) {
236780
236818
 
236781
236819
  // src/core/project/plugins.ts
236782
236820
  import { createRequire as createRequire2 } from "node:module";
236783
- import { dirname as dirname5, isAbsolute as isAbsolute2, join as join4, resolve } from "node:path";
236821
+ import { dirname as dirname6, isAbsolute as isAbsolute2, join as join4, resolve } from "node:path";
236784
236822
  function resolvePluginRoot(pluginSource, fromRoot) {
236785
236823
  if (pluginSource.startsWith(".") || isAbsolute2(pluginSource)) {
236786
236824
  return resolve(fromRoot, pluginSource);
236787
236825
  }
236788
236826
  const req = createRequire2(join4(fromRoot, "package.json"));
236789
- return dirname5(req.resolve(`${pluginSource}/package.json`));
236827
+ return dirname6(req.resolve(`${pluginSource}/package.json`));
236790
236828
  }
236791
236829
  function requirePluginNamespace(project, pluginSource, configPath) {
236792
236830
  if (!project.plugin?.namespace) {
@@ -236879,7 +236917,7 @@ async function deleteSingleActor(name) {
236879
236917
  return result.data;
236880
236918
  }
236881
236919
  // src/core/resources/actor/config.ts
236882
- import { basename as basename3, dirname as dirname6, join as join5, relative } from "node:path";
236920
+ import { basename as basename3, dirname as dirname7, join as join5, relative } from "node:path";
236883
236921
  async function readAllActors(actorsDir) {
236884
236922
  if (!await pathExists(actorsDir))
236885
236923
  return [];
@@ -236891,7 +236929,7 @@ async function readAllActors(actorsDir) {
236891
236929
  const actors = [];
236892
236930
  const names = new Set;
236893
236931
  for (const entryPath of entries.sort()) {
236894
- const actorDir = dirname6(entryPath);
236932
+ const actorDir = dirname7(entryPath);
236895
236933
  const name = relative(actorsDir, actorDir).split(/[/\\]/).join("/");
236896
236934
  if (!name) {
236897
236935
  throw new InvalidInputError("entry.ts or entry.js found directly in the actors directory — it must be inside a named subfolder");
@@ -236917,7 +236955,7 @@ async function readAllActors(actorsDir) {
236917
236955
  return actors;
236918
236956
  }
236919
236957
  // src/core/resources/actor/deploy.ts
236920
- import { dirname as dirname7, relative as relative2 } from "node:path";
236958
+ import { dirname as dirname8, relative as relative2 } from "node:path";
236921
236959
  function actorOperationError(name, error) {
236922
236960
  return {
236923
236961
  name,
@@ -236938,7 +236976,7 @@ function describeActorResult(result) {
236938
236976
  async function deployOne(actor) {
236939
236977
  const start = Date.now();
236940
236978
  try {
236941
- const actorDir = dirname7(actor.entryPath);
236979
+ const actorDir = dirname8(actor.entryPath);
236942
236980
  const files = await Promise.all(actor.filePaths.map(async (filePath) => ({
236943
236981
  path: relative2(actorDir, filePath).split(/[/\\]/).join("/"),
236944
236982
  content: await readTextFile(filePath)
@@ -238769,7 +238807,7 @@ async function fetchFunctionLogs(functionName, filters = {}) {
238769
238807
  return result.data;
238770
238808
  }
238771
238809
  // src/core/resources/function/config.ts
238772
- import { basename as basename4, dirname as dirname8, join as join10, relative as relative3, resolve as resolve2 } from "node:path";
238810
+ import { basename as basename4, dirname as dirname9, join as join10, relative as relative3, resolve as resolve2 } from "node:path";
238773
238811
  async function readSharedFiles(functionsDir) {
238774
238812
  const sharedDir = resolve2(functionsDir, "..", "shared");
238775
238813
  if (!await pathExists(sharedDir)) {
@@ -238787,7 +238825,7 @@ async function readFunctionConfig(configPath) {
238787
238825
  }
238788
238826
  async function readFunction(configPath, sharedFiles) {
238789
238827
  const config = await readFunctionConfig(configPath);
238790
- const functionDir = dirname8(configPath);
238828
+ const functionDir = dirname9(configPath);
238791
238829
  const entryPath = join10(functionDir, config.entry);
238792
238830
  if (!await pathExists(entryPath)) {
238793
238831
  throw new InvalidInputError(`Function entry file not found: ${entryPath} (referenced in ${configPath})`, {
@@ -238820,12 +238858,12 @@ async function readAllFunctions(functionsDir) {
238820
238858
  absolute: true,
238821
238859
  ignore: ENTRY_IGNORE_DOT_PATHS
238822
238860
  });
238823
- const configFilesDirs = new Set(configFiles.map((f) => dirname8(f)));
238824
- const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname8(entryFile)));
238861
+ const configFilesDirs = new Set(configFiles.map((f) => dirname9(f)));
238862
+ const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname9(entryFile)));
238825
238863
  const sharedFiles = await readSharedFiles(functionsDir);
238826
238864
  const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath, sharedFiles)));
238827
238865
  const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
238828
- const functionDir = dirname8(entryFile);
238866
+ const functionDir = dirname9(entryFile);
238829
238867
  const filePaths = await globby(BACKEND_FILE_GLOB, {
238830
238868
  cwd: functionDir,
238831
238869
  absolute: true
@@ -238868,9 +238906,9 @@ async function readAllFunctions(functionsDir) {
238868
238906
  return functions;
238869
238907
  }
238870
238908
  // src/core/resources/function/deploy.ts
238871
- import { dirname as dirname9, relative as relative4 } from "node:path";
238909
+ import { dirname as dirname10, relative as relative4 } from "node:path";
238872
238910
  async function loadFunctionCode(fn) {
238873
- const functionDir = dirname9(fn.entryPath);
238911
+ const functionDir = dirname10(fn.entryPath);
238874
238912
  const resolvedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
238875
238913
  const content = await readTextFile(filePath);
238876
238914
  const path = relative4(functionDir, filePath).split(/[/\\]/).join("/");
@@ -239227,7 +239265,7 @@ ${prettifyError(result.error)}`);
239227
239265
  return salvageProjectConfig(parsed, result.error);
239228
239266
  }
239229
239267
  async readProjectResources(configPath, project, includeActors = true) {
239230
- const configDir = dirname10(configPath);
239268
+ const configDir = dirname11(configPath);
239231
239269
  const [
239232
239270
  entities,
239233
239271
  functions,
@@ -239274,7 +239312,7 @@ ${prettifyError(result.error)}`);
239274
239312
  this.pluginSourceByNamespace.set(namespace, source);
239275
239313
  }
239276
239314
  async readPluginConfig(plugin, hostConfigPath) {
239277
- const pluginRoot = resolvePluginRoot(plugin.source, dirname10(hostConfigPath));
239315
+ const pluginRoot = resolvePluginRoot(plugin.source, dirname11(hostConfigPath));
239278
239316
  const { configPath } = await this.findConfigOrThrow(pluginRoot);
239279
239317
  const project = await this.readConfigFile(configPath);
239280
239318
  const namespace = requirePluginNamespace(project, plugin.source, configPath);
@@ -239367,7 +239405,7 @@ function errorMessage(error) {
239367
239405
  // src/core/project/template.ts
239368
239406
  var import_ejs = __toESM(require_ejs(), 1);
239369
239407
  var import_front_matter2 = __toESM(require_front_matter(), 1);
239370
- import { dirname as dirname11, join as join14 } from "node:path";
239408
+ import { dirname as dirname12, join as join14 } from "node:path";
239371
239409
 
239372
239410
  // src/core/assets.ts
239373
239411
  import { cpSync, existsSync as existsSync2 } from "node:fs";
@@ -239376,7 +239414,7 @@ import { join as join13 } from "node:path";
239376
239414
  // package.json
239377
239415
  var package_default = {
239378
239416
  name: "base44",
239379
- version: "0.2.1",
239417
+ version: "0.2.2",
239380
239418
  description: "Base44 CLI - Unified interface for managing Base44 applications",
239381
239419
  type: "module",
239382
239420
  bin: {
@@ -239530,7 +239568,7 @@ async function renderTemplate(template, destPath, data, options = {}) {
239530
239568
  if (file.endsWith(".ejs")) {
239531
239569
  const rendered = await import_ejs.default.renderFile(srcPath, data);
239532
239570
  const { attributes, body } = import_front_matter2.default(rendered);
239533
- const destFile = attributes.outputFileName ? join14(dirname11(file), attributes.outputFileName) : file.replace(/\.ejs$/, "");
239571
+ const destFile = attributes.outputFileName ? join14(dirname12(file), attributes.outputFileName) : file.replace(/\.ejs$/, "");
239534
239572
  const destFilePath = join14(destPath, destFile);
239535
239573
  if (skipExisting && await pathExists(destFilePath)) {
239536
239574
  skipped.push(destFile);
@@ -239748,7 +239786,7 @@ import { readFile as readFile3 } from "node:fs/promises";
239748
239786
  import { join as join18 } from "node:path";
239749
239787
 
239750
239788
  // src/core/site/modules.ts
239751
- import { stat } from "node:fs/promises";
239789
+ import { stat as stat2 } from "node:fs/promises";
239752
239790
  import { relative as relative5, resolve as resolve3, sep } from "node:path";
239753
239791
  var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
239754
239792
  var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
@@ -239823,7 +239861,7 @@ async function collectModules(config) {
239823
239861
  const modules = [...modulesByName.values()];
239824
239862
  let totalBytes = 0;
239825
239863
  for (const module of modules) {
239826
- module.size = (await stat(module.absolutePath)).size;
239864
+ module.size = (await stat2(module.absolutePath)).size;
239827
239865
  totalBytes += module.size;
239828
239866
  }
239829
239867
  if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
@@ -239843,7 +239881,7 @@ function addSourcemap(modulesByName, configDir, name) {
239843
239881
  }
239844
239882
 
239845
239883
  // src/core/site/wrangler-config.ts
239846
- import { dirname as dirname12, join as join16, resolve as resolve4 } from "node:path";
239884
+ import { dirname as dirname13, join as join16, resolve as resolve4 } from "node:path";
239847
239885
  var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
239848
239886
  var RedirectConfigSchema = looseObject({
239849
239887
  configPath: string2().min(1)
@@ -239880,7 +239918,7 @@ async function resolveWranglerConfig(redirectPath) {
239880
239918
  if (config.no_bundle !== true) {
239881
239919
  throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
239882
239920
  }
239883
- const configDir = dirname12(configPath);
239921
+ const configDir = dirname13(configPath);
239884
239922
  const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
239885
239923
  return {
239886
239924
  configPath,
@@ -239903,7 +239941,7 @@ async function resolveRedirectedConfigPath(redirectPath) {
239903
239941
  if (!result.success) {
239904
239942
  throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
239905
239943
  }
239906
- const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
239944
+ const configPath = resolve4(dirname13(redirectPath), result.data.configPath);
239907
239945
  if (!await pathExists(configPath)) {
239908
239946
  throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
239909
239947
  hints: [{ message: "Rebuild the project to regenerate the artifact" }]
@@ -239938,7 +239976,7 @@ async function resolveFullStackBuild(projectRoot) {
239938
239976
  // src/core/site/manifest.ts
239939
239977
  import { createHash } from "node:crypto";
239940
239978
  import { createReadStream } from "node:fs";
239941
- import { stat as stat2 } from "node:fs/promises";
239979
+ import { stat as stat3 } from "node:fs/promises";
239942
239980
  import { basename as basename5, extname, join as join17 } from "node:path";
239943
239981
 
239944
239982
  // ../../node_modules/p-map/index.js
@@ -240121,7 +240159,7 @@ async function describeBuildOutput(outputDir) {
240121
240159
  const relativePaths = await walkBuildOutput(outputDir);
240122
240160
  return await pMap(relativePaths, async (path) => {
240123
240161
  const absolutePath = join17(outputDir, ...path.split("/"));
240124
- return { path, absolutePath, size: (await stat2(absolutePath)).size };
240162
+ return { path, absolutePath, size: (await stat3(absolutePath)).size };
240125
240163
  }, { concurrency: STAT_CONCURRENCY });
240126
240164
  }
240127
240165
  async function hashFileInto(hash, absolutePath) {
@@ -247001,14 +247039,14 @@ function publishesFromBuilder(error) {
247001
247039
  return body?.error?.code === "git_commit_hash_not_supported";
247002
247040
  }
247003
247041
  // src/core/project/target.ts
247004
- import { dirname as dirname13, join as join19, resolve as resolve6 } from "node:path";
247042
+ import { dirname as dirname14, join as join19, resolve as resolve6 } from "node:path";
247005
247043
  async function resolveBuildTarget(projectRoot, overrides = {}) {
247006
247044
  const project = await readSettingsIfPresent(projectRoot);
247007
247045
  const root = project?.root ?? projectRoot ?? process.cwd();
247008
247046
  const site = project ? siteOrDefault(project) : DEFAULT_SITE;
247009
247047
  return {
247010
247048
  root,
247011
- configDir: project ? dirname13(project.configPath) : join19(root, PROJECT_SUBDIR),
247049
+ configDir: project ? dirname14(project.configPath) : join19(root, PROJECT_SUBDIR),
247012
247050
  buildCommand: site.buildCommand,
247013
247051
  outputDir: resolve6(root, overrides.outputDir ?? site.outputDirectory ?? DEFAULT_SITE.outputDirectory),
247014
247052
  entitiesDir: project?.entitiesDir ?? "entities",
@@ -247878,7 +247916,7 @@ function getActorsCommand() {
247878
247916
  }
247879
247917
 
247880
247918
  // src/cli/commands/agent-skills/pull.ts
247881
- import { dirname as dirname14, join as join20 } from "node:path";
247919
+ import { dirname as dirname15, join as join20 } from "node:path";
247882
247920
  // src/core/utils/dependencies.ts
247883
247921
  import { spawnSync as spawnSync2 } from "node:child_process";
247884
247922
  function verifyDenoInstalled(context) {
@@ -247967,7 +248005,7 @@ async function pullAction({
247967
248005
  runTask
247968
248006
  }) {
247969
248007
  const { project } = await readProjectConfig();
247970
- const dir = join20(dirname14(project.configPath), project.agentSkillsDir);
248008
+ const dir = join20(dirname15(project.configPath), project.agentSkillsDir);
247971
248009
  const remote = await runTask("Fetching agent skills from Base44", () => fetchAgentSkills(), {
247972
248010
  successMessage: "Agent skills fetched successfully",
247973
248011
  errorMessage: "Failed to fetch agent skills"
@@ -248023,13 +248061,13 @@ function getAgentSkillsCommand() {
248023
248061
  }
248024
248062
 
248025
248063
  // src/cli/commands/agents/pull.ts
248026
- import { dirname as dirname15, join as join21 } from "node:path";
248064
+ import { dirname as dirname16, join as join21 } from "node:path";
248027
248065
  async function pullAgentsAction({
248028
248066
  log,
248029
248067
  runTask
248030
248068
  }) {
248031
248069
  const { project } = await readProjectConfig();
248032
- const configDir = dirname15(project.configPath);
248070
+ const configDir = dirname16(project.configPath);
248033
248071
  const agentsDir = join21(configDir, project.agentsDir);
248034
248072
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
248035
248073
  return await fetchAgents();
@@ -249605,7 +249643,7 @@ function redactedApiError(apiError, raw, method, path, retryAfter) {
249605
249643
  });
249606
249644
  }
249607
249645
  // src/core/api-spec/spec.ts
249608
- import { rename, rm, stat as stat3 } from "node:fs/promises";
249646
+ import { rename, rm, stat as stat4 } from "node:fs/promises";
249609
249647
  import { join as join22 } from "node:path";
249610
249648
  var SPEC_CACHE_TTL_MS = 60 * 60 * 1000;
249611
249649
  function getSpecCachePath(apiUrl = getBase44ApiUrl()) {
@@ -249631,7 +249669,7 @@ function parseSpec(text) {
249631
249669
  var SPEC_DOWNLOAD_TIMEOUT_MS = 60000;
249632
249670
  async function readFreshCache(path) {
249633
249671
  try {
249634
- const { mtimeMs } = await stat3(path);
249672
+ const { mtimeMs } = await stat4(path);
249635
249673
  if (!isSpecCacheFresh(mtimeMs)) {
249636
249674
  return null;
249637
249675
  }
@@ -249960,11 +249998,11 @@ function getApiCommand() {
249960
249998
  }
249961
249999
 
249962
250000
  // src/cli/commands/auth/password-login.ts
249963
- import { dirname as dirname16, join as join23 } from "node:path";
250001
+ import { dirname as dirname17, join as join23 } from "node:path";
249964
250002
  async function passwordLoginAction({ log, runTask }, action) {
249965
250003
  const shouldEnable = action === "enable";
249966
250004
  const { project } = await readProjectConfig();
249967
- const configDir = dirname16(project.configPath);
250005
+ const configDir = dirname17(project.configPath);
249968
250006
  const authDir = join23(configDir, project.authDir);
249969
250007
  const updated = await runTask("Updating local auth config", async () => {
249970
250008
  const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
@@ -249985,13 +250023,13 @@ function getPasswordLoginCommand() {
249985
250023
  }
249986
250024
 
249987
250025
  // src/cli/commands/auth/pull.ts
249988
- import { dirname as dirname17, join as join24 } from "node:path";
250026
+ import { dirname as dirname18, join as join24 } from "node:path";
249989
250027
  async function pullAuthAction({
249990
250028
  log,
249991
250029
  runTask
249992
250030
  }) {
249993
250031
  const { project } = await readProjectConfig();
249994
- const configDir = dirname17(project.configPath);
250032
+ const configDir = dirname18(project.configPath);
249995
250033
  const authDir = join24(configDir, project.authDir);
249996
250034
  const remoteConfig = await runTask("Fetching auth config from Base44", async () => {
249997
250035
  return await pullAuthConfig();
@@ -250056,7 +250094,7 @@ function getAuthPushCommand() {
250056
250094
  }
250057
250095
 
250058
250096
  // src/cli/commands/auth/social-login.ts
250059
- import { dirname as dirname18, join as join25, resolve as resolve7 } from "node:path";
250097
+ import { dirname as dirname19, join as join25, resolve as resolve7 } from "node:path";
250060
250098
  var PROVIDER_LABELS = {
250061
250099
  google: "Google",
250062
250100
  microsoft: "Microsoft",
@@ -250126,7 +250164,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask }, provider, a
250126
250164
  }
250127
250165
  }
250128
250166
  const { project } = await readProjectConfig();
250129
- const configDir = dirname18(project.configPath);
250167
+ const configDir = dirname19(project.configPath);
250130
250168
  const authDir = join25(configDir, project.authDir);
250131
250169
  const { config: updated } = await runTask("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
250132
250170
  if (clientSecret) {
@@ -250152,7 +250190,7 @@ function getSocialLoginCommand() {
250152
250190
  }
250153
250191
 
250154
250192
  // src/cli/commands/auth/sso.ts
250155
- import { dirname as dirname19, join as join26, resolve as resolve8 } from "node:path";
250193
+ import { dirname as dirname20, join as join26, resolve as resolve8 } from "node:path";
250156
250194
  var SSOConfigFileSchema = object({
250157
250195
  provider: _enum(Object.values(KNOWN_SSO_PROVIDERS)),
250158
250196
  clientId: string2(),
@@ -250315,7 +250353,7 @@ async function ssoEnableAction({ isNonInteractive, runTask }, options) {
250315
250353
  throw error;
250316
250354
  }
250317
250355
  const { project } = await readProjectConfig();
250318
- const configDir = dirname19(project.configPath);
250356
+ const configDir = dirname20(project.configPath);
250319
250357
  const authDir = join26(configDir, project.authDir);
250320
250358
  await runTask("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
250321
250359
  await runTask("Saving SSO credentials", async () => pushSSOSecrets(secrets));
@@ -250331,7 +250369,7 @@ async function ssoDisableAction({ log, runTask }, options) {
250331
250369
  throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
250332
250370
  }
250333
250371
  const { project } = await readProjectConfig();
250334
- const configDir = dirname19(project.configPath);
250372
+ const configDir = dirname20(project.configPath);
250335
250373
  const authDir = join26(configDir, project.authDir);
250336
250374
  const updated = await runTask("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
250337
250375
  await runTask("Removing SSO credentials", async () => deleteSSOSecrets());
@@ -250955,7 +250993,7 @@ var baseOpen = async (options) => {
250955
250993
  });
250956
250994
  });
250957
250995
  };
250958
- var open = (target, options) => {
250996
+ var open2 = (target, options) => {
250959
250997
  if (typeof target !== "string") {
250960
250998
  throw new TypeError("Expected a `target`");
250961
250999
  }
@@ -251024,7 +251062,7 @@ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
251024
251062
  defineLazyProperty(apps, "safari", () => detectPlatformBinary({
251025
251063
  darwin: "Safari"
251026
251064
  }));
251027
- var open_default = open;
251065
+ var open_default = open2;
251028
251066
 
251029
251067
  // src/cli/commands/connectors/oauth-prompt.ts
251030
251068
  var POLL_INTERVAL_MS = 2000;
@@ -251214,13 +251252,13 @@ function getConnectorsListAvailableCommand() {
251214
251252
  }
251215
251253
 
251216
251254
  // src/cli/commands/connectors/pull.ts
251217
- import { dirname as dirname20, join as join27, resolve as resolve9 } from "node:path";
251255
+ import { dirname as dirname21, join as join27, resolve as resolve9 } from "node:path";
251218
251256
  async function resolveConnectorsDir(options) {
251219
251257
  if (!getAppContext().projectRoot) {
251220
251258
  return resolve9(options.dir ?? "connectors");
251221
251259
  }
251222
251260
  const { project } = await readProjectConfig();
251223
- return join27(dirname20(project.configPath), project.connectorsDir);
251261
+ return join27(dirname21(project.configPath), project.connectorsDir);
251224
251262
  }
251225
251263
  async function pullConnectorsAction({ log, runTask, jsonMode }, options) {
251226
251264
  const connectorsDir = await resolveConnectorsDir(options);
@@ -251607,10 +251645,10 @@ function getListCommand() {
251607
251645
  }
251608
251646
 
251609
251647
  // src/cli/commands/functions/pull.ts
251610
- import { dirname as dirname21, join as join28 } from "node:path";
251648
+ import { dirname as dirname22, join as join28 } from "node:path";
251611
251649
  async function pullFunctionsAction({ log, runTask }, name) {
251612
251650
  const { project, functions } = await readProjectConfig();
251613
- const configDir = dirname21(project.configPath);
251651
+ const configDir = dirname22(project.configPath);
251614
251652
  const functionsDir = join28(configDir, project.functionsDir);
251615
251653
  const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
251616
251654
  const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
@@ -252235,10 +252273,8 @@ async function link(ctx, options, command) {
252235
252273
  let finalAppId;
252236
252274
  const action = appId ? "choose" : options.create ? "create" : await promptForLinkAction();
252237
252275
  if (action === "choose") {
252238
- let linkedAppId;
252239
- if (appId && hasWorkspaceApiKeyAuth()) {
252240
- linkedAppId = appId;
252241
- } else {
252276
+ let linkedAppId = appId;
252277
+ if (!linkedAppId) {
252242
252278
  const projects = await runTask("Fetching projects...", async () => listProjects(), {
252243
252279
  successMessage: "Projects fetched",
252244
252280
  errorMessage: "Failed to fetch projects"
@@ -252246,23 +252282,7 @@ async function link(ctx, options, command) {
252246
252282
  if (!projects.length) {
252247
252283
  return { outroMessage: "No projects available for linking" };
252248
252284
  }
252249
- if (appId) {
252250
- const project = projects.find((p) => p.id === appId);
252251
- if (!project) {
252252
- throw new InvalidInputError(`App with ID "${appId}" not found.`, {
252253
- hints: [
252254
- { message: "Check the app ID is correct" },
252255
- {
252256
- message: "Use 'base44 link' without --app-id to see available projects"
252257
- }
252258
- ]
252259
- });
252260
- }
252261
- linkedAppId = appId;
252262
- } else {
252263
- const selectedProject = await promptForExistingProject(projects);
252264
- linkedAppId = selectedProject.id;
252265
- }
252285
+ linkedAppId = (await promptForExistingProject(projects)).id;
252266
252286
  }
252267
252287
  await runTask("Linking project...", async () => {
252268
252288
  await writeAppConfig(projectRoot.root, linkedAppId);
@@ -252842,7 +252862,7 @@ import { createHash as createHash3 } from "node:crypto";
252842
252862
  import { join as join30, resolve as resolve14 } from "node:path";
252843
252863
 
252844
252864
  // src/core/version/actors.ts
252845
- import { dirname as dirname22, relative as relative7, resolve as resolve13 } from "node:path";
252865
+ import { dirname as dirname23, relative as relative7, resolve as resolve13 } from "node:path";
252846
252866
 
252847
252867
  // ../functions-compiler/src/assembly.ts
252848
252868
  import path17 from "node:path";
@@ -264097,7 +264117,7 @@ async function readSharedFiles2(actorsDir) {
264097
264117
  return files;
264098
264118
  }
264099
264119
  async function compilerInput2(actor, shared) {
264100
- const actorDir = dirname22(actor.entryPath);
264120
+ const actorDir = dirname23(actor.entryPath);
264101
264121
  const entry = `${ACTORS_ROOT}/${actor.name}/entry.ts`;
264102
264122
  const source = await readTextFile(actor.entryPath);
264103
264123
  const candidates = { ...shared };
@@ -265682,7 +265702,7 @@ function getWorkspaceCommand() {
265682
265702
  // src/cli/dev/dev-server/main.ts
265683
265703
  var import_cors = __toESM(require_lib4(), 1);
265684
265704
  var import_express6 = __toESM(require_express(), 1);
265685
- import { dirname as dirname28, join as join39 } from "node:path";
265705
+ import { dirname as dirname29, join as join39 } from "node:path";
265686
265706
 
265687
265707
  // ../../node_modules/get-port/index.js
265688
265708
  import net from "node:net";
@@ -265812,7 +265832,7 @@ var $tmpName = promisify12(tmp.tmpName);
265812
265832
 
265813
265833
  // src/cli/dev/dev-server/function-manager.ts
265814
265834
  import { spawn as spawn3 } from "node:child_process";
265815
- import { dirname as dirname25, join as join35 } from "node:path";
265835
+ import { dirname as dirname26, join as join35 } from "node:path";
265816
265836
  import { pathToFileURL as pathToFileURL6 } from "node:url";
265817
265837
 
265818
265838
  // src/cli/dev/dev-server/base-function-manager.ts
@@ -265917,7 +265937,7 @@ class FunctionManager extends BaseFunctionManager {
265917
265937
  }
265918
265938
  spawnFunction(func, port) {
265919
265939
  this.logger.log(`Spawning function "${func.name}" on port ${port}`);
265920
- const importMapPath = join35(dirname25(this.wrapperPath), "import-map.json");
265940
+ const importMapPath = join35(dirname26(this.wrapperPath), "import-map.json");
265921
265941
  const process2 = spawn3("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
265922
265942
  env: {
265923
265943
  ...globalThis.process.env,
@@ -267651,11 +267671,11 @@ import { relative as relative11 } from "node:path";
267651
267671
  // ../../node_modules/chokidar/index.js
267652
267672
  import { EventEmitter as EventEmitter3 } from "node:events";
267653
267673
  import { stat as statcb, Stats } from "node:fs";
267654
- import { readdir as readdir3, stat as stat7 } from "node:fs/promises";
267674
+ import { readdir as readdir3, stat as stat8 } from "node:fs/promises";
267655
267675
  import * as sp3 from "node:path";
267656
267676
 
267657
267677
  // ../../node_modules/readdirp/index.js
267658
- import { lstat as lstat2, readdir as readdir2, realpath, stat as stat5 } from "node:fs/promises";
267678
+ import { lstat as lstat2, readdir as readdir2, realpath, stat as stat6 } from "node:fs/promises";
267659
267679
  import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
267660
267680
  import { Readable as Readable6 } from "node:stream";
267661
267681
  var EntryTypes = {
@@ -267737,7 +267757,7 @@ class ReaddirpStream extends Readable6 {
267737
267757
  const { root, type } = opts;
267738
267758
  this._fileFilter = normalizeFilter(opts.fileFilter);
267739
267759
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
267740
- const statMethod = opts.lstat ? lstat2 : stat5;
267760
+ const statMethod = opts.lstat ? lstat2 : stat6;
267741
267761
  if (wantBigintFsStats) {
267742
267762
  this._stat = (path) => statMethod(path, { bigint: true });
267743
267763
  } else {
@@ -267890,7 +267910,7 @@ function readdirp(root, options = {}) {
267890
267910
 
267891
267911
  // ../../node_modules/chokidar/handler.js
267892
267912
  import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
267893
- import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat6 } from "node:fs/promises";
267913
+ import { realpath as fsrealpath, lstat as lstat3, open as open3, stat as stat7 } from "node:fs/promises";
267894
267914
  import { type as osType } from "node:os";
267895
267915
  import * as sp2 from "node:path";
267896
267916
  var STR_DATA = "data";
@@ -267916,7 +267936,7 @@ var EVENTS = {
267916
267936
  };
267917
267937
  var EV = EVENTS;
267918
267938
  var THROTTLE_MODE_WATCH = "watch";
267919
- var statMethods = { lstat: lstat3, stat: stat6 };
267939
+ var statMethods = { lstat: lstat3, stat: stat7 };
267920
267940
  var KEY_LISTENERS = "listeners";
267921
267941
  var KEY_ERR = "errHandlers";
267922
267942
  var KEY_RAW = "rawEmitters";
@@ -268266,7 +268286,7 @@ var setFsWatchListener = (path, fullPath, options, handlers) => {
268266
268286
  cont.watcherUnusable = true;
268267
268287
  if (isWindows4 && error.code === "EPERM") {
268268
268288
  try {
268269
- const fd = await open2(path, "r");
268289
+ const fd = await open3(path, "r");
268270
268290
  await fd.close();
268271
268291
  broadcastErr(error);
268272
268292
  } catch (err) {}
@@ -268387,7 +268407,7 @@ class NodeFsHandler {
268387
268407
  return;
268388
268408
  if (!newStats || newStats.mtimeMs === 0) {
268389
268409
  try {
268390
- const newStats = await stat6(file);
268410
+ const newStats = await stat7(file);
268391
268411
  if (this.fsw.closed)
268392
268412
  return;
268393
268413
  const at = newStats.atimeMs;
@@ -269059,7 +269079,7 @@ class FSWatcher extends EventEmitter3 {
269059
269079
  const fullPath = opts.cwd ? sp3.join(opts.cwd, path) : path;
269060
269080
  let stats;
269061
269081
  try {
269062
- stats = await stat7(fullPath);
269082
+ stats = await stat8(fullPath);
269063
269083
  } catch (err) {}
269064
269084
  if (!stats || this.closed)
269065
269085
  return;
@@ -269443,8 +269463,8 @@ async function createDevServer(options) {
269443
269463
  broadcastEntityEvent(io, appId, entityName, event);
269444
269464
  };
269445
269465
  const base44ConfigWatcher = new WatchBase44({
269446
- functions: join39(dirname28(project.configPath), project.functionsDir),
269447
- entities: join39(dirname28(project.configPath), project.entitiesDir)
269466
+ functions: join39(dirname29(project.configPath), project.functionsDir),
269467
+ entities: join39(dirname29(project.configPath), project.entitiesDir)
269448
269468
  }, devLogger);
269449
269469
  base44ConfigWatcher.on("change", async (name) => {
269450
269470
  try {
@@ -269974,7 +269994,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
269974
269994
  import { release, type } from "node:os";
269975
269995
 
269976
269996
  // ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
269977
- import { dirname as dirname29, posix, sep as sep2 } from "path";
269997
+ import { dirname as dirname30, posix, sep as sep2 } from "path";
269978
269998
  function createModulerModifier() {
269979
269999
  const getModuleFromFileName = createGetModuleFromFilename();
269980
270000
  return async (frames) => {
@@ -269983,7 +270003,7 @@ function createModulerModifier() {
269983
270003
  return frames;
269984
270004
  };
269985
270005
  }
269986
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname29(process.argv[1]) : process.cwd(), isWindows = sep2 === "\\") {
270006
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname30(process.argv[1]) : process.cwd(), isWindows = sep2 === "\\") {
269987
270007
  const normalizedBase = isWindows ? normalizeWindowsPath2(basePath) : basePath;
269988
270008
  return (filename) => {
269989
270009
  if (!filename)
@@ -273972,7 +273992,7 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
273972
273992
  });
273973
273993
  }
273974
273994
  // src/cli/index.ts
273975
- var __dirname4 = dirname30(fileURLToPath7(import.meta.url));
273995
+ var __dirname4 = dirname31(fileURLToPath7(import.meta.url));
273976
273996
  async function runCLI(options) {
273977
273997
  ensureNpmAssets(join41(__dirname4, "../assets"));
273978
273998
  const errorReporter = new ErrorReporter;
@@ -274013,4 +274033,4 @@ export {
274013
274033
  runCLI
274014
274034
  };
274015
274035
 
274016
- //# debugId=F783DE574A8FAE3D64756E2164756E21
274036
+ //# debugId=CDAE7E45DF6E559064756E2164756E21