( data: Record<string, unknown>, session?: string, )
| 56 | } |
| 57 | |
| 58 | export function normalizeInstallFromSourceResult( |
| 59 | data: Record<string, unknown>, |
| 60 | session?: string, |
| 61 | ): AppInstallFromSourceResult { |
| 62 | const bundleId = readOptionalString(data, 'bundleId'); |
| 63 | const packageName = readOptionalString(data, 'packageName'); |
| 64 | const appId = bundleId ?? packageName ?? readOptionalString(data, 'appId'); |
| 65 | const launchTarget = readOptionalString(data, 'launchTarget') ?? packageName ?? bundleId ?? appId; |
| 66 | if (!launchTarget) { |
| 67 | throw new AppError('COMMAND_FAILED', 'Daemon response is missing "launchTarget".', { |
| 68 | response: data, |
| 69 | }); |
| 70 | } |
| 71 | return { |
| 72 | appName: readOptionalString(data, 'appName'), |
| 73 | appId, |
| 74 | bundleId, |
| 75 | packageName, |
| 76 | launchTarget, |
| 77 | installablePath: readOptionalString(data, 'installablePath'), |
| 78 | archivePath: readOptionalString(data, 'archivePath'), |
| 79 | materializationId: readOptionalString(data, 'materializationId'), |
| 80 | materializationExpiresAt: readOptionalString(data, 'materializationExpiresAt'), |
| 81 | identifiers: buildAppIdentifiers({ session, bundleId, packageName, appId }), |
| 82 | }; |
| 83 | } |
| 84 | |
| 85 | export function normalizeMaterializationReleaseResult( |
| 86 | data: Record<string, unknown>, |
no test coverage detected