runwork 0.19.0 → 0.19.1

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.
Files changed (2) hide show
  1. package/dist/index.js +57 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1087,10 +1087,21 @@ var init_credentials = __esm(() => {
1087
1087
  });
1088
1088
 
1089
1089
  // src/auth/login-flow.ts
1090
- async function performLogin(baseUrl) {
1090
+ function decorateLoginUrl(loginUrl, options) {
1091
+ const params = [];
1092
+ if (options?.register)
1093
+ params.push("mode=register");
1094
+ if (options?.provider)
1095
+ params.push(`provider=${encodeURIComponent(options.provider)}`);
1096
+ if (params.length === 0)
1097
+ return loginUrl;
1098
+ return `${loginUrl}${loginUrl.includes("?") ? "&" : "?"}${params.join("&")}`;
1099
+ }
1100
+ async function performLogin(baseUrl, options) {
1091
1101
  const url = baseUrl || DEFAULT_BASE_URL2;
1092
1102
  const client = new ApiClient({ apiKey: "", email: "", baseUrl: url });
1093
- const { sessionId, loginUrl } = await client.initiateLogin();
1103
+ const { sessionId, loginUrl: rawLoginUrl } = await client.initiateLogin();
1104
+ const loginUrl = decorateLoginUrl(rawLoginUrl, options);
1094
1105
  const open = await import("open");
1095
1106
  await open.default(loginUrl);
1096
1107
  console.log(`If browser didn't open, visit: ${loginUrl}`);
@@ -1165,7 +1176,7 @@ function extractBaseUrl(loginUrl) {
1165
1176
  }
1166
1177
  }
1167
1178
  async function pollAndSave(client, sessionId, baseUrl) {
1168
- const maxAttempts = 60;
1179
+ const maxAttempts = 360;
1169
1180
  const pollInterval = 5000;
1170
1181
  for (let i = 0;i < maxAttempts; i++) {
1171
1182
  await new Promise((resolve) => setTimeout(resolve, pollInterval));
@@ -7612,7 +7623,7 @@ function createKeyboardListener() {
7612
7623
  }
7613
7624
 
7614
7625
  // src/generated/version.ts
7615
- var VERSION = "0.19.0";
7626
+ var VERSION = "0.19.1";
7616
7627
 
7617
7628
  // src/commands/dev.ts
7618
7629
  var exports_dev = {};
@@ -8603,7 +8614,7 @@ import { Command as Command36 } from "commander";
8603
8614
  init_login_flow();
8604
8615
  init_colors();
8605
8616
  import { Command } from "commander";
8606
- var loginCommand = new Command("login").description("Authenticate with Runwork platform").argument("[url]", "Login URL from a previous --no-open session").option("--base-url <url>", "Platform URL", "https://runwork.ai").option("--no-open", "Print login URL without opening browser (polls for completion)").option("--print-only", "With --no-open: print URL and exit without polling").option("--api-key <key>", "Authenticate directly with an API key (for CI)").action(async (url, options) => {
8617
+ var loginCommand = new Command("login").description("Authenticate with Runwork platform").argument("[url]", "Login URL from a previous --no-open session").option("--base-url <url>", "Platform URL", "https://runwork.ai").option("--no-open", "Print login URL without opening browser (polls for completion)").option("--print-only", "With --no-open: print URL and exit without polling").option("--api-key <key>", "Authenticate directly with an API key (for CI)").option("--register", "Open the browser on the registration form for a new account").option("--provider <provider>", "Start this OAuth provider flow directly (google, github)").action(async (url, options) => {
8607
8618
  if (!options)
8608
8619
  return;
8609
8620
  if (options.apiKey) {
@@ -8621,7 +8632,7 @@ var loginCommand = new Command("login").description("Authenticate with Runwork p
8621
8632
  printNextSteps();
8622
8633
  return;
8623
8634
  }
8624
- await performLogin(options.baseUrl);
8635
+ await performLogin(options.baseUrl, { register: options.register, provider: options.provider });
8625
8636
  printNextSteps();
8626
8637
  });
8627
8638
  function printNextSteps() {
@@ -16165,6 +16176,9 @@ function resolveExportTargets(entities, filter) {
16165
16176
  }
16166
16177
  return { targets };
16167
16178
  }
16179
+ function classifyExportError(message) {
16180
+ return message.includes("not deployed to production") ? "not_deployed" : "error";
16181
+ }
16168
16182
  function appSlugForPath(appName, appId) {
16169
16183
  const slug = appName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
16170
16184
  return slug || appId;
@@ -16454,22 +16468,49 @@ var exportCommand = new Command15("export").description("Export entity data to l
16454
16468
  }
16455
16469
  const results = [];
16456
16470
  for (const target of targets) {
16457
- results.push(await exportOneApp(client, workspaceId, target, {
16458
- format,
16459
- entityName: entity,
16460
- wait: opts.wait !== false,
16461
- outputRoot: opts.output,
16462
- quiet: useJson
16463
- }));
16471
+ try {
16472
+ results.push(await exportOneApp(client, workspaceId, target, {
16473
+ format,
16474
+ entityName: entity,
16475
+ wait: opts.wait !== false,
16476
+ outputRoot: opts.output,
16477
+ quiet: useJson
16478
+ }));
16479
+ } catch (err) {
16480
+ const message = err instanceof Error ? err.message : String(err);
16481
+ const kind = classifyExportError(message);
16482
+ const status = kind === "not_deployed" ? "skipped" : "failed";
16483
+ if (!useJson) {
16484
+ console.error(kind === "not_deployed" ? `${target.appName}: skipped (not deployed to production)` : `${target.appName}: failed: ${message}`);
16485
+ }
16486
+ results.push({
16487
+ appId: target.appId,
16488
+ appName: target.appName,
16489
+ jobId: "",
16490
+ status,
16491
+ records: 0,
16492
+ sizeBytes: 0,
16493
+ outputDir: null,
16494
+ files: [],
16495
+ error: message
16496
+ });
16497
+ }
16464
16498
  }
16465
16499
  if (useJson) {
16466
16500
  jsonOut({ exports: results });
16467
16501
  return;
16468
16502
  }
16503
+ const exported = results.filter((r) => r.status === "completed");
16504
+ const skipped = results.filter((r) => r.status === "skipped");
16469
16505
  const failed = results.filter((r) => r.status === "failed");
16470
- if (failed.length > 0) {
16471
- console.error(`
16472
- ${failed.length} export(s) failed.`);
16506
+ const summary = [`${exported.length} app(s) exported`];
16507
+ if (skipped.length > 0)
16508
+ summary.push(`${skipped.length} skipped (not deployed)`);
16509
+ if (failed.length > 0)
16510
+ summary.push(`${failed.length} failed`);
16511
+ console.log(`
16512
+ ${summary.join(", ")}.`);
16513
+ if (failed.length > 0 || opts.app && skipped.length > 0) {
16473
16514
  process.exit(1);
16474
16515
  }
16475
16516
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runwork",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "CLI for Runwork: develop, preview, and deploy Runwork apps from your local machine.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Runwork, Inc. <info@runwork.ai> (https://www.runwork.ai)",