@base44-preview/cli 0.1.32-pr.663.7602773 → 0.1.32-pr.663.d960536

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
@@ -249497,7 +249497,7 @@ function getApiCatalogCommand() {
249497
249497
  return new Base44Command("catalog", {
249498
249498
  requireAuth: false,
249499
249499
  requireAppContext: false
249500
- }).description("List the API's areas, or every operation in one area (same areas as the MCP bridge)").argument("[area]", 'An area from the list, e.g. "workflows"').option("--refresh", REFRESH_OPTION_HELP).action(catalogAction);
249500
+ }).description("List the API's areas, or every operation in one area").argument("[area]", 'An area from the list, e.g. "workflows"').option("--refresh", REFRESH_OPTION_HELP).action(catalogAction);
249501
249501
  }
249502
249502
 
249503
249503
  // src/cli/commands/api/fetch.ts
@@ -254959,6 +254959,12 @@ var deno2 = Object.freeze({
254959
254959
  });
254960
254960
  globalThis.Deno = deno2;
254961
254961
  globalThis.Buffer = Buffer2;
254962
+ try {
254963
+ new AsyncLocalStorage().enterWith(void 0);
254964
+ } catch {
254965
+ AsyncLocalStorage.prototype.enterWith = () => {
254966
+ };
254967
+ }
254962
254968
  function getRegisteredHandler() {
254963
254969
  return registeredHandler;
254964
254970
  }
@@ -257924,7 +257930,7 @@ var TELEMETRY_PATCH = [
257924
257930
  var TELEMETRY_STORE_FIELDS = "reqId: crypto.randomUUID(), respondedAt: null, inflight: new Map(), inflightTotal: 0, hadRejection: false, hadNonOk: false, logBudget: 5";
257925
257931
 
257926
257932
  // ../functions-compiler/src/version.ts
257927
- var COMPILER_VERSION = "0.1.7";
257933
+ var COMPILER_VERSION = "0.1.8";
257928
257934
 
257929
257935
  // ../functions-compiler/src/worker-entry.ts
257930
257936
  function denoShimSource() {
@@ -262548,6 +262554,174 @@ function runtimeVirtualPlugin() {
262548
262554
  };
262549
262555
  }
262550
262556
 
262557
+ // ../functions-compiler/src/esbuild/ws-native-virtual.ts
262558
+ var NAMESPACE4 = "base44-ws-native";
262559
+ var WS_SPECIFIER = /^(npm:)?ws(@[^/]+)?$/;
262560
+ var ADAPTER = `"use strict";
262561
+ const toBuffer = (value) => (globalThis.Buffer ? globalThis.Buffer.from(value) : value);
262562
+ const READY_STATES = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
262563
+ const later = (fn, ...args) => queueMicrotask(() => fn(...args));
262564
+ const upgradeHeaders = (options) => {
262565
+ const headers = new Headers(options?.headers);
262566
+ for (const name of headers.keys()) if (name !== "user-agent") return headers;
262567
+ return null;
262568
+ };
262569
+ class WebSocket {
262570
+ static CONNECTING = 0;
262571
+ static OPEN = 1;
262572
+ static CLOSING = 2;
262573
+ static CLOSED = 3;
262574
+ #socket = null;
262575
+ #state = 0;
262576
+ #url;
262577
+ #closeRequested = null;
262578
+ #terminated = false;
262579
+ #listeners = new Map();
262580
+ constructor(address, protocols, options) {
262581
+ if (protocols && typeof protocols === "object" && !Array.isArray(protocols)) {
262582
+ options = protocols;
262583
+ protocols = undefined;
262584
+ }
262585
+ this.#url = String(address);
262586
+ const headers = upgradeHeaders(options);
262587
+ if (headers) {
262588
+ this.#upgrade(headers, protocols);
262589
+ } else {
262590
+ this.#attach(new globalThis.WebSocket(this.#url, protocols));
262591
+ }
262592
+ }
262593
+ get readyState() {
262594
+ if (this.#terminated) return 3;
262595
+ return this.#socket ? this.#socket.readyState : this.#state;
262596
+ }
262597
+ get url() { return this.#url; }
262598
+ get protocol() { return this.#socket ? this.#socket.protocol ?? "" : ""; }
262599
+ on(name, listener) { return this.#add(name, listener, false); }
262600
+ addListener(name, listener) { return this.#add(name, listener, false); }
262601
+ once(name, listener) { return this.#add(name, listener, true); }
262602
+ off(name, listener) { return this.removeListener(name, listener); }
262603
+ removeListener(name, listener) {
262604
+ const listeners = this.#listeners.get(name);
262605
+ if (listeners) this.#listeners.set(name, listeners.filter((entry) => entry.listener !== listener));
262606
+ return this;
262607
+ }
262608
+ removeAllListeners(name) {
262609
+ if (name === undefined) this.#listeners.clear();
262610
+ else this.#listeners.delete(name);
262611
+ return this;
262612
+ }
262613
+ emit(name, ...args) {
262614
+ const listeners = this.#listeners.get(name) ?? [];
262615
+ this.#listeners.set(name, listeners.filter((entry) => !entry.once));
262616
+ for (const entry of listeners) entry.listener.apply(this, args);
262617
+ return listeners.length > 0;
262618
+ }
262619
+ send(data, options, callback) {
262620
+ const done = typeof options === "function" ? options : callback;
262621
+ try {
262622
+ if (!this.#socket) {
262623
+ throw new Error("WebSocket is not open: readyState " + this.#state + " (" + READY_STATES[this.#state] + ")");
262624
+ }
262625
+ this.#socket.send(data);
262626
+ done?.();
262627
+ } catch (error) {
262628
+ if (!done) throw error;
262629
+ done(error);
262630
+ }
262631
+ }
262632
+ close(code, reason) {
262633
+ if (this.#socket) this.#socket.close(code, reason);
262634
+ else if (this.#state === 0) {
262635
+ // Upgrade still in flight: close as soon as it lands.
262636
+ this.#closeRequested = [code, reason];
262637
+ this.#state = 2;
262638
+ }
262639
+ }
262640
+ // \`ws\` tears the connection down at once. workerd has no abrupt close, so the
262641
+ // socket is closed normally and "close" is reported now, not on the reply.
262642
+ terminate() {
262643
+ if (this.#terminated || this.readyState === 3) return;
262644
+ this.#terminated = true;
262645
+ if (this.#socket) {
262646
+ try { this.#socket.close(); } catch {}
262647
+ } else {
262648
+ // Upgrade still in flight: close it on arrival, without an "open".
262649
+ this.#closeRequested = [];
262650
+ this.#state = 3;
262651
+ }
262652
+ later(() => this.emit("close", 1006, toBuffer("")));
262653
+ }
262654
+ #attach(socket) {
262655
+ this.#socket = socket;
262656
+ try { socket.binaryType = "arraybuffer"; } catch {}
262657
+ socket.addEventListener("open", () => this.emit("open"));
262658
+ socket.addEventListener("message", (event) => {
262659
+ const isBinary = typeof event.data !== "string";
262660
+ this.emit("message", toBuffer(isBinary ? new Uint8Array(event.data) : event.data), isBinary);
262661
+ });
262662
+ socket.addEventListener("error", (event) => this.emit("error", event.error ?? new Error(event.message || "WebSocket error")));
262663
+ socket.addEventListener("close", (event) => {
262664
+ if (!this.#terminated) this.emit("close", event.code, toBuffer(event.reason ?? ""));
262665
+ });
262666
+ }
262667
+ #upgrade(headers, protocols) {
262668
+ headers.set("Upgrade", "websocket");
262669
+ if (protocols) headers.set("Sec-WebSocket-Protocol", [].concat(protocols).join(", "));
262670
+ const httpUrl = this.#url.replace(/^ws(s?):/i, "http$1:");
262671
+ const fail = (error) => {
262672
+ this.#state = 3;
262673
+ if (this.#terminated) return;
262674
+ this.emit("error", error);
262675
+ this.emit("close", 1006, toBuffer(""));
262676
+ };
262677
+ // Two-argument then(): an exception from an "open" listener must not be
262678
+ // reported as a failed upgrade.
262679
+ fetch(httpUrl, { headers }).then((response) => {
262680
+ const socket = response.webSocket;
262681
+ if (!socket) {
262682
+ response.body?.cancel();
262683
+ return fail(new Error("Unexpected server response: " + response.status));
262684
+ }
262685
+ socket.accept();
262686
+ this.#attach(socket);
262687
+ if (this.#closeRequested) return socket.close(...this.#closeRequested);
262688
+ // accept() opens the socket without dispatching an "open" event.
262689
+ this.emit("open");
262690
+ }, fail);
262691
+ }
262692
+ #add(name, listener, once) {
262693
+ const listeners = this.#listeners.get(name) ?? [];
262694
+ listeners.push({ listener, once });
262695
+ this.#listeners.set(name, listeners);
262696
+ return this;
262697
+ }
262698
+ }
262699
+ class WebSocketServer {
262700
+ constructor() {
262701
+ throw new Error("ws WebSocketServer is not available in Base44 functions: a function can open WebSocket connections but cannot listen for them.");
262702
+ }
262703
+ }
262704
+ module.exports = WebSocket;
262705
+ module.exports.WebSocket = WebSocket;
262706
+ module.exports.WebSocketServer = WebSocketServer;
262707
+ module.exports.default = WebSocket;
262708
+ `;
262709
+ function wsNativeVirtualPlugin() {
262710
+ return {
262711
+ name: "base44-ws-native",
262712
+ setup(build) {
262713
+ build.onResolve({ filter: WS_SPECIFIER }, () => ({
262714
+ path: "ws",
262715
+ namespace: NAMESPACE4
262716
+ }));
262717
+ build.onLoad({ filter: /.*/, namespace: NAMESPACE4 }, () => ({
262718
+ contents: ADAPTER,
262719
+ loader: "js"
262720
+ }));
262721
+ }
262722
+ };
262723
+ }
262724
+
262551
262725
  // ../functions-compiler/src/deno-bundle.ts
262552
262726
  async function bundleToModule(prepared, nodeModulesDir = "none") {
262553
262727
  const dir = await mkdtemp(path21.join(tmpdir2(), "b44-bundle-"));
@@ -262571,6 +262745,7 @@ async function bundleToModule(prepared, nodeModulesDir = "none") {
262571
262745
  sourcemap: false,
262572
262746
  logLevel: "silent",
262573
262747
  plugins: [
262748
+ wsNativeVirtualPlugin(),
262574
262749
  nodeBuiltinRequirePlugin(),
262575
262750
  userFilesPlugin(prepared.files, prepared.entry),
262576
262751
  privateDataSourcesVirtualPlugin(),
@@ -272960,4 +273135,4 @@ export {
272960
273135
  runCLI
272961
273136
  };
272962
273137
 
272963
- //# debugId=9595882D8F2B0F6464756E2164756E21
273138
+ //# debugId=6956BED77F56E7A964756E2164756E21