statelyai 0.5.1 → 0.5.2

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/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { p as run } from "./cli-D4Id6WsS.mjs";
2
+ import { p as run } from "./cli-DB0A-O4Y.mjs";
3
3
 
4
4
  //#region src/bin.ts
5
5
  run();
@@ -10,7 +10,6 @@ import { promisify } from "node:util";
10
10
  import { Args, Command, Flags, flush, handle, run } from "@oclif/core";
11
11
  import * as crypto from "node:crypto";
12
12
  import * as http from "node:http";
13
- import * as https from "node:https";
14
13
  import os from "node:os";
15
14
  import { StudioApiError, createStatelyClient, getStatelyPragma } from "@statelyai/sdk";
16
15
  import { planSync, pullSync, pushLocalMachineLinks } from "@statelyai/sdk/sync";
@@ -594,33 +593,7 @@ function listen(server, port, host) {
594
593
  }
595
594
  async function fetchEditorHost(input, init) {
596
595
  const url = typeof input === "string" ? new URL(input) : input;
597
- if (!isLocalVizHost(url.toString())) return fetch(url, init);
598
- const body = typeof init?.body === "string" ? init.body : init?.body instanceof URLSearchParams ? init.body.toString() : void 0;
599
- return new Promise((resolve, reject) => {
600
- const request = https.request(url, {
601
- method: init?.method ?? "GET",
602
- headers: init?.headers,
603
- rejectUnauthorized: false
604
- }, (response) => {
605
- const chunks = [];
606
- response.on("data", (chunk) => {
607
- chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
608
- });
609
- response.on("end", () => {
610
- const text = Buffer.concat(chunks).toString("utf8");
611
- resolve({
612
- ok: typeof response.statusCode === "number" && response.statusCode >= 200 && response.statusCode < 300,
613
- status: response.statusCode ?? 0,
614
- async json() {
615
- return JSON.parse(text);
616
- }
617
- });
618
- });
619
- });
620
- request.on("error", reject);
621
- if (body !== void 0) request.write(body);
622
- request.end();
623
- });
596
+ return fetch(url, init);
624
597
  }
625
598
  async function assertEditorHostAvailable(editorUrl) {
626
599
  const baseUrl = normalizedBaseUrl(editorUrl);
@@ -634,16 +607,7 @@ async function assertEditorHostAvailable(editorUrl) {
634
607
  if (response.status === 404) throw new Error(formatEditorHostError(baseUrl, response.status));
635
608
  }
636
609
  function formatEditorHostError(baseUrl, status, cause) {
637
- const hint = isLocalVizHost(baseUrl) ? " Start the local editor app with `pnpm dev` on https://viz.localhost, or pass `--editor-url https://viz.localhost`." : " Start the editor host, set `STATELY_EDITOR_URL`, or pass `--editor-url <url>`.";
638
- return `Cannot reach a usable editor host at ${baseUrl}.${status ? ` HTTP ${status} from /embed.` : ""}${cause instanceof Error && cause.message ? ` ${cause.message}` : ""} The CLI loads editor URL defaults from your environment, including \`.env.local\`.${hint}`;
639
- }
640
- function isLocalVizHost(value) {
641
- try {
642
- const url = new URL(value);
643
- return url.protocol === "https:" && url.hostname === "viz.localhost";
644
- } catch {
645
- return false;
646
- }
610
+ return `Cannot reach a usable editor host at ${baseUrl}.${status ? ` HTTP ${status} from /embed.` : ""}${cause instanceof Error && cause.message ? ` ${cause.message}` : ""} The CLI loads editor URL defaults from your environment, including \`.env.local\`. Start the editor host, set \`STATELY_EDITOR_URL\`, or pass \`--editor-url <url>\`.`;
647
611
  }
648
612
  function openBrowser(url) {
649
613
  spawn(process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open", process.platform === "win32" ? [
@@ -1239,7 +1203,7 @@ function getDefaultBaseUrl() {
1239
1203
  return process.env.STATELY_API_URL ?? process.env.NEXT_PUBLIC_BASE_URL ?? process.env.NEXT_PUBLIC_STATELY_API_URL;
1240
1204
  }
1241
1205
  function getDefaultEditorUrl() {
1242
- return process.env.STATELY_EDITOR_URL ?? process.env.NEXT_PUBLIC_BETA_EDITOR_URL ?? process.env.NEXT_PUBLIC_BASE_URL ?? "https://viz.localhost";
1206
+ return process.env.STATELY_EDITOR_URL ?? process.env.NEXT_PUBLIC_BETA_EDITOR_URL ?? process.env.NEXT_PUBLIC_BASE_URL ?? "https://editor.stately.ai";
1243
1207
  }
1244
1208
  function getResolvedStudioUrl(baseUrl) {
1245
1209
  return baseUrl ?? getDefaultBaseUrl() ?? "https://stately.ai";
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as formatMissingNewMachineDirMessage, c as inferInitProjectName, d as resolveApiKey, f as resolveConfiguredPullTargets, h as createStatelyProjectConfig, i as discoverRemoteProjectMachineTargets, l as initProject, m as scanProjectSources, n as classifyPushCandidates, o as formatPlanSummary, p as run, r as discoverLinkedPullTargets, s as getEnvApiKey, t as COMMANDS, u as isFileGitDirty } from "./cli-D4Id6WsS.mjs";
1
+ import { a as formatMissingNewMachineDirMessage, c as inferInitProjectName, d as resolveApiKey, f as resolveConfiguredPullTargets, h as createStatelyProjectConfig, i as discoverRemoteProjectMachineTargets, l as initProject, m as scanProjectSources, n as classifyPushCandidates, o as formatPlanSummary, p as run, r as discoverLinkedPullTargets, s as getEnvApiKey, t as COMMANDS, u as isFileGitDirty } from "./cli-DB0A-O4Y.mjs";
2
2
 
3
3
  export { COMMANDS, classifyPushCandidates, createStatelyProjectConfig, discoverLinkedPullTargets, discoverRemoteProjectMachineTargets, formatMissingNewMachineDirMessage, formatPlanSummary, getEnvApiKey, inferInitProjectName, initProject, isFileGitDirty, resolveApiKey, resolveConfiguredPullTargets, run, scanProjectSources };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "statelyai",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Command-line tools for Stately",
5
5
  "license": "MIT",
6
6
  "type": "module",