@base44-preview/cli 0.1.1-pr.555.a141166 → 0.1.1-pr.555.c9c117a

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
@@ -20114,7 +20114,7 @@ var require_lodash8 = __commonJS((exports, module) => {
20114
20114
  }
20115
20115
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
20116
20116
  });
20117
- function join14(array2, separator) {
20117
+ function join15(array2, separator) {
20118
20118
  return array2 == null ? "" : nativeJoin.call(array2, separator);
20119
20119
  }
20120
20120
  function last(array2) {
@@ -22046,7 +22046,7 @@ __p += '`;
22046
22046
  lodash.isUndefined = isUndefined;
22047
22047
  lodash.isWeakMap = isWeakMap;
22048
22048
  lodash.isWeakSet = isWeakSet;
22049
- lodash.join = join14;
22049
+ lodash.join = join15;
22050
22050
  lodash.kebabCase = kebabCase;
22051
22051
  lodash.last = last;
22052
22052
  lodash.lastIndexOf = lastIndexOf;
@@ -31158,7 +31158,7 @@ function cleanDoc(doc2) {
31158
31158
  return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
31159
31159
  }
31160
31160
  function replaceEndOfLine(doc2, replacement = literalline) {
31161
- return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join23(replacement, currentDoc.split(`
31161
+ return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join24(replacement, currentDoc.split(`
31162
31162
  `)) : currentDoc);
31163
31163
  }
31164
31164
  function canBreakFn(doc2) {
@@ -31238,7 +31238,7 @@ function indentIfBreak(contents, options) {
31238
31238
  negate: options.negate
31239
31239
  };
31240
31240
  }
31241
- function join23(separator, docs) {
31241
+ function join24(separator, docs) {
31242
31242
  assertDoc(separator);
31243
31243
  assertDocArray(docs);
31244
31244
  const parts = [];
@@ -31949,7 +31949,7 @@ var init_doc = __esm(() => {
31949
31949
  MODE_FLAT = Symbol("MODE_FLAT");
31950
31950
  DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
31951
31951
  builders = {
31952
- join: join23,
31952
+ join: join24,
31953
31953
  line,
31954
31954
  softline,
31955
31955
  hardline,
@@ -136863,7 +136863,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
136863
136863
  return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
136864
136864
  }
136865
136865
  function replaceEndOfLine2(doc2, replacement = literalline2) {
136866
- return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join25(replacement, currentDoc.split(`
136866
+ return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join26(replacement, currentDoc.split(`
136867
136867
  `)) : currentDoc);
136868
136868
  }
136869
136869
  function canBreakFn2(doc2) {
@@ -136949,7 +136949,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
136949
136949
  negate: options8.negate
136950
136950
  };
136951
136951
  }
136952
- function join25(separator, docs) {
136952
+ function join26(separator, docs) {
136953
136953
  assertDoc2(separator);
136954
136954
  assertDocArray2(docs);
136955
136955
  const parts = [];
@@ -137614,7 +137614,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
137614
137614
  }
137615
137615
  }
137616
137616
  var builders2 = {
137617
- join: join25,
137617
+ join: join26,
137618
137618
  line: line3,
137619
137619
  softline: softline2,
137620
137620
  hardline: hardline4,
@@ -163947,7 +163947,7 @@ var require_view = __commonJS((exports, module) => {
163947
163947
  var dirname22 = path18.dirname;
163948
163948
  var basename7 = path18.basename;
163949
163949
  var extname2 = path18.extname;
163950
- var join26 = path18.join;
163950
+ var join28 = path18.join;
163951
163951
  var resolve12 = path18.resolve;
163952
163952
  module.exports = View;
163953
163953
  function View(name2, options8) {
@@ -164009,12 +164009,12 @@ var require_view = __commonJS((exports, module) => {
164009
164009
  };
164010
164010
  View.prototype.resolve = function resolve13(dir, file2) {
164011
164011
  var ext = this.ext;
164012
- var path19 = join26(dir, file2);
164012
+ var path19 = join28(dir, file2);
164013
164013
  var stat2 = tryStat(path19);
164014
164014
  if (stat2 && stat2.isFile()) {
164015
164015
  return path19;
164016
164016
  }
164017
- path19 = join26(dir, basename7(file2, ext), "index" + ext);
164017
+ path19 = join28(dir, basename7(file2, ext), "index" + ext);
164018
164018
  stat2 = tryStat(path19);
164019
164019
  if (stat2 && stat2.isFile()) {
164020
164020
  return path19;
@@ -167709,7 +167709,7 @@ var require_send = __commonJS((exports, module) => {
167709
167709
  var Stream2 = __require("stream");
167710
167710
  var util2 = __require("util");
167711
167711
  var extname2 = path18.extname;
167712
- var join26 = path18.join;
167712
+ var join28 = path18.join;
167713
167713
  var normalize2 = path18.normalize;
167714
167714
  var resolve12 = path18.resolve;
167715
167715
  var sep = path18.sep;
@@ -167881,7 +167881,7 @@ var require_send = __commonJS((exports, module) => {
167881
167881
  return res;
167882
167882
  }
167883
167883
  parts = path19.split(sep);
167884
- path19 = normalize2(join26(root2, path19));
167884
+ path19 = normalize2(join28(root2, path19));
167885
167885
  } else {
167886
167886
  if (UP_PATH_REGEXP.test(path19)) {
167887
167887
  debug('malicious path "%s"', path19);
@@ -168021,7 +168021,7 @@ var require_send = __commonJS((exports, module) => {
168021
168021
  return self2.onStatError(err);
168022
168022
  return self2.error(404);
168023
168023
  }
168024
- var p4 = join26(path19, self2._index[i5]);
168024
+ var p4 = join28(path19, self2._index[i5]);
168025
168025
  debug('stat "%s"', p4);
168026
168026
  fs28.stat(p4, function(err2, stat2) {
168027
168027
  if (err2)
@@ -214616,7 +214616,7 @@ var require_buffer_list = __commonJS((exports, module) => {
214616
214616
  }
214617
214617
  }, {
214618
214618
  key: "join",
214619
- value: function join26(s5) {
214619
+ value: function join28(s5) {
214620
214620
  if (this.length === 0)
214621
214621
  return "";
214622
214622
  var p4 = this.head;
@@ -234018,7 +234018,7 @@ function normalizeBase44Env() {
234018
234018
  loadProjectEnvFiles();
234019
234019
 
234020
234020
  // src/cli/index.ts
234021
- import { dirname as dirname26, join as join29 } from "node:path";
234021
+ import { dirname as dirname26, join as join31 } from "node:path";
234022
234022
  import { fileURLToPath as fileURLToPath6 } from "node:url";
234023
234023
 
234024
234024
  // ../../node_modules/@clack/core/dist/index.mjs
@@ -235226,7 +235226,7 @@ var {
235226
235226
  } = import__.default;
235227
235227
 
235228
235228
  // src/cli/commands/agents/pull.ts
235229
- import { dirname as dirname12, join as join14 } from "node:path";
235229
+ import { dirname as dirname12, join as join15 } from "node:path";
235230
235230
  // ../../node_modules/chalk/source/vendor/ansi-styles/index.js
235231
235231
  var ANSI_BACKGROUND_OFFSET = 10;
235232
235232
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
@@ -241895,7 +241895,7 @@ async function getSiteUrl() {
241895
241895
  return result.data.url;
241896
241896
  }
241897
241897
  // src/core/project/config.ts
241898
- import { dirname as dirname10, join as join10 } from "node:path";
241898
+ import { dirname as dirname10, join as join11 } from "node:path";
241899
241899
 
241900
241900
  // src/core/project/plugins.ts
241901
241901
  import { createRequire as createRequire2 } from "node:module";
@@ -243757,6 +243757,10 @@ var RealtimeHandlerConfigSchema = exports_external.object({
243757
243757
  name: exports_external.string().min(1),
243758
243758
  entry: exports_external.string().min(1)
243759
243759
  });
243760
+ var RealtimeHandlerSchemaFileSchema = exports_external.object({
243761
+ inbound: exports_external.unknown().optional(),
243762
+ outbound: exports_external.unknown().optional()
243763
+ });
243760
243764
  var DeployRealtimeHandlerResponseSchema = exports_external.object({
243761
243765
  status: exports_external.enum(["deployed", "unchanged"]),
243762
243766
  handler_name: exports_external.string().optional()
@@ -243764,7 +243768,8 @@ var DeployRealtimeHandlerResponseSchema = exports_external.object({
243764
243768
  var RealtimeHandlerSchema = RealtimeHandlerConfigSchema.extend({
243765
243769
  entryPath: exports_external.string().min(1),
243766
243770
  filePaths: exports_external.array(exports_external.string()).min(1),
243767
- source: ResourceSourceSchema
243771
+ source: ResourceSourceSchema,
243772
+ messageSchema: exports_external.unknown().optional()
243768
243773
  });
243769
243774
 
243770
243775
  // src/core/resources/realtime-handler/api.ts
@@ -243772,7 +243777,7 @@ async function deploySingleRealtimeHandler(name2, payload) {
243772
243777
  const appClient = getAppClient();
243773
243778
  let response;
243774
243779
  try {
243775
- response = await appClient.put(`backend-functions/${encodeURIComponent(name2)}`, { json: payload, timeout: false });
243780
+ response = await appClient.put(`realtime-handlers/${encodeURIComponent(name2)}`, { json: payload, timeout: false });
243776
243781
  } catch (error48) {
243777
243782
  throw await ApiError.fromHttpError(error48, `deploying realtime handler "${name2}"`);
243778
243783
  }
@@ -243783,7 +243788,7 @@ async function deploySingleRealtimeHandler(name2, payload) {
243783
243788
  return result.data;
243784
243789
  }
243785
243790
  // src/core/resources/realtime-handler/config.ts
243786
- import { basename as basename4, dirname as dirname8, relative as relative3 } from "node:path";
243791
+ import { basename as basename4, dirname as dirname8, join as join10, relative as relative3 } from "node:path";
243787
243792
  async function readRealtimeHandler(entryFile, realtimeDir) {
243788
243793
  const handlerDir = dirname8(entryFile);
243789
243794
  const filePaths = await globby("**/*.ts", {
@@ -243801,12 +243806,25 @@ async function readRealtimeHandler(entryFile, realtimeDir) {
243801
243806
  });
243802
243807
  }
243803
243808
  const entry = basename4(entryFile);
243809
+ const schemaPath = join10(handlerDir, "schema.jsonc");
243810
+ let messageSchema;
243811
+ if (await pathExists(schemaPath)) {
243812
+ const parsed = await readJsonFile(schemaPath);
243813
+ const result = RealtimeHandlerSchemaFileSchema.safeParse(parsed);
243814
+ if (result.success) {
243815
+ messageSchema = {
243816
+ inbound: result.data.inbound,
243817
+ outbound: result.data.outbound
243818
+ };
243819
+ }
243820
+ }
243804
243821
  return {
243805
243822
  name: name2,
243806
243823
  entry,
243807
243824
  entryPath: entryFile,
243808
243825
  filePaths,
243809
- source: { type: "project" }
243826
+ source: { type: "project" },
243827
+ messageSchema
243810
243828
  };
243811
243829
  }
243812
243830
  async function readAllRealtimeHandlers(realtimeDir) {
@@ -243933,12 +243951,12 @@ class ProjectConfigReader {
243933
243951
  connectors,
243934
243952
  authConfig
243935
243953
  ] = await Promise.all([
243936
- entityResource.readAll(join10(configDir, project.entitiesDir)),
243937
- functionResource.readAll(join10(configDir, project.functionsDir)),
243938
- realtimeHandlerResource.readAll(join10(configDir, project.realtimeDir)),
243939
- agentResource.readAll(join10(configDir, project.agentsDir)),
243940
- connectorResource.readAll(join10(configDir, project.connectorsDir)),
243941
- authConfigResource.readAll(join10(configDir, project.authDir))
243954
+ entityResource.readAll(join11(configDir, project.entitiesDir)),
243955
+ functionResource.readAll(join11(configDir, project.functionsDir)),
243956
+ realtimeHandlerResource.readAll(join11(configDir, project.realtimeDir)),
243957
+ agentResource.readAll(join11(configDir, project.agentsDir)),
243958
+ connectorResource.readAll(join11(configDir, project.connectorsDir)),
243959
+ authConfigResource.readAll(join11(configDir, project.authDir))
243942
243960
  ]);
243943
243961
  return {
243944
243962
  entities,
@@ -244048,12 +244066,12 @@ async function readProjectConfig(projectRoot) {
244048
244066
  // src/core/project/template.ts
244049
244067
  var import_ejs = __toESM(require_ejs(), 1);
244050
244068
  var import_front_matter = __toESM(require_front_matter(), 1);
244051
- import { dirname as dirname11, join as join12 } from "node:path";
244069
+ import { dirname as dirname11, join as join13 } from "node:path";
244052
244070
 
244053
244071
  // src/core/assets.ts
244054
244072
  import { cpSync, existsSync } from "node:fs";
244055
244073
  import { homedir as homedir2 } from "node:os";
244056
- import { join as join11 } from "node:path";
244074
+ import { join as join12 } from "node:path";
244057
244075
  // package.json
244058
244076
  var package_default = {
244059
244077
  name: "base44",
@@ -244154,18 +244172,18 @@ var package_default = {
244154
244172
  };
244155
244173
 
244156
244174
  // src/core/assets.ts
244157
- var ASSETS_DIR = join11(homedir2(), ".base44", "assets", package_default.version);
244175
+ var ASSETS_DIR = join12(homedir2(), ".base44", "assets", package_default.version);
244158
244176
  function getTemplatesDir() {
244159
- return join11(ASSETS_DIR, "templates");
244177
+ return join12(ASSETS_DIR, "templates");
244160
244178
  }
244161
244179
  function getTemplatesIndexPath() {
244162
- return join11(ASSETS_DIR, "templates", "templates.json");
244180
+ return join12(ASSETS_DIR, "templates", "templates.json");
244163
244181
  }
244164
244182
  function getDenoWrapperPath() {
244165
- return join11(ASSETS_DIR, "deno-runtime", "main.ts");
244183
+ return join12(ASSETS_DIR, "deno-runtime", "main.ts");
244166
244184
  }
244167
244185
  function getExecWrapperPath() {
244168
- return join11(ASSETS_DIR, "deno-runtime", "exec.ts");
244186
+ return join12(ASSETS_DIR, "deno-runtime", "exec.ts");
244169
244187
  }
244170
244188
  function ensureNpmAssets(sourceDir) {
244171
244189
  if (existsSync(ASSETS_DIR))
@@ -244187,7 +244205,7 @@ async function listTemplates() {
244187
244205
  }
244188
244206
  async function renderTemplate(template, destPath, data, options = {}) {
244189
244207
  const { skipExisting = false } = options;
244190
- const templateDir = join12(getTemplatesDir(), template.path);
244208
+ const templateDir = join13(getTemplatesDir(), template.path);
244191
244209
  const files = await globby("**/*", {
244192
244210
  cwd: templateDir,
244193
244211
  dot: true,
@@ -244195,20 +244213,20 @@ async function renderTemplate(template, destPath, data, options = {}) {
244195
244213
  });
244196
244214
  const skipped = [];
244197
244215
  for (const file2 of files) {
244198
- const srcPath = join12(templateDir, file2);
244216
+ const srcPath = join13(templateDir, file2);
244199
244217
  try {
244200
244218
  if (file2.endsWith(".ejs")) {
244201
244219
  const rendered = await import_ejs.default.renderFile(srcPath, data);
244202
244220
  const { attributes, body } = import_front_matter.default(rendered);
244203
- const destFile = attributes.outputFileName ? join12(dirname11(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
244204
- const destFilePath = join12(destPath, destFile);
244221
+ const destFile = attributes.outputFileName ? join13(dirname11(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
244222
+ const destFilePath = join13(destPath, destFile);
244205
244223
  if (skipExisting && await pathExists(destFilePath)) {
244206
244224
  skipped.push(destFile);
244207
244225
  continue;
244208
244226
  }
244209
244227
  await writeFile(destFilePath, body);
244210
244228
  } else {
244211
- const destFilePath = join12(destPath, file2);
244229
+ const destFilePath = join13(destPath, file2);
244212
244230
  if (skipExisting && await pathExists(destFilePath)) {
244213
244231
  skipped.push(file2);
244214
244232
  continue;
@@ -244302,7 +244320,7 @@ async function getSiteFilePaths(outputDir) {
244302
244320
  // src/core/site/deploy.ts
244303
244321
  import { randomUUID } from "node:crypto";
244304
244322
  import { tmpdir } from "node:os";
244305
- import { join as join13 } from "node:path";
244323
+ import { join as join14 } from "node:path";
244306
244324
  async function deploySite(siteOutputDir) {
244307
244325
  if (!await pathExists(siteOutputDir)) {
244308
244326
  throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
@@ -244319,7 +244337,7 @@ async function deploySite(siteOutputDir) {
244319
244337
  ]
244320
244338
  });
244321
244339
  }
244322
- const archivePath = join13(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
244340
+ const archivePath = join14(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
244323
244341
  try {
244324
244342
  await createArchive(siteOutputDir, archivePath);
244325
244343
  return await uploadSite(archivePath);
@@ -251567,7 +251585,7 @@ async function pullAgentsAction({
251567
251585
  }) {
251568
251586
  const { project: project2 } = await readProjectConfig();
251569
251587
  const configDir = dirname12(project2.configPath);
251570
- const agentsDir = join14(configDir, project2.agentsDir);
251588
+ const agentsDir = join15(configDir, project2.agentsDir);
251571
251589
  const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
251572
251590
  return await fetchAgents();
251573
251591
  }, {
@@ -251631,12 +251649,12 @@ function getAgentsCommand() {
251631
251649
  }
251632
251650
 
251633
251651
  // src/cli/commands/auth/password-login.ts
251634
- import { dirname as dirname13, join as join15 } from "node:path";
251652
+ import { dirname as dirname13, join as join16 } from "node:path";
251635
251653
  async function passwordLoginAction({ log, runTask: runTask2 }, action) {
251636
251654
  const shouldEnable = action === "enable";
251637
251655
  const { project: project2 } = await readProjectConfig();
251638
251656
  const configDir = dirname13(project2.configPath);
251639
- const authDir = join15(configDir, project2.authDir);
251657
+ const authDir = join16(configDir, project2.authDir);
251640
251658
  const updated = await runTask2("Updating local auth config", async () => {
251641
251659
  const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
251642
251660
  const merged = { ...current, enableUsernamePassword: shouldEnable };
@@ -251656,14 +251674,14 @@ function getPasswordLoginCommand() {
251656
251674
  }
251657
251675
 
251658
251676
  // src/cli/commands/auth/pull.ts
251659
- import { dirname as dirname14, join as join16 } from "node:path";
251677
+ import { dirname as dirname14, join as join17 } from "node:path";
251660
251678
  async function pullAuthAction({
251661
251679
  log,
251662
251680
  runTask: runTask2
251663
251681
  }) {
251664
251682
  const { project: project2 } = await readProjectConfig();
251665
251683
  const configDir = dirname14(project2.configPath);
251666
- const authDir = join16(configDir, project2.authDir);
251684
+ const authDir = join17(configDir, project2.authDir);
251667
251685
  const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
251668
251686
  return await pullAuthConfig();
251669
251687
  }, {
@@ -251727,7 +251745,7 @@ function getAuthPushCommand() {
251727
251745
  }
251728
251746
 
251729
251747
  // src/cli/commands/auth/social-login.ts
251730
- import { dirname as dirname15, join as join17, resolve as resolve3 } from "node:path";
251748
+ import { dirname as dirname15, join as join18, resolve as resolve3 } from "node:path";
251731
251749
  var PROVIDER_LABELS = {
251732
251750
  google: "Google",
251733
251751
  microsoft: "Microsoft",
@@ -251798,7 +251816,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
251798
251816
  }
251799
251817
  const { project: project2 } = await readProjectConfig();
251800
251818
  const configDir = dirname15(project2.configPath);
251801
- const authDir = join17(configDir, project2.authDir);
251819
+ const authDir = join18(configDir, project2.authDir);
251802
251820
  const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
251803
251821
  if (clientSecret) {
251804
251822
  await runTask2("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
@@ -251823,7 +251841,7 @@ function getSocialLoginCommand() {
251823
251841
  }
251824
251842
 
251825
251843
  // src/cli/commands/auth/sso.ts
251826
- import { dirname as dirname16, join as join18, resolve as resolve4 } from "node:path";
251844
+ import { dirname as dirname16, join as join19, resolve as resolve4 } from "node:path";
251827
251845
  var SSOConfigFileSchema = exports_external.object({
251828
251846
  provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
251829
251847
  clientId: exports_external.string(),
@@ -251987,7 +252005,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
251987
252005
  }
251988
252006
  const { project: project2 } = await readProjectConfig();
251989
252007
  const configDir = dirname16(project2.configPath);
251990
- const authDir = join18(configDir, project2.authDir);
252008
+ const authDir = join19(configDir, project2.authDir);
251991
252009
  await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
251992
252010
  await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
251993
252011
  return {
@@ -252003,7 +252021,7 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
252003
252021
  }
252004
252022
  const { project: project2 } = await readProjectConfig();
252005
252023
  const configDir = dirname16(project2.configPath);
252006
- const authDir = join18(configDir, project2.authDir);
252024
+ const authDir = join19(configDir, project2.authDir);
252007
252025
  const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
252008
252026
  await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
252009
252027
  if (!hasAnyLoginMethod(updated)) {
@@ -252854,13 +252872,13 @@ function getConnectorsListAvailableCommand() {
252854
252872
  }
252855
252873
 
252856
252874
  // src/cli/commands/connectors/pull.ts
252857
- import { dirname as dirname17, join as join19, resolve as resolve5 } from "node:path";
252875
+ import { dirname as dirname17, join as join20, resolve as resolve5 } from "node:path";
252858
252876
  async function resolveConnectorsDir(options) {
252859
252877
  if (!getAppContext().projectRoot) {
252860
252878
  return resolve5(options.dir ?? "connectors");
252861
252879
  }
252862
252880
  const { project: project2 } = await readProjectConfig();
252863
- return join19(dirname17(project2.configPath), project2.connectorsDir);
252881
+ return join20(dirname17(project2.configPath), project2.connectorsDir);
252864
252882
  }
252865
252883
  async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
252866
252884
  const connectorsDir = await resolveConnectorsDir(options);
@@ -253253,11 +253271,11 @@ function getListCommand() {
253253
253271
  }
253254
253272
 
253255
253273
  // src/cli/commands/functions/pull.ts
253256
- import { dirname as dirname18, join as join20 } from "node:path";
253274
+ import { dirname as dirname18, join as join21 } from "node:path";
253257
253275
  async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
253258
253276
  const { project: project2, functions } = await readProjectConfig();
253259
253277
  const configDir = dirname18(project2.configPath);
253260
- const functionsDir = join20(configDir, project2.functionsDir);
253278
+ const functionsDir = join21(configDir, project2.functionsDir);
253261
253279
  const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
253262
253280
  const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
253263
253281
  const { functions: functions2 } = await listDeployedFunctions();
@@ -253320,7 +253338,7 @@ import { basename as basename5, resolve as resolve7 } from "node:path";
253320
253338
  var import_kebabCase = __toESM(require_kebabCase(), 1);
253321
253339
 
253322
253340
  // src/cli/commands/project/scaffold-shared.ts
253323
- import { join as join21 } from "node:path";
253341
+ import { join as join22 } from "node:path";
253324
253342
  var DEFAULT_TEMPLATE_ID = "backend-only";
253325
253343
  async function getTemplateById(templateId) {
253326
253344
  const templates = await listTemplates();
@@ -253379,7 +253397,7 @@ async function completeProjectSetup({
253379
253397
  updateMessage("Building project...");
253380
253398
  await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
253381
253399
  updateMessage("Deploying site...");
253382
- return await deploySite(join21(resolvedPath, outputDirectory));
253400
+ return await deploySite(join22(resolvedPath, outputDirectory));
253383
253401
  }, {
253384
253402
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
253385
253403
  errorMessage: "Failed to deploy site"
@@ -254138,15 +254156,23 @@ function getDeployCommand3() {
254138
254156
  }
254139
254157
 
254140
254158
  // src/cli/commands/realtime/new.ts
254141
- import { dirname as dirname19, join as join22 } from "node:path";
254159
+ import { dirname as dirname19, join as join23 } from "node:path";
254142
254160
  function buildHandlerScaffold(handlerName) {
254143
- return `import { RealtimeHandler, type Conn } from "base44";
254161
+ return `import { RealtimeHandler, type Conn } from "@base44/sdk";
254144
254162
 
254145
- export class ${handlerName} extends RealtimeHandler {
254163
+ interface State {
254164
+ // shared state broadcast to all clients
254165
+ }
254166
+
254167
+ interface Message {
254168
+ // messages sent from clients
254169
+ }
254170
+
254171
+ export class ${handlerName} extends RealtimeHandler<State, Message> {
254146
254172
  handleConnect(conn: Conn) {
254147
254173
  console.log("Connected:", conn.userId);
254148
254174
  }
254149
- handleMessage(conn: Conn, msg: unknown) {
254175
+ handleMessage(conn: Conn, msg: Message) {
254150
254176
  console.log("Message:", msg);
254151
254177
  }
254152
254178
  handleTick() {}
@@ -254156,12 +254182,12 @@ export class ${handlerName} extends RealtimeHandler {
254156
254182
  }
254157
254183
  async function newRealtimeHandlerAction(_ctx, handlerName) {
254158
254184
  const { project: project2 } = await readProjectConfig();
254159
- const realtimeDir = join22(dirname19(project2.configPath), project2.realtimeDir);
254160
- const handlerDir = join22(realtimeDir, handlerName);
254185
+ const realtimeDir = join23(dirname19(project2.configPath), project2.realtimeDir);
254186
+ const handlerDir = join23(realtimeDir, handlerName);
254161
254187
  if (await pathExists(handlerDir)) {
254162
254188
  throw new InvalidInputError(`Realtime handler "${handlerName}" already exists at ${handlerDir}`);
254163
254189
  }
254164
- const entryPath = join22(handlerDir, "entry.ts");
254190
+ const entryPath = join23(handlerDir, "entry.ts");
254165
254191
  await writeFile(entryPath, buildHandlerScaffold(handlerName));
254166
254192
  return {
254167
254193
  outroMessage: `Created realtime handler "${handlerName}" at ${entryPath}`
@@ -254649,6 +254675,7 @@ function getSiteCommand() {
254649
254675
  // src/core/types/generator.ts
254650
254676
  var import_common_tags = __toESM(require_lib2(), 1);
254651
254677
  var import_json_schema_to_typescript = __toESM(require_src3(), 1);
254678
+ import { join as join26 } from "node:path";
254652
254679
  var HEADER2 = import_common_tags.stripIndent`
254653
254680
  // Auto-generated by Base44 CLI - DO NOT EDIT
254654
254681
  // Regenerate with: base44 types generate
@@ -254657,24 +254684,43 @@ var EMPTY_TEMPLATE = import_common_tags.stripIndent`
254657
254684
  // Auto-generated by Base44 CLI - DO NOT EDIT
254658
254685
  // Regenerate with: base44 types
254659
254686
  //
254660
- // No entities, functions, agents, or connectors found in project.
254661
- // Add resources to base44/entities/, base44/functions/, base44/agents/, or base44/connectors/
254687
+ // No entities, functions, agents, connectors, or realtime handlers found in project.
254688
+ // Add resources to base44/entities/, base44/functions/, base44/agents/, base44/connectors/, or base44/realtime/
254662
254689
  // and run \`base44 types generate\` again.
254663
254690
 
254664
254691
  declare module '@base44/sdk' {
254665
254692
  // No types to augment - add resources and regenerate
254666
254693
  }
254667
254694
  `;
254695
+ var SDK_PACKAGE_NAMES = ["@base44/sdk", "@base44-preview/sdk"];
254696
+ async function detectSdkPackageName(projectRoot) {
254697
+ try {
254698
+ const pkg = await readJsonFile(join26(projectRoot, "package.json"));
254699
+ const deps = {
254700
+ ...pkg.dependencies,
254701
+ ...pkg.devDependencies
254702
+ };
254703
+ for (const name2 of SDK_PACKAGE_NAMES) {
254704
+ if (name2 in deps)
254705
+ return name2;
254706
+ }
254707
+ } catch {}
254708
+ return "@base44/sdk";
254709
+ }
254668
254710
  async function generateTypesFile(input) {
254669
254711
  const content = await generateContent(input);
254670
254712
  await writeFile(getTypesOutputPath(input.projectRoot), content);
254671
254713
  }
254672
254714
  async function generateContent(input) {
254673
- const { entities, functions, agents, connectors } = input;
254674
- if (!entities.length && !functions.length && !agents.length && !connectors.length) {
254715
+ const { entities, functions, agents, connectors, realtimeHandlers } = input;
254716
+ const sdkPackage = await detectSdkPackageName(input.projectRoot);
254717
+ if (!entities.length && !functions.length && !agents.length && !connectors.length && !realtimeHandlers.length) {
254675
254718
  return EMPTY_TEMPLATE;
254676
254719
  }
254677
- const entityInterfaces = await Promise.all(entities.map((e8) => compileEntity(e8)));
254720
+ const [entityInterfaces, realtimeRegistryEntries] = await Promise.all([
254721
+ Promise.all(entities.map((e8) => compileEntity(e8))),
254722
+ Promise.all(realtimeHandlers.map((h5) => compileRealtimeHandler(h5)))
254723
+ ]);
254678
254724
  const registryEntries = [
254679
254725
  [
254680
254726
  "EntityTypeRegistry",
@@ -254682,16 +254728,28 @@ async function generateContent(input) {
254682
254728
  ],
254683
254729
  ["FunctionNameRegistry", functions.map((f7) => `"${f7.name}": true;`)],
254684
254730
  ["AgentNameRegistry", agents.map((a5) => `"${a5.name}": true;`)],
254685
- ["ConnectorTypeRegistry", connectors.map((c8) => `"${c8.type}": true;`)]
254731
+ ["ConnectorTypeRegistry", connectors.map((c8) => `"${c8.type}": true;`)],
254732
+ [
254733
+ "RealtimeHandlerNameRegistry",
254734
+ realtimeHandlers.map((h5) => `"${h5.name}": true;`)
254735
+ ],
254736
+ [
254737
+ "RealtimeHandlerRegistry",
254738
+ realtimeHandlers.filter((h5) => h5.messageSchema).map((h5, _10, _arr) => {
254739
+ const idx = realtimeHandlers.indexOf(h5);
254740
+ return `"${h5.name}": ${realtimeRegistryEntries[idx]};`;
254741
+ })
254742
+ ]
254686
254743
  ];
254687
254744
  const registries2 = registryEntries.filter(([, entries]) => entries.length > 0).map(([name2, entries]) => registry2(name2, entries));
254688
254745
  return [
254689
254746
  HEADER2,
254747
+ "export {};",
254690
254748
  entityInterfaces.join(`
254691
254749
 
254692
254750
  `),
254693
254751
  import_common_tags.source`
254694
- declare module '@base44/sdk' {
254752
+ declare module '${sdkPackage}' {
254695
254753
  ${registries2.join(`
254696
254754
 
254697
254755
  `)}
@@ -254719,6 +254777,32 @@ async function compileEntity(entity2) {
254719
254777
  throw new TypeGenerationError(`Failed to generate types for entity "${name2}"`, name2, error48);
254720
254778
  }
254721
254779
  }
254780
+ async function compileRealtimeHandler(handler) {
254781
+ const { messageSchema } = handler;
254782
+ if (!messageSchema)
254783
+ return "{ inbound: unknown; outbound: unknown }";
254784
+ const compileSchema = async (schema11, typeName) => {
254785
+ if (!schema11)
254786
+ return "unknown";
254787
+ try {
254788
+ const ts8 = await import_json_schema_to_typescript.compile(schema11, typeName, {
254789
+ bannerComment: "",
254790
+ additionalProperties: false,
254791
+ strictIndexSignatures: true
254792
+ });
254793
+ const match = ts8.match(/\{([\s\S]*)\}/);
254794
+ return match ? `{
254795
+ ${match[1]}}` : "unknown";
254796
+ } catch {
254797
+ return "unknown";
254798
+ }
254799
+ };
254800
+ const [inbound, outbound] = await Promise.all([
254801
+ compileSchema(messageSchema.inbound, `${handler.name}Inbound`),
254802
+ compileSchema(messageSchema.outbound, `${handler.name}Outbound`)
254803
+ ]);
254804
+ return `{ inbound: ${inbound}; outbound: ${outbound} }`;
254805
+ }
254722
254806
  function registry2(name2, entries) {
254723
254807
  return import_common_tags.source`
254724
254808
  interface ${name2} {
@@ -254731,10 +254815,10 @@ function toPascalCase(name2) {
254731
254815
  return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
254732
254816
  }
254733
254817
  // src/core/types/update-project.ts
254734
- import { join as join25 } from "node:path";
254818
+ import { join as join27 } from "node:path";
254735
254819
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
254736
254820
  async function updateProjectConfig(projectRoot) {
254737
- const tsconfigPath = join25(projectRoot, "tsconfig.json");
254821
+ const tsconfigPath = join27(projectRoot, "tsconfig.json");
254738
254822
  if (!await pathExists(tsconfigPath)) {
254739
254823
  return false;
254740
254824
  }
@@ -254758,14 +254842,15 @@ var TYPES_FILE_PATH = "base44/.types/types.d.ts";
254758
254842
  async function generateTypesAction({
254759
254843
  runTask: runTask2
254760
254844
  }) {
254761
- const { entities, functions, agents, connectors, project: project2 } = await readProjectConfig();
254845
+ const { entities, functions, agents, connectors, realtimeHandlers, project: project2 } = await readProjectConfig();
254762
254846
  await runTask2("Generating types", async () => {
254763
254847
  await generateTypesFile({
254764
254848
  projectRoot: project2.root,
254765
254849
  entities,
254766
254850
  functions,
254767
254851
  agents,
254768
- connectors
254852
+ connectors,
254853
+ realtimeHandlers
254769
254854
  });
254770
254855
  });
254771
254856
  const tsconfigUpdated = await updateProjectConfig(project2.root);
@@ -254785,7 +254870,7 @@ function getTypesCommand() {
254785
254870
  // src/cli/dev/dev-server/main.ts
254786
254871
  var import_cors = __toESM(require_lib4(), 1);
254787
254872
  var import_express6 = __toESM(require_express(), 1);
254788
- import { dirname as dirname24, join as join28 } from "node:path";
254873
+ import { dirname as dirname24, join as join30 } from "node:path";
254789
254874
 
254790
254875
  // ../../node_modules/get-port/index.js
254791
254876
  import net from "node:net";
@@ -258205,8 +258290,8 @@ async function createDevServer(options8) {
258205
258290
  broadcastEntityEvent(io6, appId, entityName, event);
258206
258291
  };
258207
258292
  const base44ConfigWatcher = new WatchBase44({
258208
- functions: join28(dirname24(project2.configPath), project2.functionsDir),
258209
- entities: join28(dirname24(project2.configPath), project2.entitiesDir)
258293
+ functions: join30(dirname24(project2.configPath), project2.functionsDir),
258294
+ entities: join30(dirname24(project2.configPath), project2.entitiesDir)
258210
258295
  }, devLogger);
258211
258296
  base44ConfigWatcher.on("change", async (name2) => {
258212
258297
  try {
@@ -262772,7 +262857,7 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
262772
262857
  // src/cli/index.ts
262773
262858
  var __dirname4 = dirname26(fileURLToPath6(import.meta.url));
262774
262859
  async function runCLI(options8) {
262775
- ensureNpmAssets(join29(__dirname4, "../assets"));
262860
+ ensureNpmAssets(join31(__dirname4, "../assets"));
262776
262861
  const errorReporter = new ErrorReporter;
262777
262862
  errorReporter.registerProcessErrorHandlers();
262778
262863
  const jsonMode = process.argv.includes("--json");
@@ -262811,4 +262896,4 @@ export {
262811
262896
  CLIExitError
262812
262897
  };
262813
262898
 
262814
- //# debugId=D4F8A745D6FBC89164756E2164756E21
262899
+ //# debugId=BE0AB0A4F339A36D64756E2164756E21