@ethisyscore/foundation-utils

中文文档
0.7.1发布于 2026/10/25SEE LICENSE IN LICENSETypeScriptESM + CJS近 30 天下载 3322

Platform-free utilities shared by the EthisysCore web app, the plugin SDK and plugins: date, time and duration helpers (over date-fns), RFC 6902 JSON Patch (over mutative), money, number and byte-count display formatting, list-envelope normalisation and p

此软件包已被标记为弃用

This package has moved to the Ethisys Core package feed. In Ethisys Core, open the Developers page and follow the setup steps (cc login connects npm to the feed).

原始使用文档
文档目录3 节
  1. Install
  2. Entry points
  3. Scripts

@ethisyscore/foundation-utils

Platform-free utilities shared by the EthisysCore web app, the plugin SDK and plugins. Pure TypeScript, no React. The npm side of EthisysCore Foundation: it follows the same rules as the .NET packages (no platform types, one behaviour per concept, changes rarely).

Install

npm install @ethisyscore/foundation-utils

date-fns and mutative are runtime dependencies. dayjs and zod are optional peer dependencies, needed only for the ./date/dayjs and ./phone/zod sub-paths.

Entry points

Sub-pathContents
.Everything below except ./date/dayjs and ./phone/zod
./dateFormat constants, ISO and timezone-safe helpers, display formatting, durations, <input> to DateTimeOffset wire helpers, ranges, format-string validation
./date/dayjsdayjsToIsoDayBoundary
./date/org-formatOrganisation-driven display: formatDate, formatDateTime, formatTime, formatDateOrPresent, formatRelativeTime and the dayjs picker masks. Each takes the organisation's { dateFormat, timeFormat }; a missing or invalid format falls back to UK dd/MM/yyyy and HH:mm
./patchRFC 6902 JSON Patch: generateJsonPatch, applyJsonPatch, deepClone and the JsonPatchOperation type
./listunwrapList: normalises list responses returned bare or in an envelope. PAGE_SIZE_OPTIONS and DEFAULT_PAGE_SIZE
./moneyformatMoney, formatCompactMoney, getCurrencySymbol, parseMoney. The caller always names the currency
./numberformatNumber, formatPercent, formatBytes (1 KB = 1024 bytes) and formatDecimalBytes (1 KB = 1000 bytes, for storage allowances and their charges)
./wiredecodeWireEnum, decodeWireEnumName: enum values sent as an ordinal or a name
./routeRouteMetaEntry, Breadcrumb, sortBySpecificity, matchRoute, resolvePattern, buildBreadcrumbs: match a pathname against flat route metadata and build its breadcrumb trail
./typesBase DTO and query shapes: Guid, asGuid, EMPTY_GUID, Auditable, AuditableDetailed, HasRowVersion, PagedQuery, SearchQuery, LookupItem
./phoneisValidPhone, normalisePhone, formatPhone, sanitisePhoneInput: E.164-compatible phone numbers (optional leading +, 7-15 digits)
./phone/zodoptionalPhoneSchema, requiredPhoneSchema

Nothing here holds state. The caller keeps the organisation's formats and currency (the plugin SDK in module-level refs stamped from the host, the web app in React context) and passes them in.

Scripts

npm run build          # tsup: ESM + CJS + d.ts
npm test               # vitest
npm run lint           # tsc --noEmit + eslint
npm run lint:package   # publint + attw against the packed tarball

Published to npm by .github/workflows/release.yml at the same version as the Foundation NuGet packages.

版本与发布记录

@ethisyscore/foundation-utils 共发布 7 个版本,首次发布于 2026/10/19;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.7.1latest2026/10/2520 天前
0.7.02026/10/2321 天前
0.6.02026/10/2322 天前
0.5.02026/10/2123 天前
0.4.02026/10/2024 天前
0.3.02026/10/1925 天前

关于 @ethisyscore/foundation-utils 的常见问题

@ethisyscore/foundation-utils 是什么?

Platform-free utilities shared by the EthisysCore web app, the plugin SDK and plugins: date, time and duration helpers (over date-fns), RFC 6902 JSON Patch (over mutative), money, number and byte-count display formatting, list-envelope normalisation and p注意:该包已被作者标记为弃用——This package has moved to the Ethisys Core package feed. In Ethisys Core, open the Developers page and follow the setup steps (cc login connects npm to the feed).

如何安装 @ethisyscore/foundation-utils?

在项目目录运行 npm install @ethisyscore/foundation-utils,或使用 pnpm add / yarn add / bun add。

@ethisyscore/foundation-utils 支持 TypeScript 吗?

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

@ethisyscore/foundation-utils 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ethisyscore/foundation-utils 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ethisyscore/foundation-utils 可以商用吗?

@ethisyscore/foundation-utils 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@ethisyscore/foundation-utils 的下载量有多少?

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

@ethisyscore/foundation-utils 还在维护吗?

最新版本 0.7.1 发布于 2026/10/25(20 天前);至今共发布 7 个版本,其中过去 12 个月发布了 7 个;首次发布于 2026/10/19。作者已将其标记为弃用,新项目建议寻找替代方案。