# @beredo/ngx-ion-client 中文文档

规范地址：https://npmcn.com/package/%40beredo/ngx-ion-client/

版本：22\.2\.4
npm 元数据更新时间：2026-10-29T07:18:39.945Z
中文译文更新时间：2026-11-07T22:54:06.241Z
软件包许可：未声明

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40beredo/ngx-ion-client
原文对照：https://npmcn.com/package/%40beredo/ngx-ion-client/?lang=original

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：424 kB，11 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：1 个
- peer 依赖：@angular/core ~22\.x，@angular/common ~22\.x
- 首次发布：2025-05-28T05:35:57.316Z
- 最新版本发布：2026-10-29T07:18:39.726Z
- 近 30 天下载量：3116（2026-10-08 至 2026-11-06，npm 官方下载统计）
- 已发布版本数：89（近 12 个月 72 个）

## 中文简介

这个Angular库简化了API与Infor M3和Infor ION的通信,提供了管理交易的实用方法,用户上下文,以及CSRF令牌. 它总结了参数处理、上下文管理和错误等共同功能

## 安装

```sh
npm install @beredo/ngx-ion-client
```

也可以使用：`pnpm add @beredo/ngx-ion-client`、`yarn add @beredo/ngx-ion-client`、`bun add @beredo/ngx-ion-client`

## README

# 用于 Infor M3/Infor ION 的角 HTTP 库

这个Angular库简化了API与Infor M3和Infor ION的通信,提供了管理交易的实用方法,用户上下文,以及CSRF令牌. 它汇总了参数处理,上下文管理,错误处理等常见功能来简化API集成.

* * *

## 特征

-   **M3 V2 API: (英语)** 支持 M3 v2 端点.
-   **M3 散装 API :** M3散列API支持.
-   **丢入 Odin 替换 :** 该项目的目标是,从Odin移徙应尽可能简单.

* * *

## 安装

要安装库, 请添加到您的 Angular 项目中 :

```bash
npm install @beredo/ngx-ion-client
```

# 开始

## 在提供者中添加 HttpClientModule

如果使用独立组件,也可以在组件中配置.

无论是在你的应用模块. ts

```
...
import { HttpClientModule } from '@angular/common/http';
...
@NgModule({
  ...
  providers: [
    ...
    HttpClientModule
    ...
  ]
  ...
```

或者在你的应用程序中

```
...
import { provideHttpClient } from '@angular/common/http';
export const appConfig: ApplicationConfig = {
  providers: [
    ....
    provideHttpClient(),
    ...
  ],
};

```

## 导入库

```
import { HttpClientModule } from '@angular/common/http';
import { MIService, UserService } from '@beredo/ngx-ion-client';


@NgModule({
imports: [
HttpClientModule,
// Other imports
],
providers: [MIService, UserService],
})
export class AppModule {}
```

# 使用图书馆

## 做一个基本的m3呼叫

要简单的 API 呼叫, 导入服务并使用执行或执行V2 方法

```
import { Component } from '@angular/core';
import { MIService } from "@beredo/ngx-ion-client";

@Component({
  selector: 'app-transaction',
  template: `<pre>{{ transactionResult | json }}</pre>`,
})
export class TransactionComponent {
  transactionResult: any;

  constructor(private miService: MIService) {
    this.miService
      .execute({
        program: 'MMS001MI',
        transaction: 'LstItems',
        record: { ITNO: 'ITEM001' },
      })
      .subscribe(
        (result) => {
          this.transactionResult = result;
        },
        (error) => {
          console.error('Transaction error', error);
        }
      );
  }
}
```

或与 V2 API

```
import { Component } from '@angular/core';
import { MIService } from "@beredo/ngx-ion-client";

@Component({
  selector: 'app-transaction',
  template: `<pre>{{ transactionResult | json }}</pre>`,
})
export class TransactionComponent {
  transactionResult: any;

  constructor(private miService: MIService) {
        return this.miService.executeV2<
      GetHeadInputs,
      GetHeadOutputs
    >({
      program: "OIS100MI",
      transaction: "GetHead",
      records: params,
    });
  }
}


```

## 用户背景

用户上下文在本地开发时使用MNS150MI.

```
import { Component, OnInit } from '@angular/core';
import { UserService, UserContext } from "@beredo/ngx-ion-client";

@Component({
  selector: 'app-user-context',
  template: `<pre>{{ userContext | json }}</pre>`,
})
export class UserContextComponent implements OnInit {
  userContext: UserContext | undefined;

  constructor(private userService: UserService) {}

  ngOnInit() {
    this.userService.getUserContext().subscribe((context) => {
      this.userContext = context;
    });
  }
}
```

## 打开体验设计程序

`EdaLauncherService` 打开 H5 中的经验设计器应用程序. `shortName` 是应用程序在体验设计师管理中的简称( 不) 它的显示名称)。 每个参数密钥都是应用程序的组件显示 ids 作为 `Component.Field`; 空值被忽略, 其他则被忽略 是URI编码的.

```
import { Component, inject } from '@angular/core';
import { EdaLauncherService } from "@beredo/ngx-ion-client";

@Component({
  selector: 'app-customer-link',
  template: `<button (click)="open('10001')">Customer info</button>`,
})
export class CustomerLinkComponent {
  private eda = inject(EdaLauncherService);

  open(cuno: string) {
    // mp://CUSTINFO?title=Customer%20info&IndexList_Customers.CUNO=10001
    this.eda.launch({
      shortName: 'CUSTINFO',
      title: 'Customer info',
      params: { 'IndexList_Customers.CUNO': cuno },
    });
  }
}
```

`edaLink(...)` 返回同一链接而不打开,以及 `launchLink('mp://...')` 打开保存在其他地方的链接.

# 许可证发放

此图书馆仅供非商业用途. 如果你想在商业项目中使用这个,你可以联系我们讨论许可问题.

## 常见问题

### @beredo/ngx-ion-client 是什么？

这个Angular库简化了API与Infor M3和Infor ION的通信,提供了管理交易的实用方法,用户上下文,以及CSRF令牌\. 它总结了参数处理、上下文管理和错误等共同功能

### 如何安装 @beredo/ngx-ion-client？

在项目目录运行 npm install @beredo/ngx-ion-client，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：@angular/core（~22\.x）、@angular/common（~22\.x）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @beredo/ngx-ion-client 支持 TypeScript 吗？

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

### @beredo/ngx-ion-client 支持 ESM 还是 CommonJS？

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

### @beredo/ngx-ion-client 可以商用吗？

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

### @beredo/ngx-ion-client 的下载量有多少？

根据 npm 官方下载统计，@beredo/ngx-ion-client 在 2026/10/08 – 2026/11/06 这 30 天内被下载 3,116 次，日均约 104 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @beredo/ngx-ion-client 还在维护吗？

最新版本 22\.2\.4 发布于 2026/10/29（10 天前）；至今共发布 89 个版本，其中过去 12 个月发布了 72 个；首次发布于 2025/05/28。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

