feat(billmanager): унифицированные профили хостеров (waicore vds.vps)
Docker / build (push) Failing after 20s
Docker / build (push) Failing after 20s
Overrides по apiBaseUrl: DEFAULT + partial merge; Waicore использует func=vds.vps. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# BILLmanager hoster profiles
|
||||
|
||||
Унифицированные переопределители для исключений из стандартного ISPsystem API.
|
||||
|
||||
## Как добавить профиль (5 минут)
|
||||
|
||||
1. Создай `profiles/<id>.ts` с **только расхождениями**:
|
||||
|
||||
```ts
|
||||
import type { BillmanagerProfileOverrides } from './types.js'
|
||||
|
||||
export const myHosterOverrides: BillmanagerProfileOverrides = {
|
||||
id: 'myhoster',
|
||||
match: {
|
||||
hostnames: ['myhoster.com'],
|
||||
keywords: ['myhoster'],
|
||||
},
|
||||
funcs: {
|
||||
listVds: 'vds.custom', // если отличается от 'vds'
|
||||
},
|
||||
// map: { enrichVds: (item, mapped) => ({ ...mapped, country: 'DE' }) },
|
||||
// requestParams: { listVds: { p_cnt: 1000 } },
|
||||
}
|
||||
```
|
||||
|
||||
2. Зарегистрируй в [`registry.ts`](./registry.ts) — массив `PROFILE_OVERRIDES` (порядок = приоритет матча).
|
||||
|
||||
3. Добавь fixture + тест в [`profiles.test.ts`](../profiles.test.ts).
|
||||
|
||||
4. Новый hook (редко) — расширь `BillmanagerProfile` в [`types.ts`](./types.ts) и значение в [`default.ts`](./default.ts).
|
||||
|
||||
## Контракт
|
||||
|
||||
| Поле | Назначение |
|
||||
|------|------------|
|
||||
| `match.hostnames` | substring hostname |
|
||||
| `match.keywords` | substring всего URL |
|
||||
| `funcs.*` | `func=` для list / payment / dashboard / order |
|
||||
| `extract.*` | ключ для `extractList` |
|
||||
| `map.vds` / `map.payment` | полный маппер |
|
||||
| `map.enrichVds` | пост-обработка после default map |
|
||||
| `requestParams.*` | доп. query params |
|
||||
|
||||
`resolveBillmanagerProfile(apiBaseUrl)` → `merge(DEFAULT, override)` или `DEFAULT`.
|
||||
|
||||
Sync и operations **не** содержат `if (hoster)` — только профиль.
|
||||
Reference in New Issue
Block a user