@atproto/ lexicon: 计划验证库
TypeScript 执行 Lexicon 数据和 API schema 描述语言,这是其中的一部分 原子弹。 。 。 .
使用量
import { Lexicons } from '@atproto/lexicon'
// create your lexicons collection
const lex = new Lexicons()
// add lexicon documents
lex.add({
lex: 1,
id: 'com.example.post',
defs: {
// ...
}
})
// validate
lex.assertValidRecord('com.example.record', {$type: 'com.example.record', ...})
lex.assertValidXrpcParams('com.example.query', {...})
lex.assertValidXrpcInput('com.example.procedure', {...})
lex.assertValidXrpcOutput('com.example.query', {...})
许可证
根据麻省理工学院和Apache 2.0条款,这个项目具有双重许可证:
- 麻省理工学院许可证LICENSE-MIT.txt (英语) 或者说 http://opensource.org/licenses/MIT 互联网档案馆的存檔,存档日期2013-12-02(中文(简体) )
- Apache 许可证,2.0版本, ((原始内容存档于2017-09-31) (英语). LICENSE-APACHE.txt 或者说 http://www.apache.org/licenses/LICENSE-2.0 (中文(简体) )(中文(简体) )
下游项目和终端用户可自行选择单独或共同发放许可证。 这种双重许可的动机是Apache 2.0提供的额外软件专利保证.