Shared TypeScript types and constants for API responses, messages, and validation.
- Shared package: anto-sh/admin-network-shared.
- Frontend: anto-sh/admin-frontend, normally at
../admin-frontendlocally. - Backend: anto-sh/admin-backend, normally at
../admin-backendlocally.
- Shared principles: frontend
manifesto.md, normally at../admin-frontend/manifesto.md. - API integration: frontend
DOCS.md, section 5, normally at../admin-frontend/DOCS.md.
npm install @anto-sh/admin-network-sharedThe package provides CommonJS, ESM, and TypeScript declarations from dist.
npm run buildUse npm run dev to rebuild on changes. Package imports resolve to the generated dist files.
ApiResponse<T> is a response envelope: status is success or error, message holds a network message or undefined, and optional data and timestamp hold the payload and response timestamp.
NetworkMessage contains a code and optional params. NETWORK_MESSAGE_CODES catalogs common errors, uploads, and entity events. NetworkMessageParamsFor<C> describes parameters for a chosen code. Consumers supply the display text.
ValidationErrorData contains a validationErrors array. Each ValidationIssue identifies the field through path, the problem through code, and any required details through params.
Paths contain field names and numeric array indices; [] means the whole request. VALIDATION_CODES lists the supported problems, and TypeScript checks the parameters required by each code.