`config` — added this morning in 2.1.0 — is gone, and `storeRepositoryUrl` with it, along with the two store repositories they pointed at. 2.1.0 had the registry say how each store behaves. Wrong shape: how a store behaves is fixed per installed client, and this application is the only thing that can see the machine it runs on. A copy of that on a server was a second authority over decisions this side had already made correctly — including which directories the store may delete from — and two authorities are a way to disagree. Keeping two stores on one machine apart needs none of it. It is a subfolder, derived here: the store id is a slug of the catalog host, the home is `<id>-desktop`, the games folder is `<id>`, and that folder is the only subtree the store will ever delete from. Derived from the *catalog* on purpose — the catalog is what a store is, so two records naming the same one are the same store and land in the same place, which makes installing twice idempotent instead of a way to orphan what is already there. Existing installations keep their identity: a store home is recognised by its own `config.json`, so one installed as `ttg` stays `ttg` in `ttg-desktop` with its games where they are. Only a new install derives its id. `StoreProvisioningService` no longer re-reads the registry before installing. That existed to keep the renderer from supplying a config, and with no config in the record there is nothing left to protect: a name and a catalog have no paths in them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
23 lines
812 B
TypeScript
23 lines
812 B
TypeScript
import type { RegistryStore } from '../../domain/models/RegistryStore'
|
|
import { deriveStoreId } from '../../domain/models/StoreIdentity'
|
|
import type { RegistryStoreDto } from '../../shared/contracts/dto/RegistryStoreDto'
|
|
|
|
export class RegistryStoreDtoMapper {
|
|
public toDto (store: RegistryStore): RegistryStoreDto {
|
|
return {
|
|
name: store.name,
|
|
catalogUrl: store.catalogUrl,
|
|
storeId: deriveStoreId(store)
|
|
}
|
|
}
|
|
|
|
public toDtoList (stores: readonly RegistryStore[]): readonly RegistryStoreDto[] {
|
|
return stores.map((store: RegistryStore): RegistryStoreDto => this.toDto(store))
|
|
}
|
|
|
|
/** The window hands a record straight back when asking for an install. */
|
|
public toModel (dto: RegistryStoreDto): RegistryStore {
|
|
return { name: dto.name, catalogUrl: dto.catalogUrl }
|
|
}
|
|
}
|