@fragus/sam-types

中文文档
1.2.27发布于 2026/11/14TypeScriptCommonJS零依赖近 30 天下载 4499

Typescript interfaces for all types used to communicate between SAM client(s) and the SAM API

原始使用文档
文档目录5 节
  1. Using it
  2. Prerequisites
  3. Getting started
  4. Docs
  5. Branches

SAM-types

The TypeScript types shared by SAM-api and its clients: SAM-admin-v2, SAM-superadmin-frontend, SAM-webcalc-v2 and MyPage. Requests, responses, error keys and enums live here once, so the API and every client agree on what goes over the wire.

Published to npm as @fragus/sam-types.

Using it

Each consumer pins an exact version in its package.json:

"@fragus/sam-types": "1.1.9"

Import from the package root:

import { ContractState, INoContractsAvailableErrorParams } from '@fragus/sam-types'

Prerequisites

  • Node.js: the version in .nvmrc
  • npm

Getting started

npm install
npm run tsc        # npm run tsc-win on Windows without bash

npm run tsc deletes the compiled .js files and builds the package again. CI runs the same build on every push.

Docs

Branches

fix/, feature/ or backmerge/ plus a kebab-case description. PRs target develop.

版本与发布记录

@fragus/sam-types 共发布 122 个版本,首次发布于 2025/01/29;过去 12 个月发布了 76 个版本。

版本发布日期距今
1.2.27latest2026/11/141 天前
1.2.262026/11/142 天前
1.2.252026/11/132 天前
1.2.242026/11/123 天前
1.2.232026/11/105 天前
1.2.222026/11/096 天前

关于 @fragus/sam-types 的常见问题

@fragus/sam-types 是什么?

Typescript interfaces for all types used to communicate between SAM client(s) and the SAM API

如何安装 @fragus/sam-types?

在项目目录运行 npm install @fragus/sam-types,或使用 pnpm add / yarn add / bun add。

@fragus/sam-types 支持 TypeScript 吗?

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

@fragus/sam-types 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fragus/sam-types 可以商用吗?

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

@fragus/sam-types 的下载量有多少?

根据 npm 官方下载统计,@fragus/sam-types 在 2026/10/16 – 2026/11/14 这 30 天内被下载 4,499 次,日均约 150 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fragus/sam-types 还在维护吗?

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