@cabstar/protocol (0.1.1)

Published 2026-06-06 15:39:40 +03:00 by anton

Installation

@cabstar:registry=
npm install @cabstar/protocol@0.1.1
"@cabstar/protocol": "0.1.1"

About this package

@cabstar/protocol

Общие DTO и типы для общения клиентов с Cabstar API.

Используется в cabstar-api, cabstar-web и будущих клиентах (mobile, ws).

Установка

Из монорепозитория (локально):

npm install file:../cabstar-protocol

Из registry:

npm install @cabstar/protocol

Сборка

npm run build

Публикация в npm registry

Пакет публикуется в packages.

Перед первым пушем авторизуйся:

npm login --registry=https://git.serverbox.dev/api/packages/anton/npm/

Или скопируй .npmrc.example.npmrc и укажи токен.

Публикация:

npm run npm:push

Структура

src/
├── auth/       # LoginRequest, LoginResponse, UserDto
├── assets/     # AssetDto, VehicleTypesResponse (v0.1)
├── app/        # AppInfoResponse
├── health/     # HealthResponse
├── locales/    # LocalesResponse
└── common/     # SupportedLocale, ApiErrorResponse

Пример

import type {
  LoginRequest,
  LoginResponse,
  VehicleTypesResponse,
} from '@cabstar/protocol';

const credentials: LoginRequest = {
  email: 'admin@cabstar.local',
  password: 'admin123',
};

const assets: VehicleTypesResponse = await fetch('/api/v0.1/assets').then(
  (response) => response.json(),
);

Версионирование

Константы базового пути:

import { API_VERSION, API_BASE_PATH } from '@cabstar/protocol';

// API_VERSION === '0.1'
// API_BASE_PATH === 'api/v0.1'

Все клиенты должны обращаться к http://<host>/${API_BASE_PATH}/....

Dependencies

Development dependencies

ID Version
typescript ^5.7.3
Details
npm
2026-06-06 15:39:40 +03:00
1
UNLICENSED
6.3 KiB
Assets (1)
Versions (8) View all
0.3.2 2026-06-06
0.3.1 2026-06-06
0.3.0 2026-06-06
0.2.0 2026-06-06
0.1.6 2026-06-06