@meshmakers/shared-services

中文文档
3.5.550发布于 2026/11/02TypeScriptES Module

Angular library providing common application services for messaging, navigation, breadcrumbs, and HTTP error handling.

原始使用文档
文档目录9 节
  1. Build & Test
  2. Architecture
  3. Services
  4. Interceptors
  5. Models
  6. Quick Start
  7. Detailed Documentation
  8. Dependencies
  9. Documentation and Testing Standards

@meshmakers/shared-services

Angular library providing common application services for messaging, navigation, breadcrumbs, and HTTP error handling.

Part of the @meshmakers package ecosystem.

Build & Test

# Build
npm run build:shared-services

# Lint
npm run lint:shared-services

# Run tests
npm run test:shared-services

Architecture

shared-services/
├── src/
│   ├── public-api.ts
│   └── lib/
│       ├── services/
│       │   ├── message.service.ts          # Notification messages
│       │   ├── app-title.service.ts        # Application title management
│       │   ├── bread-crumb.service.ts      # Breadcrumb navigation
│       │   ├── command.service.ts           # Drawer navigation
│       │   ├── command-base.service.ts      # Navigation base class
│       │   ├── command-settings.service.ts  # Navigation configuration base
│       │   ├── component-menu.service.ts    # Component context menus
│       │   └── error-message.utils.ts       # Error message transformation
│       ├── shared/
│       │   └── mm-http-error-interceptor.service.ts  # HTTP error handling
│       ├── models/
│       │   ├── notification-message.ts      # Message model
│       │   ├── commandItem.ts               # Navigation item model
│       │   ├── breadCrumbData.ts            # Breadcrumb model
│       │   ├── breadCrumbRouteItem.ts       # Route breadcrumb config
│       │   ├── pagedResultDto.ts            # Paged result DTO
│       │   ├── treeItemData.ts              # Tree node model
│       │   ├── apiErrorDto.ts               # API error model
│       │   └── failedDetailsDto.ts          # Error details model
│       ├── data-sources/
│       │   └── entity-select-data-source.ts # Entity autocomplete interface
│       ├── options/
│       │   └── commandOptions.ts            # Command configuration
│       └── compat/                          # Backward compatibility
│           ├── data-source-base.ts          # Legacy DataSourceBase
│           ├── iso-date-time.ts             # Legacy date utilities
│           ├── qr-code-scanner.service.ts   # QR code scanner
│           ├── error-message.ts             # Legacy error model
│           └── auto-complete-data-source.ts # Legacy autocomplete

Services

ServiceDescription
MessageServiceUser-facing notifications (error, warning, info, success) with error history
AppTitleServiceReactive application title management
BreadCrumbServiceAutomatic breadcrumb generation from route configuration
CommandServiceDrawer navigation management with Kendo DrawerItem integration
CommandSettingsServiceBase class for application navigation configuration
ComponentMenuServiceComponent-level context menus from route data

Interceptors

InterceptorDescription
MmHttpErrorInterceptorHandles HTTP errors (network errors, 403 access denied, API 400/409 errors with details, 403 application/problem+json refusals shown with their title/detail); callers that show their own error toast check MmHttpErrorInterceptor.reportsToUser(error) first

Models

ModelDescription
NotificationMessageMessage with level, message, details, timestamp
CommandItemNavigation item with link/href/onClick, visibility, children
BreadCrumbRouteItemRoute breadcrumb config with label/url/icon
BreadCrumbDataKendo-compatible breadcrumb item
PagedResultDtoPaginated result with skip/take/totalCount/list
TreeItemDataTree node interface
EntitySelectDataSourceInterface for entity autocomplete data sources

Quick Start

// app.config.ts
import { provideMmSharedServices, MmHttpErrorInterceptor } from '@meshmakers/shared-services';
import { HTTP_INTERCEPTORS } from '@angular/common/http';

export const appConfig: ApplicationConfig = {
  providers: [
    provideMmSharedServices(),
    { provide: HTTP_INTERCEPTORS, useClass: MmHttpErrorInterceptor, multi: true }
  ]
};

Detailed Documentation

See docs/README.md for complete API reference with usage examples for all services.

Dependencies

  • Angular 21 (core, common/http, router)
  • RxJS (BehaviorSubject, Subject, Observable)
  • @progress/kendo-angular-layout (DrawerItem)
  • @progress/kendo-angular-menu (MenuItem)
  • @progress/kendo-angular-navigation (BreadCrumbItem)
  • @progress/kendo-svg-icons (SVGIcon)

Documentation and Testing Standards

  • All developer documentation must be written in English
  • Every code change must include updated documentation — update README.md, docs/README.md, or inline docs when adding, modifying, or removing features
  • Unit tests and integration tests must be executed after every code change
  • Existing tests must be updated when the behavior of tested code changes
  • New tests must be added when new features, components, or services are implemented
  • Never commit code with failing tests

版本与发布记录

@meshmakers/shared-services 共发布 727 个版本,首次发布于 2022/11/14;过去 12 个月发布了 291 个版本。

版本发布日期距今
3.5.550latest2026/11/021 天前
3.5.5302026/11/012 天前
3.5.5202026/10/313 天前
3.5.5102026/10/303 天前
3.5.5002026/10/304 天前
3.5.4902026/10/304 天前

关于 @meshmakers/shared-services 的常见问题

@meshmakers/shared-services 是什么?

Angular库提供通用的应用服务,用于消息传递、导航、面包屑和HTTP错误处理。

如何安装 @meshmakers/shared-services?

在项目目录运行 npm install @meshmakers/shared-services,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/core(^22.0.0)、@angular/common(^22.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@meshmakers/shared-services 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@meshmakers/shared-services 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@meshmakers/shared-services 可以商用吗?

@meshmakers/shared-services 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@meshmakers/shared-services 还在维护吗?

最新版本 3.5.550 发布于 2026/11/02(1 天前);至今共发布 727 个版本,其中过去 12 个月发布了 291 个;首次发布于 2022/11/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。