登记
畜牧信息服务(LIS)的一部分,它允许牲畜饲养者、所有者、代理商和牲畜饲养者使用 代表们记录和管理他们的动物.
@defra/lis-hubs-infra-registry 是一个共享 npm 软件包, 持有 LIS 模块的注册
(说话的应用软件及其路径、港口、物种、分类和枢纽),加上支持的物种
和分类学, 和小帮手寻找它们.
它只持有事实。 它不作出许可或能力决定(见 下层访问) (中文(简体) ).
用于:
- 中枢 : lis-hubs-前台办公室, (中文(简体) ), 后办公室
- 发言: 丽丝-苹果-牛-家, (中文(简体) ), lis -apps - crattle - register (英语), (中文(简体) ), 百花齐放, (中文(简体) ), 鼠类动物死亡
- 软件包 : 双核, (中文(简体) ), 下层访问, (中文(简体) ), 服务
这是Lis-hubs-infra-core、Lis-hubs-infra-access和Lis-infra-ui-services的同龄依赖.
安装
npm install @defra/lis-hubs-infra-registry
如果您的应用程序使用将它列为对等依赖的软件包之一, 请同时安装 .
使用量
所有出口都来自包根.
常数
import {
HUBS,
TAXONOMIES,
SPECIES,
MODULES
} from '@defra/lis-hubs-infra-registry'
HUBS // ['front-office', 'back-office']
TAXONOMIES // [{ id: 'register', label: 'Register', summary: '...' }, ...]
SPECIES // [{ id: 'cattle', code: 'ctt', label: 'Cattle', summary: '...' }, ...]
MODULES // every module entry from src/modules.json
支持的分类是: register, (中文(简体) ), move, (中文(简体) ), death, (中文(简体) ), status 财务报告和审定财务报表 home。获得支持者
品种为牛(ctt),绵羊(shp),相机(cml)鸡肉(chk)和山羊(英语:gt) (中文(简体) ).
查询
每个查询返回 null 时,除了 getMountsForModule 财务报告和审定财务报表 getMountPath,该扔出.
import {
getTaxonomyById,
getSpeciesByCode,
getModuleById,
getModulesForHub,
hydrateModuleMetadata
} from '@defra/lis-hubs-infra-registry'
getTaxonomyById('move') // { id: 'move', label: 'Move', summary: '...' }
getSpeciesByCode('ctt') // { id: 'cattle', code: 'ctt', label: 'Cattle', ... }
getModuleById('cattle-move') // { id: 'cattle-move', mounts: { holding: ..., assets: ... }, port: 3204, ... }
getMountsForModule('cattle-home') // { holding: '/holdings/{cph*3}/cattle', animal: '/animals/cattle', assets: '/assets/cattle-home' }
getMountPath('cattle-home', 'holding', { cph: '12/345/0001' }) // '/holdings/12/345/0001/cattle'
getModulesForHub('front-office') // every module whose `hubs` includes 'front-office'
hydrateModuleMetadata(getModuleById('cattle-move'))
// the module plus `taxonomyLabel: 'Move'` and `speciesLabel: 'Cattle'`
// (falls back to the raw id or code if there is no match; returns null for null)
模块条目
src/modules.json 是一个数组。 每个条目都有这些字段:
| 外地 | 类型 | 含义 |
|---|---|---|
id | 字符串 | 模块编号。 匹配说话的重播名称,而不包含 lis-apps- 前缀. |
label | 字符串 | 向用户显示名称 . |
mounts | 对象 | 用挂载名称键入的 URL 中枢挂载发言的图案( 见下文) . |
port | 编号 | 在本地开发中. |
taxonomy | 字符串 | id 条目 src/supported-taxonomies.json。 。 。 . |
species | 字符串 | code 条目 src/supported-species.json。 。 。 . |
hubs | 字符串 [] | 服务于模块的枢纽. 每一个必须是一个 HUBS。 。 。 . |
例如:
{
"id": "cattle-move",
"label": "Move for Cattle",
"mounts": {
"holding": "/holdings/{cph*3}/cattle/move",
"assets": "/assets/cattle-move"
},
"port": 3204,
"taxonomy": "move",
"species": "ctt",
"hubs": ["front-office", "back-office"]
}
挂载
一个挂载是一个 URL 模式, 以 hopi 参数语法表示, 枢机服务于所讲的 。 URL 网络 树把牵引物放在首位,把物种放在下方, 所以每个说话的人都能够从一个 动物也可以到达一个物种的家:
| 挂载 | 图案 | 服务于 |
|---|---|---|
holding | /holdings/{cph*3}/<species> | 该物种的家园 |
holding | /holdings/{cph*3}/<species>/<taxonomy> | 每个动词说话 |
animal | /animals/<species> | 该物种的家园 |
<species> 是物种 id (单位:千美元)cattle),而不是它的代码. 通话人员将线路与
完全图案/holdings/{cph*3}/cattle/animals),中枢转发请求路径不变,
并同时与 getMountPath。一个发言服务于其已建成的CSS和JavaScript
assets 挂载, 它没有参数, 这样浏览器就可以在控股之间缓存它们 .
添加模块
- 创建已发言的应用程序 。 命名还原
lis-apps-<id>。 。 。 . - 将条目添加到
src/modules.json。使用一个独特的id, (中文(简体) ),mounts财务报告和审定财务报表port。 。 。 . - 如果物种或分类学是新的,请加入
src/supported-species.json或者说src/supported-taxonomies.json先说. - 在下方添加已发言的作曲文件
.tools/compose内 净值,在同一端口上发表. - 发布这个包,然后在枢纽和其他消费者中撞出.
中心站不需要改变路线. createProxyPlugin 内
双核 读取 getModulesForHub 财务报告和审定财务报表
为每个模块的挂载添加代理路由, 转发到服务 lis-apps-<id> 联 合 国
port (地方发展)路径不变. 演讲者也读过他们从这里到这里
服务。 。 。 .
先决条件
- 节点.js 24(见
.nvmrc,使用时nvm use(中文(简体) ) - 对照一个消费的应用程序检查更改: 净值 一次性设置完成
设置
发展
nvm use
npm install
测试
无法安装工具 npm install测试 维特。 。 。 .
正在发展中
这是一个库,所以它没有自己的服务器. 尝试改变一个消费应用 没有 发布, 将本地副本链接到 lis- dev 堆栈 :
cd lis-dev
.bin/sideload link hubs/infra-registry # every installed copy now points at this repo
.bin/sideload up front-office # optional: run a consumer locally with hot reload
.bin/sideload unlink hubs/infra-registry # when done
正在测试
npm test # unit tests
npm run test:coverage # with coverage
npm run lint # ESLint
npm run format:check # Prettier
在释放出一个变化之前,还要对连接包进行每个消耗回波的测试.
管道
GitHub 动作中运行的构建、版本和出版(.github/workflows)使用蛋糕脚本(*.cake:
- 将请求拉到
main: 校验(格式、林特、测试),声纳分析,版本检查 - 推到一个
feature/或者说hotfix/分支: 预发版本和标签 - 合并到
main: 释放标签,然后发布到 无
版本来自git标签 (SemVer). 合并后, 等待出版工作完成后, 才将套件撞入消耗回购中 .
分支政策
Repo采用干线开发. 分行从 main 并命名分支:
feature/LREG-<ticket>-<short-kebab-description>hotfix/LREG-<ticket>-<short-kebab-description>
LREG 必须是大写,因为 GitHub 规则拒绝其他分支名称。 重置为 main
而不是合并 main 进去.
协助这一项目
- 跟着 Defra软件开发标准。 。 。 .
npm install设置一个承诺前钩子(Husky),运行安全审计,格式检查和lint.- 地物分枝会撞倒小版本而热补丁分枝. 虽然包裹在0.x上,但对于公共API或模块条目外形的突破性改变,船舶作为小版本,所以在PR中叫出它,让消费者可以更新.
- 打开拉动请求
main使用 PR 模板。 CI必须通过而声纳质量门在合并前必须是绿色.
许可证
本资料系根据下列公开政府规定公布:
http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3 互联网档案馆的存檔,存档日期2013-12-21
在使用此信息时, 您的产品和应用程序中引用以下的归属声明 MUST .
载有根据开放政府许可证颁发的公共部门信息v3
关于许可证
开放政府许可证(OGL)由陛下文具办公室(HMSO)的主计长制定,使公共部门的信息提供者能够根据共同开放许可证许可其信息的使用和再使用.
它旨在鼓励自由和灵活地使用和再使用信息,仅附带一些条件.