@dashai/cli 0.11.0 → 0.11.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.
package/dist/bin.js CHANGED
@@ -1382,8 +1382,13 @@ import { NextResponse } from 'next/server';
1382
1382
  import { db } from '@dashai/generated';
1383
1383
 
1384
1384
  export async function GET() {
1385
- const page = await db.items.list({ limit: 50 });
1386
- return NextResponse.json(page.rows);
1385
+ // \`db.<table>.list()\` resolves to the rows array itself \u2014 the typed
1386
+ // client unwraps the \`{ rows, total, ... }\` page envelope (see the
1387
+ // generated \`client/tables.d.ts\`: \`list(): Promise<ItemsRow[]>\`).
1388
+ // Don't reach for \`.rows\` here: it's \`undefined\` on an array, and
1389
+ // \`NextResponse.json(undefined)\` throws "Value is not JSON serializable".
1390
+ const rows = await db.items.list({ limit: 50 });
1391
+ return NextResponse.json(rows);
1387
1392
  }
1388
1393
 
1389
1394
  export async function POST(request: Request) {
@@ -2504,6 +2509,9 @@ async function tryProvisionDevInstall(args) {
2504
2509
  apiKey: response.api_key,
2505
2510
  apiKeyId: response.api_key_id,
2506
2511
  installationId: response.installation.id,
2512
+ // Cache the workspace so `dashwise dev` can default its dev-SSO-session
2513
+ // workspace to it — no re-passing `--workspace` for multi-workspace users.
2514
+ workspaceId: workspace2.id,
2507
2515
  expiresAt: response.api_key_expires_at
2508
2516
  });
2509
2517
  } catch (err) {
@@ -3427,9 +3435,14 @@ async function devCommand(options) {
3427
3435
  if (explicitInstallationId && explicitInstallationId !== "local") {
3428
3436
  installationIdEnv = explicitInstallationId;
3429
3437
  } else if (reuseDevSessionId) ; else {
3438
+ const effectiveWorkspace = options.workspace ?? moduleEntry?.workspaceId?.toString();
3430
3439
  let workspaceContext;
3431
3440
  try {
3432
- workspaceContext = await resolveTargetWorkspace(apiUrl, apiToken, options.workspace);
3441
+ workspaceContext = await resolveTargetWorkspace(
3442
+ apiUrl,
3443
+ apiToken,
3444
+ effectiveWorkspace
3445
+ );
3433
3446
  } catch (err) {
3434
3447
  fail(err.message);
3435
3448
  return 1;
@@ -9271,7 +9284,7 @@ fieldCmd.command("set-type <table-slug> <field-slug> <new-type>").description(
9271
9284
  }
9272
9285
  })();
9273
9286
  function getVersion() {
9274
- return "0.11.0";
9287
+ return "0.11.1";
9275
9288
  }
9276
9289
  function parseIntOption(value) {
9277
9290
  const n = Number.parseInt(value, 10);