({ positionals, flags })
| 349 | }; |
| 350 | |
| 351 | export const connectionCommand: ClientCommandHandler = async ({ positionals, flags }) => { |
| 352 | if (positionals[0] !== 'status') { |
| 353 | throw new AppError('INVALID_ARGS', 'connection accepts only: status'); |
| 354 | } |
| 355 | const { session, state } = readRequestedConnectionState(flags); |
| 356 | if (!state) { |
| 357 | writeNoRemoteConnectionOutput(flags, session); |
| 358 | return true; |
| 359 | } |
| 360 | const leasePreparation = buildLeasePreparationNotice(state); |
| 361 | const runtimePreparation = buildRuntimePreparationNoticeFromState(state); |
| 362 | writeCommandOutput(flags, serializeConnectionState(state, runtimePreparation), () => |
| 363 | [ |
| 364 | `Connected remote session "${state.session}".`, |
| 365 | `tenant=${state.tenant} runId=${state.runId} leaseId=${state.leaseId ?? 'pending'} backend=${state.leaseBackend ?? 'pending'}`, |
| 366 | `remoteConfig=${state.remoteConfigPath}`, |
| 367 | state.runtime ? 'metro=prepared' : 'metro=not-prepared', |
| 368 | leasePreparation?.message, |
| 369 | runtimePreparation?.message, |
| 370 | ] |
| 371 | .filter((line): line is string => Boolean(line)) |
| 372 | .join('\n'), |
| 373 | ); |
| 374 | return true; |
| 375 | }; |
| 376 | |
| 377 | function createRemoteSessionName(stateDir: string): string { |
| 378 | for (let attempt = 0; attempt < 8; attempt += 1) { |
no test coverage detected