(options: {
flags: CliFlags;
scope: { tenant: string; runId: string };
connectionMetadata?: RemoteConnectionRequestMetadata;
context: ConnectContext;
remoteConfigPath: string;
})
| 195 | } |
| 196 | |
| 197 | function buildConnectedState(options: { |
| 198 | flags: CliFlags; |
| 199 | scope: { tenant: string; runId: string }; |
| 200 | connectionMetadata?: RemoteConnectionRequestMetadata; |
| 201 | context: ConnectContext; |
| 202 | remoteConfigPath: string; |
| 203 | }): RemoteConnectionState { |
| 204 | const { flags, scope, connectionMetadata, context, remoteConfigPath } = options; |
| 205 | const previous = shouldReusePreviousConnectionState(flags, context.previous) |
| 206 | ? context.previous |
| 207 | : null; |
| 208 | const now = new Date().toISOString(); |
| 209 | const leaseBinding = buildConnectionLeaseBinding(flags, previous, connectionMetadata); |
| 210 | const runtimeBinding = buildConnectionRuntimeBinding(flags, previous, now); |
| 211 | return { |
| 212 | version: 1, |
| 213 | session: context.session, |
| 214 | remoteConfigPath, |
| 215 | remoteConfigHash: context.remoteConfigHash, |
| 216 | daemon: context.daemon, |
| 217 | tenant: scope.tenant, |
| 218 | runId: scope.runId, |
| 219 | ...leaseBinding, |
| 220 | ...runtimeBinding, |
| 221 | updatedAt: now, |
| 222 | }; |
| 223 | } |
| 224 | |
| 225 | function buildConnectionLeaseBinding( |
| 226 | flags: CliFlags, |
no test coverage detected