@driftsys/markspec 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (484) hide show
  1. package/README.md +74 -20
  2. package/esm/ast/build.d.ts +11 -21
  3. package/esm/ast/build.d.ts.map +1 -1
  4. package/esm/ast/build.js +50 -139
  5. package/esm/ast/nodes.d.ts +11 -43
  6. package/esm/ast/nodes.d.ts.map +1 -1
  7. package/esm/ast/nodes.js +6 -1
  8. package/esm/ast/normalize.d.ts +8 -17
  9. package/esm/ast/normalize.d.ts.map +1 -1
  10. package/esm/ast/normalize.js +14 -72
  11. package/esm/compiler/constants.d.ts +16 -0
  12. package/esm/compiler/constants.d.ts.map +1 -0
  13. package/esm/compiler/constants.js +26 -0
  14. package/esm/compiler/discipline_classifier.d.ts +55 -0
  15. package/esm/compiler/discipline_classifier.d.ts.map +1 -0
  16. package/esm/compiler/discipline_classifier.js +191 -0
  17. package/esm/compiler/inverses.d.ts +7 -0
  18. package/esm/compiler/inverses.d.ts.map +1 -1
  19. package/esm/compiler/inverses.js +1 -18
  20. package/esm/compiler/mod.d.ts +30 -1
  21. package/esm/compiler/mod.d.ts.map +1 -1
  22. package/esm/compiler/mod.js +198 -65
  23. package/esm/compiler/schema.d.ts +15 -0
  24. package/esm/compiler/schema.d.ts.map +1 -1
  25. package/esm/compiler/schema.js +12 -0
  26. package/esm/config/markspec.d.ts +5 -0
  27. package/esm/config/markspec.d.ts.map +1 -1
  28. package/esm/config/markspec.js +17 -2
  29. package/esm/formatter/mod.d.ts +9 -3
  30. package/esm/formatter/mod.d.ts.map +1 -1
  31. package/esm/formatter/mod.js +97 -49
  32. package/esm/lexicons/loader.d.ts +35 -0
  33. package/esm/lexicons/loader.d.ts.map +1 -0
  34. package/esm/lexicons/loader.js +51 -0
  35. package/esm/lexicons/mod.d.ts +13 -0
  36. package/esm/lexicons/mod.d.ts.map +1 -0
  37. package/esm/lexicons/mod.js +12 -0
  38. package/esm/lint/glossary.d.ts +45 -0
  39. package/esm/lint/glossary.d.ts.map +1 -0
  40. package/esm/lint/glossary.js +85 -0
  41. package/esm/lint/mod.d.ts +4 -0
  42. package/esm/lint/mod.d.ts.map +1 -1
  43. package/esm/lint/mod.js +2 -0
  44. package/esm/lint/range_util.d.ts +25 -0
  45. package/esm/lint/range_util.d.ts.map +1 -0
  46. package/esm/lint/range_util.js +50 -0
  47. package/esm/lint/rules/ears.d.ts +39 -0
  48. package/esm/lint/rules/ears.d.ts.map +1 -0
  49. package/esm/lint/rules/ears.js +316 -0
  50. package/esm/lint/rules/incose_sentence.d.ts +46 -0
  51. package/esm/lint/rules/incose_sentence.d.ts.map +1 -0
  52. package/esm/lint/rules/incose_sentence.js +417 -0
  53. package/esm/lint/rules/modal_sentence.d.ts +46 -0
  54. package/esm/lint/rules/modal_sentence.d.ts.map +1 -0
  55. package/esm/lint/rules/modal_sentence.js +146 -0
  56. package/esm/lint/rules/passive.d.ts +64 -0
  57. package/esm/lint/rules/passive.d.ts.map +1 -0
  58. package/esm/lint/rules/passive.js +282 -0
  59. package/esm/lint/rules/suppression.d.ts +38 -3
  60. package/esm/lint/rules/suppression.d.ts.map +1 -1
  61. package/esm/lint/rules/suppression.js +58 -4
  62. package/esm/lint/rules/xref.d.ts +19 -0
  63. package/esm/lint/rules/xref.d.ts.map +1 -0
  64. package/esm/lint/rules/xref.js +248 -0
  65. package/esm/lint/runner.d.ts +31 -11
  66. package/esm/lint/runner.d.ts.map +1 -1
  67. package/esm/lint/runner.js +67 -26
  68. package/esm/lint/score.d.ts +64 -0
  69. package/esm/lint/score.d.ts.map +1 -0
  70. package/esm/lint/score.js +163 -0
  71. package/esm/lint/segmenter.d.ts +32 -0
  72. package/esm/lint/segmenter.d.ts.map +1 -0
  73. package/esm/lint/segmenter.js +79 -0
  74. package/esm/lint/types.d.ts +12 -0
  75. package/esm/lint/types.d.ts.map +1 -1
  76. package/esm/lock/canonical_edges.d.ts +31 -0
  77. package/esm/lock/canonical_edges.d.ts.map +1 -0
  78. package/esm/lock/canonical_edges.js +57 -0
  79. package/esm/lock/check.d.ts +24 -0
  80. package/esm/lock/check.d.ts.map +1 -0
  81. package/esm/lock/check.js +127 -0
  82. package/esm/lock/hash.d.ts +12 -0
  83. package/esm/lock/hash.d.ts.map +1 -0
  84. package/esm/lock/hash.js +32 -0
  85. package/esm/lock/mod.d.ts +19 -0
  86. package/esm/lock/mod.d.ts.map +1 -0
  87. package/esm/lock/mod.js +14 -0
  88. package/esm/lock/model.d.ts +81 -0
  89. package/esm/lock/model.d.ts.map +1 -0
  90. package/esm/lock/model.js +7 -0
  91. package/esm/lock/parser.d.ts +26 -0
  92. package/esm/lock/parser.d.ts.map +1 -0
  93. package/esm/lock/parser.js +195 -0
  94. package/esm/lock/resolve.d.ts +142 -0
  95. package/esm/lock/resolve.d.ts.map +1 -0
  96. package/esm/lock/resolve.js +389 -0
  97. package/esm/lock/serializer.d.ts +14 -0
  98. package/esm/lock/serializer.d.ts.map +1 -0
  99. package/esm/lock/serializer.js +104 -0
  100. package/esm/mod.d.ts +16 -9
  101. package/esm/mod.d.ts.map +1 -1
  102. package/esm/mod.js +12 -4
  103. package/esm/model/attributes.d.ts +6 -0
  104. package/esm/model/attributes.d.ts.map +1 -1
  105. package/esm/model/attributes.js +37 -0
  106. package/esm/model/discipline.d.ts +53 -0
  107. package/esm/model/discipline.d.ts.map +1 -0
  108. package/esm/model/discipline.js +50 -0
  109. package/esm/model/mod.d.ts +188 -30
  110. package/esm/model/mod.d.ts.map +1 -1
  111. package/esm/model/mod.js +42 -1
  112. package/esm/model/profile.d.ts +69 -0
  113. package/esm/model/profile.d.ts.map +1 -1
  114. package/esm/parser/attributes.d.ts.map +1 -1
  115. package/esm/parser/attributes.js +1 -10
  116. package/esm/parser/body_tokens.d.ts +35 -0
  117. package/esm/parser/body_tokens.d.ts.map +1 -0
  118. package/esm/parser/body_tokens.js +232 -0
  119. package/esm/parser/glossary.d.ts +8 -0
  120. package/esm/parser/glossary.d.ts.map +1 -1
  121. package/esm/parser/glossary.js +6 -4
  122. package/esm/parser/grammars.d.ts +5 -3
  123. package/esm/parser/grammars.d.ts.map +1 -1
  124. package/esm/parser/grammars.js +12 -4
  125. package/esm/parser/language_spec.d.ts +55 -0
  126. package/esm/parser/language_spec.d.ts.map +1 -0
  127. package/esm/parser/language_spec.js +419 -0
  128. package/esm/parser/line_map.d.ts +60 -0
  129. package/esm/parser/line_map.d.ts.map +1 -0
  130. package/esm/parser/line_map.js +41 -0
  131. package/esm/parser/markdown.d.ts +9 -0
  132. package/esm/parser/markdown.d.ts.map +1 -1
  133. package/esm/parser/markdown.js +107 -31
  134. package/esm/parser/mod.d.ts +4 -0
  135. package/esm/parser/mod.d.ts.map +1 -1
  136. package/esm/parser/mod.js +30 -8
  137. package/esm/parser/source.d.ts +39 -8
  138. package/esm/parser/source.d.ts.map +1 -1
  139. package/esm/parser/source.js +155 -65
  140. package/esm/parser/translate.d.ts +24 -0
  141. package/esm/parser/translate.d.ts.map +1 -0
  142. package/esm/parser/translate.js +99 -0
  143. package/esm/profile/chain.d.ts +8 -0
  144. package/esm/profile/chain.d.ts.map +1 -1
  145. package/esm/profile/chain.js +29 -1
  146. package/esm/profile/default_profile.d.ts +25 -0
  147. package/esm/profile/default_profile.d.ts.map +1 -0
  148. package/esm/profile/default_profile.js +43 -0
  149. package/esm/profile/discipline_mode.d.ts +64 -0
  150. package/esm/profile/discipline_mode.d.ts.map +1 -0
  151. package/esm/profile/discipline_mode.js +133 -0
  152. package/esm/profile/discipline_registry.d.ts +41 -0
  153. package/esm/profile/discipline_registry.d.ts.map +1 -0
  154. package/esm/profile/discipline_registry.js +67 -0
  155. package/esm/profile/load.d.ts +3 -1
  156. package/esm/profile/load.d.ts.map +1 -1
  157. package/esm/profile/load.js +24 -5
  158. package/esm/profile/manifest.d.ts.map +1 -1
  159. package/esm/profile/manifest.js +253 -20
  160. package/esm/profile/merge.d.ts.map +1 -1
  161. package/esm/profile/merge.js +112 -0
  162. package/esm/profile/mod.d.ts +2 -0
  163. package/esm/profile/mod.d.ts.map +1 -1
  164. package/esm/profile/mod.js +2 -0
  165. package/esm/sync/locked_attributes.d.ts +19 -0
  166. package/esm/sync/locked_attributes.d.ts.map +1 -0
  167. package/esm/sync/locked_attributes.js +27 -0
  168. package/esm/sync/log.d.ts +34 -0
  169. package/esm/sync/log.d.ts.map +1 -0
  170. package/esm/sync/log.js +48 -0
  171. package/esm/sync/mapping.d.ts +66 -0
  172. package/esm/sync/mapping.d.ts.map +1 -0
  173. package/esm/sync/mapping.js +165 -0
  174. package/esm/sync/mod.d.ts +16 -0
  175. package/esm/sync/mod.d.ts.map +1 -0
  176. package/esm/sync/mod.js +12 -0
  177. package/esm/sync/status.d.ts +23 -0
  178. package/esm/sync/status.d.ts.map +1 -0
  179. package/esm/sync/status.js +21 -0
  180. package/esm/typl/ast.d.ts +87 -0
  181. package/esm/typl/ast.d.ts.map +1 -0
  182. package/esm/typl/ast.js +21 -0
  183. package/esm/typl/bridge.d.ts +32 -0
  184. package/esm/typl/bridge.d.ts.map +1 -0
  185. package/esm/typl/bridge.js +27 -0
  186. package/esm/typl/bullet.d.ts +34 -0
  187. package/esm/typl/bullet.d.ts.map +1 -0
  188. package/esm/typl/bullet.js +44 -0
  189. package/esm/typl/diagnostics.d.ts +43 -0
  190. package/esm/typl/diagnostics.d.ts.map +1 -0
  191. package/esm/typl/diagnostics.js +61 -0
  192. package/esm/typl/fence.d.ts +31 -0
  193. package/esm/typl/fence.d.ts.map +1 -0
  194. package/esm/typl/fence.js +24 -0
  195. package/esm/typl/grammar.d.ts +20 -0
  196. package/esm/typl/grammar.d.ts.map +1 -0
  197. package/esm/typl/grammar.js +471 -0
  198. package/esm/typl/inline.d.ts +34 -0
  199. package/esm/typl/inline.d.ts.map +1 -0
  200. package/esm/typl/inline.js +48 -0
  201. package/esm/typl/lexer.d.ts +37 -0
  202. package/esm/typl/lexer.d.ts.map +1 -0
  203. package/esm/typl/lexer.js +234 -0
  204. package/esm/typl/mod.d.ts +23 -0
  205. package/esm/typl/mod.d.ts.map +1 -0
  206. package/esm/typl/mod.js +16 -0
  207. package/esm/typl/registry.d.ts +42 -0
  208. package/esm/typl/registry.d.ts.map +1 -0
  209. package/esm/typl/registry.js +26 -0
  210. package/esm/typl/validator.d.ts +29 -0
  211. package/esm/typl/validator.d.ts.map +1 -0
  212. package/esm/typl/validator.js +141 -0
  213. package/esm/util/line_endings.d.ts +33 -0
  214. package/esm/util/line_endings.d.ts.map +1 -0
  215. package/esm/util/line_endings.js +53 -0
  216. package/esm/util/modals.d.ts +29 -0
  217. package/esm/util/modals.d.ts.map +1 -0
  218. package/esm/util/modals.js +38 -0
  219. package/esm/validator/discipline.d.ts +35 -0
  220. package/esm/validator/discipline.d.ts.map +1 -0
  221. package/esm/validator/discipline.js +204 -0
  222. package/esm/validator/mod.d.ts +1 -1
  223. package/esm/validator/mod.d.ts.map +1 -1
  224. package/esm/validator/mod.js +23 -2
  225. package/esm/validator/modal_keywords.d.ts +15 -13
  226. package/esm/validator/modal_keywords.d.ts.map +1 -1
  227. package/esm/validator/modal_keywords.js +26 -109
  228. package/esm/validator/pattern.d.ts +15 -8
  229. package/esm/validator/pattern.d.ts.map +1 -1
  230. package/esm/validator/pattern.js +42 -19
  231. package/esm/validator/per_type_attrs.d.ts +2 -2
  232. package/esm/validator/per_type_attrs.d.ts.map +1 -1
  233. package/esm/validator/per_type_attrs.js +2 -2
  234. package/esm/validator/pipeline.d.ts +11 -0
  235. package/esm/validator/pipeline.d.ts.map +1 -1
  236. package/esm/validator/pipeline.js +37 -15
  237. package/esm/validator/type_resolution.d.ts +3 -3
  238. package/esm/validator/type_resolution.d.ts.map +1 -1
  239. package/esm/validator/type_resolution.js +31 -9
  240. package/package.json +2 -2
  241. package/script/ast/build.d.ts +11 -21
  242. package/script/ast/build.d.ts.map +1 -1
  243. package/script/ast/build.js +51 -140
  244. package/script/ast/nodes.d.ts +11 -43
  245. package/script/ast/nodes.d.ts.map +1 -1
  246. package/script/ast/nodes.js +6 -1
  247. package/script/ast/normalize.d.ts +8 -17
  248. package/script/ast/normalize.d.ts.map +1 -1
  249. package/script/ast/normalize.js +16 -74
  250. package/script/compiler/constants.d.ts +16 -0
  251. package/script/compiler/constants.d.ts.map +1 -0
  252. package/script/compiler/constants.js +29 -0
  253. package/script/compiler/discipline_classifier.d.ts +55 -0
  254. package/script/compiler/discipline_classifier.d.ts.map +1 -0
  255. package/script/compiler/discipline_classifier.js +196 -0
  256. package/script/compiler/inverses.d.ts +7 -0
  257. package/script/compiler/inverses.d.ts.map +1 -1
  258. package/script/compiler/inverses.js +2 -19
  259. package/script/compiler/mod.d.ts +30 -1
  260. package/script/compiler/mod.d.ts.map +1 -1
  261. package/script/compiler/mod.js +202 -69
  262. package/script/compiler/schema.d.ts +15 -0
  263. package/script/compiler/schema.d.ts.map +1 -1
  264. package/script/compiler/schema.js +12 -0
  265. package/script/config/markspec.d.ts +5 -0
  266. package/script/config/markspec.d.ts.map +1 -1
  267. package/script/config/markspec.js +17 -2
  268. package/script/formatter/mod.d.ts +9 -3
  269. package/script/formatter/mod.d.ts.map +1 -1
  270. package/script/formatter/mod.js +99 -51
  271. package/script/lexicons/loader.d.ts +35 -0
  272. package/script/lexicons/loader.d.ts.map +1 -0
  273. package/script/lexicons/loader.js +55 -0
  274. package/script/lexicons/mod.d.ts +13 -0
  275. package/script/lexicons/mod.d.ts.map +1 -0
  276. package/script/lexicons/mod.js +17 -0
  277. package/script/lint/glossary.d.ts +45 -0
  278. package/script/lint/glossary.d.ts.map +1 -0
  279. package/script/lint/glossary.js +88 -0
  280. package/script/lint/mod.d.ts +4 -0
  281. package/script/lint/mod.d.ts.map +1 -1
  282. package/script/lint/mod.js +6 -1
  283. package/script/lint/range_util.d.ts +25 -0
  284. package/script/lint/range_util.d.ts.map +1 -0
  285. package/script/lint/range_util.js +53 -0
  286. package/script/lint/rules/ears.d.ts +39 -0
  287. package/script/lint/rules/ears.d.ts.map +1 -0
  288. package/script/lint/rules/ears.js +320 -0
  289. package/script/lint/rules/incose_sentence.d.ts +46 -0
  290. package/script/lint/rules/incose_sentence.d.ts.map +1 -0
  291. package/script/lint/rules/incose_sentence.js +421 -0
  292. package/script/lint/rules/modal_sentence.d.ts +46 -0
  293. package/script/lint/rules/modal_sentence.d.ts.map +1 -0
  294. package/script/lint/rules/modal_sentence.js +150 -0
  295. package/script/lint/rules/passive.d.ts +64 -0
  296. package/script/lint/rules/passive.d.ts.map +1 -0
  297. package/script/lint/rules/passive.js +286 -0
  298. package/script/lint/rules/suppression.d.ts +38 -3
  299. package/script/lint/rules/suppression.d.ts.map +1 -1
  300. package/script/lint/rules/suppression.js +59 -3
  301. package/script/lint/rules/xref.d.ts +19 -0
  302. package/script/lint/rules/xref.d.ts.map +1 -0
  303. package/script/lint/rules/xref.js +251 -0
  304. package/script/lint/runner.d.ts +31 -11
  305. package/script/lint/runner.d.ts.map +1 -1
  306. package/script/lint/runner.js +67 -26
  307. package/script/lint/score.d.ts +64 -0
  308. package/script/lint/score.d.ts.map +1 -0
  309. package/script/lint/score.js +167 -0
  310. package/script/lint/segmenter.d.ts +32 -0
  311. package/script/lint/segmenter.d.ts.map +1 -0
  312. package/script/lint/segmenter.js +82 -0
  313. package/script/lint/types.d.ts +12 -0
  314. package/script/lint/types.d.ts.map +1 -1
  315. package/script/lock/canonical_edges.d.ts +31 -0
  316. package/script/lock/canonical_edges.d.ts.map +1 -0
  317. package/script/lock/canonical_edges.js +61 -0
  318. package/script/lock/check.d.ts +24 -0
  319. package/script/lock/check.d.ts.map +1 -0
  320. package/script/lock/check.js +130 -0
  321. package/script/lock/hash.d.ts +12 -0
  322. package/script/lock/hash.d.ts.map +1 -0
  323. package/script/lock/hash.js +36 -0
  324. package/script/lock/mod.d.ts +19 -0
  325. package/script/lock/mod.d.ts.map +1 -0
  326. package/script/lock/mod.js +31 -0
  327. package/script/lock/model.d.ts +81 -0
  328. package/script/lock/model.d.ts.map +1 -0
  329. package/script/lock/model.js +10 -0
  330. package/script/lock/parser.d.ts +26 -0
  331. package/script/lock/parser.d.ts.map +1 -0
  332. package/script/lock/parser.js +198 -0
  333. package/script/lock/resolve.d.ts +142 -0
  334. package/script/lock/resolve.d.ts.map +1 -0
  335. package/script/lock/resolve.js +397 -0
  336. package/script/lock/serializer.d.ts +14 -0
  337. package/script/lock/serializer.d.ts.map +1 -0
  338. package/script/lock/serializer.js +107 -0
  339. package/script/mod.d.ts +16 -9
  340. package/script/mod.d.ts.map +1 -1
  341. package/script/mod.js +111 -38
  342. package/script/model/attributes.d.ts +6 -0
  343. package/script/model/attributes.d.ts.map +1 -1
  344. package/script/model/attributes.js +38 -1
  345. package/script/model/discipline.d.ts +53 -0
  346. package/script/model/discipline.d.ts.map +1 -0
  347. package/script/model/discipline.js +53 -0
  348. package/script/model/mod.d.ts +188 -30
  349. package/script/model/mod.d.ts.map +1 -1
  350. package/script/model/mod.js +48 -1
  351. package/script/model/profile.d.ts +69 -0
  352. package/script/model/profile.d.ts.map +1 -1
  353. package/script/parser/attributes.d.ts.map +1 -1
  354. package/script/parser/attributes.js +1 -10
  355. package/script/parser/body_tokens.d.ts +35 -0
  356. package/script/parser/body_tokens.d.ts.map +1 -0
  357. package/script/parser/body_tokens.js +235 -0
  358. package/script/parser/glossary.d.ts +8 -0
  359. package/script/parser/glossary.d.ts.map +1 -1
  360. package/script/parser/glossary.js +7 -4
  361. package/script/parser/grammars.d.ts +5 -3
  362. package/script/parser/grammars.d.ts.map +1 -1
  363. package/script/parser/grammars.js +15 -8
  364. package/script/parser/language_spec.d.ts +55 -0
  365. package/script/parser/language_spec.d.ts.map +1 -0
  366. package/script/parser/language_spec.js +423 -0
  367. package/script/parser/line_map.d.ts +60 -0
  368. package/script/parser/line_map.d.ts.map +1 -0
  369. package/script/parser/line_map.js +44 -0
  370. package/script/parser/markdown.d.ts +9 -0
  371. package/script/parser/markdown.d.ts.map +1 -1
  372. package/script/parser/markdown.js +105 -29
  373. package/script/parser/mod.d.ts +4 -0
  374. package/script/parser/mod.d.ts.map +1 -1
  375. package/script/parser/mod.js +32 -7
  376. package/script/parser/source.d.ts +39 -8
  377. package/script/parser/source.d.ts.map +1 -1
  378. package/script/parser/source.js +156 -69
  379. package/script/parser/translate.d.ts +24 -0
  380. package/script/parser/translate.d.ts.map +1 -0
  381. package/script/parser/translate.js +102 -0
  382. package/script/profile/chain.d.ts +8 -0
  383. package/script/profile/chain.d.ts.map +1 -1
  384. package/script/profile/chain.js +29 -1
  385. package/script/profile/default_profile.d.ts +25 -0
  386. package/script/profile/default_profile.d.ts.map +1 -0
  387. package/script/profile/default_profile.js +46 -0
  388. package/script/profile/discipline_mode.d.ts +64 -0
  389. package/script/profile/discipline_mode.d.ts.map +1 -0
  390. package/script/profile/discipline_mode.js +138 -0
  391. package/script/profile/discipline_registry.d.ts +41 -0
  392. package/script/profile/discipline_registry.d.ts.map +1 -0
  393. package/script/profile/discipline_registry.js +70 -0
  394. package/script/profile/load.d.ts +3 -1
  395. package/script/profile/load.d.ts.map +1 -1
  396. package/script/profile/load.js +24 -5
  397. package/script/profile/manifest.d.ts.map +1 -1
  398. package/script/profile/manifest.js +252 -19
  399. package/script/profile/merge.d.ts.map +1 -1
  400. package/script/profile/merge.js +112 -0
  401. package/script/profile/mod.d.ts +2 -0
  402. package/script/profile/mod.d.ts.map +1 -1
  403. package/script/profile/mod.js +6 -1
  404. package/script/sync/locked_attributes.d.ts +19 -0
  405. package/script/sync/locked_attributes.d.ts.map +1 -0
  406. package/script/sync/locked_attributes.js +30 -0
  407. package/script/sync/log.d.ts +34 -0
  408. package/script/sync/log.d.ts.map +1 -0
  409. package/script/sync/log.js +52 -0
  410. package/script/sync/mapping.d.ts +66 -0
  411. package/script/sync/mapping.d.ts.map +1 -0
  412. package/script/sync/mapping.js +169 -0
  413. package/script/sync/mod.d.ts +16 -0
  414. package/script/sync/mod.d.ts.map +1 -0
  415. package/script/sync/mod.js +21 -0
  416. package/script/sync/status.d.ts +23 -0
  417. package/script/sync/status.d.ts.map +1 -0
  418. package/script/sync/status.js +24 -0
  419. package/script/typl/ast.d.ts +87 -0
  420. package/script/typl/ast.d.ts.map +1 -0
  421. package/script/typl/ast.js +24 -0
  422. package/script/typl/bridge.d.ts +32 -0
  423. package/script/typl/bridge.d.ts.map +1 -0
  424. package/script/typl/bridge.js +30 -0
  425. package/script/typl/bullet.d.ts +34 -0
  426. package/script/typl/bullet.d.ts.map +1 -0
  427. package/script/typl/bullet.js +47 -0
  428. package/script/typl/diagnostics.d.ts +43 -0
  429. package/script/typl/diagnostics.d.ts.map +1 -0
  430. package/script/typl/diagnostics.js +65 -0
  431. package/script/typl/fence.d.ts +31 -0
  432. package/script/typl/fence.d.ts.map +1 -0
  433. package/script/typl/fence.js +27 -0
  434. package/script/typl/grammar.d.ts +20 -0
  435. package/script/typl/grammar.d.ts.map +1 -0
  436. package/script/typl/grammar.js +474 -0
  437. package/script/typl/inline.d.ts +34 -0
  438. package/script/typl/inline.d.ts.map +1 -0
  439. package/script/typl/inline.js +51 -0
  440. package/script/typl/lexer.d.ts +37 -0
  441. package/script/typl/lexer.d.ts.map +1 -0
  442. package/script/typl/lexer.js +237 -0
  443. package/script/typl/mod.d.ts +23 -0
  444. package/script/typl/mod.d.ts.map +1 -0
  445. package/script/typl/mod.js +29 -0
  446. package/script/typl/registry.d.ts +42 -0
  447. package/script/typl/registry.d.ts.map +1 -0
  448. package/script/typl/registry.js +29 -0
  449. package/script/typl/validator.d.ts +29 -0
  450. package/script/typl/validator.d.ts.map +1 -0
  451. package/script/typl/validator.js +144 -0
  452. package/script/util/line_endings.d.ts +33 -0
  453. package/script/util/line_endings.d.ts.map +1 -0
  454. package/script/util/line_endings.js +58 -0
  455. package/script/util/modals.d.ts +29 -0
  456. package/script/util/modals.d.ts.map +1 -0
  457. package/script/util/modals.js +42 -0
  458. package/script/validator/discipline.d.ts +35 -0
  459. package/script/validator/discipline.d.ts.map +1 -0
  460. package/script/validator/discipline.js +207 -0
  461. package/script/validator/mod.d.ts +1 -1
  462. package/script/validator/mod.d.ts.map +1 -1
  463. package/script/validator/mod.js +23 -1
  464. package/script/validator/modal_keywords.d.ts +15 -13
  465. package/script/validator/modal_keywords.d.ts.map +1 -1
  466. package/script/validator/modal_keywords.js +26 -109
  467. package/script/validator/pattern.d.ts +15 -8
  468. package/script/validator/pattern.d.ts.map +1 -1
  469. package/script/validator/pattern.js +42 -19
  470. package/script/validator/per_type_attrs.d.ts +2 -2
  471. package/script/validator/per_type_attrs.d.ts.map +1 -1
  472. package/script/validator/per_type_attrs.js +2 -2
  473. package/script/validator/pipeline.d.ts +11 -0
  474. package/script/validator/pipeline.d.ts.map +1 -1
  475. package/script/validator/pipeline.js +40 -17
  476. package/script/validator/type_resolution.d.ts +3 -3
  477. package/script/validator/type_resolution.d.ts.map +1 -1
  478. package/script/validator/type_resolution.js +31 -9
  479. package/esm/parser/entity_refs.d.ts +0 -53
  480. package/esm/parser/entity_refs.d.ts.map +0 -1
  481. package/esm/parser/entity_refs.js +0 -151
  482. package/script/parser/entity_refs.d.ts +0 -53
  483. package/script/parser/entity_refs.d.ts.map +0 -1
  484. package/script/parser/entity_refs.js +0 -155
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/lock
4
+ *
5
+ * Lockfile data model, TOML serializer + parser, canonical edge
6
+ * model, upstream resolution, drift detection. The public boundary
7
+ * for both `markspec lock` and `markspec compile --frozen`.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.resolveUpstreams = exports.resolveRegistries = exports.resolveReferences = exports.resolveProfileChain = exports.resolveBoundEntries = exports.extractEdgeQuads = exports.hashCanonicalEdges = exports.canonicalEdgeJson = exports.sha256String = exports.sha256Bytes = exports.checkDrift = exports.parseLockfile = exports.serializeLockfile = exports.LOCKFILE_SCHEMA_VERSION = void 0;
11
+ var model_js_1 = require("./model.js");
12
+ Object.defineProperty(exports, "LOCKFILE_SCHEMA_VERSION", { enumerable: true, get: function () { return model_js_1.LOCKFILE_SCHEMA_VERSION; } });
13
+ var serializer_js_1 = require("./serializer.js");
14
+ Object.defineProperty(exports, "serializeLockfile", { enumerable: true, get: function () { return serializer_js_1.serializeLockfile; } });
15
+ var parser_js_1 = require("./parser.js");
16
+ Object.defineProperty(exports, "parseLockfile", { enumerable: true, get: function () { return parser_js_1.parseLockfile; } });
17
+ var check_js_1 = require("./check.js");
18
+ Object.defineProperty(exports, "checkDrift", { enumerable: true, get: function () { return check_js_1.checkDrift; } });
19
+ var hash_js_1 = require("./hash.js");
20
+ Object.defineProperty(exports, "sha256Bytes", { enumerable: true, get: function () { return hash_js_1.sha256Bytes; } });
21
+ Object.defineProperty(exports, "sha256String", { enumerable: true, get: function () { return hash_js_1.sha256String; } });
22
+ var canonical_edges_js_1 = require("./canonical_edges.js");
23
+ Object.defineProperty(exports, "canonicalEdgeJson", { enumerable: true, get: function () { return canonical_edges_js_1.canonicalEdgeJson; } });
24
+ Object.defineProperty(exports, "hashCanonicalEdges", { enumerable: true, get: function () { return canonical_edges_js_1.hashCanonicalEdges; } });
25
+ var resolve_js_1 = require("./resolve.js");
26
+ Object.defineProperty(exports, "extractEdgeQuads", { enumerable: true, get: function () { return resolve_js_1.extractEdgeQuads; } });
27
+ Object.defineProperty(exports, "resolveBoundEntries", { enumerable: true, get: function () { return resolve_js_1.resolveBoundEntries; } });
28
+ Object.defineProperty(exports, "resolveProfileChain", { enumerable: true, get: function () { return resolve_js_1.resolveProfileChain; } });
29
+ Object.defineProperty(exports, "resolveReferences", { enumerable: true, get: function () { return resolve_js_1.resolveReferences; } });
30
+ Object.defineProperty(exports, "resolveRegistries", { enumerable: true, get: function () { return resolve_js_1.resolveRegistries; } });
31
+ Object.defineProperty(exports, "resolveUpstreams", { enumerable: true, get: function () { return resolve_js_1.resolveUpstreams; } });
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @module core/lock/model
3
+ *
4
+ * Lockfile data model. Pure types — no I/O, no behaviour.
5
+ */
6
+ /** A resolved Reference citation. */
7
+ export interface UpstreamReference {
8
+ readonly kind: "reference";
9
+ /** Pandoc-style slug (display ID of the Reference entry). */
10
+ readonly slug: string;
11
+ /** Canonical URI (urn:/doi:/pkg:/isbn:/https: etc.). */
12
+ readonly id: string;
13
+ /** Version segment extracted from the URI, when present. */
14
+ readonly resolved?: string;
15
+ /** sha256:* of fetched bytes; absent when Reference-url was missing. */
16
+ readonly hash?: string;
17
+ /** Fetch URL (from Reference-url); absent when Reference-url was missing. */
18
+ readonly source?: string;
19
+ /** listing-directives §5 scheme (urn / purl etc.), if classified. */
20
+ readonly componentScheme?: string;
21
+ }
22
+ /** A resolved profile chain tier. */
23
+ export interface UpstreamProfile {
24
+ readonly kind: "profile";
25
+ readonly id: string;
26
+ /** Original specifier from .markspec.yaml (e.g. `npm:@org/aspice@^1.2`). */
27
+ readonly specifier: string;
28
+ /** Exact resolved version (e.g. `1.2.4`). */
29
+ readonly resolved: string;
30
+ /** sha256:* of the resolved profile's markspec.yaml bytes. */
31
+ readonly hash: string;
32
+ /** Parent tier id in the extends chain; absent for the chain root. */
33
+ readonly extends?: string;
34
+ }
35
+ /** A resolved federated registry. */
36
+ export interface UpstreamRegistry {
37
+ readonly kind: "registry";
38
+ readonly id: string;
39
+ readonly api: string;
40
+ readonly resolvedManifestHash: string;
41
+ readonly markspecSchema: number;
42
+ }
43
+ /** Discriminated union of upstream kinds. */
44
+ export type Upstream = UpstreamReference | UpstreamProfile | UpstreamRegistry;
45
+ /** A locked attribute on a binding — attribute name → upstream value hash. */
46
+ export type LockedAttributes = ReadonlyMap<string, string>;
47
+ /** One External-id binding within a bound entry. */
48
+ export interface BoundEntryBinding {
49
+ readonly externalId: string;
50
+ readonly system: string;
51
+ readonly direction: "outbound" | "inbound" | "bidirectional";
52
+ readonly lockedAttributes: LockedAttributes;
53
+ }
54
+ /** An entry bound to one or more external systems via External-id. */
55
+ export interface BoundEntry {
56
+ readonly displayId: string;
57
+ readonly ulid: string;
58
+ readonly bindings: readonly BoundEntryBinding[];
59
+ }
60
+ /** Canonical-edge-graph integrity record. */
61
+ export interface GeneratedCache {
62
+ readonly edgesHash: string;
63
+ readonly edgesCount: number;
64
+ }
65
+ /** Lockfile metadata. */
66
+ export interface LockfileMeta {
67
+ readonly markspecSchema: number;
68
+ /** Timestamp the lockfile was written, RFC 3339 UTC (e.g. "2026-05-25T12:00:00Z"). */
69
+ readonly lockedAt: string;
70
+ }
71
+ /** Top-level lockfile model. */
72
+ export interface Lockfile {
73
+ readonly schema: number;
74
+ readonly meta: LockfileMeta;
75
+ readonly upstreams: readonly Upstream[];
76
+ readonly boundEntries: readonly BoundEntry[];
77
+ readonly generatedCache: GeneratedCache;
78
+ }
79
+ /** Current lockfile-format version. */
80
+ export declare const LOCKFILE_SCHEMA_VERSION = 1;
81
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lock/model.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,qCAAqC;AACrC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,6CAA6C;AAC7C,MAAM,MAAM,QAAQ,GAChB,iBAAiB,GACjB,eAAe,GACf,gBAAgB,CAAC;AAErB,8EAA8E;AAC9E,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3D,oDAAoD;AACpD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,UAAU,GAAG,SAAS,GAAG,eAAe,CAAC;IAC7D,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;CAC7C;AAED,sEAAsE;AACtE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACjD;AAED,6CAA6C;AAC7C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,yBAAyB;AACzB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,sFAAsF;IACtF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,gCAAgC;AAChC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,SAAS,UAAU,EAAE,CAAC;IAC7C,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;CACzC;AAED,uCAAuC;AACvC,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/lock/model
4
+ *
5
+ * Lockfile data model. Pure types — no I/O, no behaviour.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.LOCKFILE_SCHEMA_VERSION = void 0;
9
+ /** Current lockfile-format version. */
10
+ exports.LOCKFILE_SCHEMA_VERSION = 1;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @module core/lock/parser
3
+ *
4
+ * TOML → Lockfile. Uses @std/toml for low-level parse; layers schema
5
+ * validation + diagnostic emission on top.
6
+ *
7
+ * Diagnostic codes:
8
+ * - MSL-L001 — malformed TOML or missing required field
9
+ * - MSL-L002 — lockfile schema is newer than this binary supports
10
+ * - MSL-L003 — lockfile schema is unrecognised (< 1)
11
+ */
12
+ import type { Diagnostic } from "../model/mod.js";
13
+ import { type Lockfile } from "./model.js";
14
+ /** Outcome of {@linkcode parseLockfile}. */
15
+ export interface ParseLockfileResult {
16
+ readonly lockfile?: Lockfile;
17
+ readonly diagnostics: readonly Diagnostic[];
18
+ }
19
+ /**
20
+ * Parse a `markspec.lock` document. Returns the model when valid, or a
21
+ * single `MSL-L###` diagnostic when not. Schema-validation errors are
22
+ * always single-shot: parsing stops at the first integrity failure so
23
+ * the caller has a clear repair signal.
24
+ */
25
+ export declare function parseLockfile(toml: string): ParseLockfileResult;
26
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/lock/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAGL,KAAK,QAAQ,EAGd,MAAM,YAAY,CAAC;AAEpB,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CA+L/D"}
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/lock/parser
4
+ *
5
+ * TOML → Lockfile. Uses @std/toml for low-level parse; layers schema
6
+ * validation + diagnostic emission on top.
7
+ *
8
+ * Diagnostic codes:
9
+ * - MSL-L001 — malformed TOML or missing required field
10
+ * - MSL-L002 — lockfile schema is newer than this binary supports
11
+ * - MSL-L003 — lockfile schema is unrecognised (< 1)
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.parseLockfile = parseLockfile;
15
+ const toml_1 = require("@std/toml");
16
+ const model_js_1 = require("./model.js");
17
+ /**
18
+ * Parse a `markspec.lock` document. Returns the model when valid, or a
19
+ * single `MSL-L###` diagnostic when not. Schema-validation errors are
20
+ * always single-shot: parsing stops at the first integrity failure so
21
+ * the caller has a clear repair signal.
22
+ */
23
+ function parseLockfile(toml) {
24
+ let raw;
25
+ try {
26
+ raw = (0, toml_1.parse)(toml);
27
+ }
28
+ catch (e) {
29
+ return diag("MSL-L001", `Malformed markspec.lock: ${e.message}`);
30
+ }
31
+ const schema = raw.schema;
32
+ if (typeof schema !== "number") {
33
+ return diag("MSL-L001", "Missing or invalid `schema` field");
34
+ }
35
+ if (schema > model_js_1.LOCKFILE_SCHEMA_VERSION) {
36
+ return diag("MSL-L002", `Lockfile schema ${schema} is newer than this binary understands ` +
37
+ `(max ${model_js_1.LOCKFILE_SCHEMA_VERSION}). Upgrade markspec or delete ` +
38
+ `markspec.lock + relock.`);
39
+ }
40
+ if (schema < 1) {
41
+ return diag("MSL-L003", `Lockfile schema ${schema} is unrecognised.`);
42
+ }
43
+ const meta = raw.meta;
44
+ const lockedAt = meta?.["locked-at"];
45
+ if (!meta || typeof lockedAt !== "string") {
46
+ return diag("MSL-L001", "Missing [meta] table or `locked-at` field");
47
+ }
48
+ const markspecSchema = meta["markspec-schema"];
49
+ if (typeof markspecSchema !== "number") {
50
+ return diag("MSL-L001", "Missing [meta].markspec-schema");
51
+ }
52
+ const upstreams = [];
53
+ const upstreamRoot = raw.upstream;
54
+ if (upstreamRoot) {
55
+ const refs = upstreamRoot.reference ?? [];
56
+ for (let i = 0; i < refs.length; i++) {
57
+ const r = refs[i];
58
+ const slug = requireString(r, "slug");
59
+ const id = requireString(r, "id");
60
+ if (slug === undefined || id === undefined) {
61
+ return diag("MSL-L001", `[[upstream.reference]] entry ${i}: missing required field 'slug' or 'id'`);
62
+ }
63
+ upstreams.push({
64
+ kind: "reference",
65
+ slug,
66
+ id,
67
+ resolved: r.resolved,
68
+ hash: r.hash,
69
+ source: r.source,
70
+ componentScheme: r["component-scheme"],
71
+ });
72
+ }
73
+ const profs = upstreamRoot.profile ?? [];
74
+ for (let i = 0; i < profs.length; i++) {
75
+ const p = profs[i];
76
+ const id = requireString(p, "id");
77
+ const specifier = requireString(p, "specifier");
78
+ const resolved = requireString(p, "resolved");
79
+ const hash = requireString(p, "hash");
80
+ if (id === undefined || specifier === undefined || resolved === undefined ||
81
+ hash === undefined) {
82
+ return diag("MSL-L001", `[[upstream.profile]] entry ${i}: missing required field 'id', 'specifier', 'resolved', or 'hash'`);
83
+ }
84
+ upstreams.push({
85
+ kind: "profile",
86
+ id,
87
+ specifier,
88
+ resolved,
89
+ hash,
90
+ extends: p.extends,
91
+ });
92
+ }
93
+ const regs = upstreamRoot.registry ?? [];
94
+ for (let i = 0; i < regs.length; i++) {
95
+ const reg = regs[i];
96
+ const id = requireString(reg, "id");
97
+ const api = requireString(reg, "api");
98
+ const resolvedManifestHash = requireString(reg, "resolved-manifest-hash");
99
+ const markspecSchemaN = requireNumber(reg, "markspec-schema");
100
+ if (id === undefined || api === undefined ||
101
+ resolvedManifestHash === undefined || markspecSchemaN === undefined) {
102
+ return diag("MSL-L001", `[[upstream.registry]] entry ${i}: missing required field 'id', 'api', 'resolved-manifest-hash', or 'markspec-schema'`);
103
+ }
104
+ upstreams.push({
105
+ kind: "registry",
106
+ id,
107
+ api,
108
+ resolvedManifestHash,
109
+ markspecSchema: markspecSchemaN,
110
+ });
111
+ }
112
+ }
113
+ const boundEntries = [];
114
+ const rawBoundEntries = raw["bound-entry"] ?? [];
115
+ for (let i = 0; i < rawBoundEntries.length; i++) {
116
+ const be = rawBoundEntries[i];
117
+ const displayId = requireString(be, "display-id");
118
+ const ulid = requireString(be, "ulid");
119
+ if (displayId === undefined || ulid === undefined) {
120
+ return diag("MSL-L001", `[[bound-entry]] entry ${i}: missing required field 'display-id' or 'ulid'`);
121
+ }
122
+ const bindings = [];
123
+ const rawBindings = be.binding ??
124
+ [];
125
+ for (let j = 0; j < rawBindings.length; j++) {
126
+ const b = rawBindings[j];
127
+ const externalId = requireString(b, "external-id");
128
+ const system = requireString(b, "system");
129
+ const direction = requireString(b, "direction");
130
+ if (externalId === undefined || system === undefined ||
131
+ direction === undefined) {
132
+ return diag("MSL-L001", `[[bound-entry.binding]] entry ${i}/${j}: missing required field 'external-id', 'system', or 'direction'`);
133
+ }
134
+ const validDirections = new Set(["outbound", "inbound", "bidirectional"]);
135
+ if (!validDirections.has(direction)) {
136
+ return diag("MSL-L001", `[[bound-entry.binding]] entry ${i}/${j}: invalid direction '${direction}' (expected outbound/inbound/bidirectional)`);
137
+ }
138
+ const lockedRaw = b["locked-attributes"] ?? {};
139
+ bindings.push({
140
+ externalId,
141
+ system,
142
+ direction: direction,
143
+ lockedAttributes: new Map(Object.entries(lockedRaw)),
144
+ });
145
+ }
146
+ boundEntries.push({
147
+ displayId,
148
+ ulid,
149
+ bindings,
150
+ });
151
+ }
152
+ const cache = raw["generated-cache"];
153
+ if (!cache) {
154
+ return diag("MSL-L001", "Missing [generated-cache] table");
155
+ }
156
+ const edgesHash = requireString(cache, "edges-hash");
157
+ const edgesCount = requireNumber(cache, "edges-count");
158
+ if (edgesHash === undefined || edgesCount === undefined) {
159
+ return diag("MSL-L001", "[generated-cache]: missing or wrong-typed 'edges-hash' or 'edges-count'");
160
+ }
161
+ const lockfile = {
162
+ schema,
163
+ meta: { markspecSchema, lockedAt },
164
+ upstreams,
165
+ boundEntries,
166
+ generatedCache: { edgesHash, edgesCount },
167
+ };
168
+ return { lockfile, diagnostics: [] };
169
+ }
170
+ /** Build a single-diagnostic failure result with no parsed lockfile. */
171
+ function diag(code, message) {
172
+ return {
173
+ diagnostics: [{
174
+ code,
175
+ severity: "error",
176
+ message,
177
+ location: undefined,
178
+ }],
179
+ };
180
+ }
181
+ /**
182
+ * Read a required string field from a TOML record. Returns the string when
183
+ * present and well-typed, or `undefined` to signal the caller should emit a
184
+ * diagnostic.
185
+ */
186
+ function requireString(source, key) {
187
+ const v = source[key];
188
+ return typeof v === "string" ? v : undefined;
189
+ }
190
+ /**
191
+ * Read a required number field from a TOML record. Returns the number when
192
+ * present and well-typed, or `undefined` to signal the caller should emit a
193
+ * diagnostic.
194
+ */
195
+ function requireNumber(source, key) {
196
+ const v = source[key];
197
+ return typeof v === "number" ? v : undefined;
198
+ }
@@ -0,0 +1,142 @@
1
+ /**
2
+ * @module core/lock/resolve
3
+ *
4
+ * Shared upstream-resolution layer. Both `markspec lock` and
5
+ * `markspec compile` call {@linkcode resolveUpstreams}. All
6
+ * world-touching operations (HTTP fetch, clock) flow through
7
+ * callbacks so unit tests inject deterministic stubs.
8
+ *
9
+ * Implementation arrives in Tasks 15–18; this file ships the type
10
+ * surface and a stub.
11
+ */
12
+ import type { Diagnostic, Entry, ProfileChain, ProjectConfig } from "../model/mod.js";
13
+ import type { Mapping } from "../sync/mod.js";
14
+ import type { BoundEntry, UpstreamProfile, UpstreamReference, UpstreamRegistry } from "./model.js";
15
+ import { type EdgeQuad } from "./canonical_edges.js";
16
+ /**
17
+ * Callback to fetch a URL. Returns the bytes on success, or an
18
+ * `{ error }` object on failure. Never throws — every recoverable
19
+ * problem flows back as an error so the resolver can attach a
20
+ * diagnostic instead of bubbling an exception.
21
+ */
22
+ export type FetchUrl = (url: string) => Promise<Uint8Array | {
23
+ error: string;
24
+ }>;
25
+ /**
26
+ * Callback to read a local file by absolute path. Returns the bytes on
27
+ * success, or `{ error }` on failure. Used by `resolveProfileChain` to
28
+ * hash on-disk profile manifests; isolated to a callback so the resolver
29
+ * stays runtime-agnostic.
30
+ */
31
+ export type ReadFile = (path: string) => Promise<Uint8Array | {
32
+ error: string;
33
+ }>;
34
+ /** Inputs to {@linkcode resolveUpstreams}. */
35
+ export interface ResolveUpstreamsOptions {
36
+ readonly entries: readonly Entry[];
37
+ /**
38
+ * Profile chain to lock. Pass `[]` when no profile is active —
39
+ * tighter than making the chain optional, since downstream
40
+ * code can always iterate `profileChain` without a null check.
41
+ */
42
+ readonly profileChain: ProfileChain | readonly never[];
43
+ readonly config: ProjectConfig;
44
+ readonly mappings: readonly Mapping[];
45
+ readonly fetchUrl: FetchUrl;
46
+ readonly readFile: ReadFile;
47
+ /** Injectable clock for deterministic tests. Defaults to `() => new Date()`. */
48
+ readonly now?: () => Date;
49
+ }
50
+ /** A Reference citation that resolved to bytes or identity-only. */
51
+ export interface ResolvedReference {
52
+ readonly upstream: UpstreamReference;
53
+ readonly diagnostics: readonly Diagnostic[];
54
+ }
55
+ /** A profile chain tier that resolved. */
56
+ export interface ResolvedProfile {
57
+ readonly upstream: UpstreamProfile;
58
+ readonly diagnostics: readonly Diagnostic[];
59
+ }
60
+ /** A federated registry that resolved. */
61
+ export interface ResolvedRegistry {
62
+ readonly upstream: UpstreamRegistry;
63
+ readonly diagnostics: readonly Diagnostic[];
64
+ }
65
+ /** A bound entry's locked-attribute snapshot. */
66
+ export interface ResolvedBoundEntry {
67
+ readonly boundEntry: BoundEntry;
68
+ readonly diagnostics: readonly Diagnostic[];
69
+ }
70
+ /** Full resolved-upstreams payload — input to lockfile serialization. */
71
+ export interface ResolvedUpstreams {
72
+ readonly references: readonly ResolvedReference[];
73
+ readonly profiles: readonly ResolvedProfile[];
74
+ readonly registries: readonly ResolvedRegistry[];
75
+ readonly boundEntries: readonly ResolvedBoundEntry[];
76
+ /** sha256:* of the canonical edge serialization. */
77
+ readonly canonicalEdgeHash: string;
78
+ readonly canonicalEdgeCount: number;
79
+ /** Wall-clock timestamp the lockfile was resolved. */
80
+ readonly lockedAt: string;
81
+ /** Aggregate diagnostics — empty when every upstream resolved cleanly. */
82
+ readonly diagnostics: readonly Diagnostic[];
83
+ }
84
+ /**
85
+ * Resolve every Reference entry to an upstream record. Deduplicates by
86
+ * display ID (first occurrence wins). When `Reference-url:` is set, the
87
+ * bytes are fetched and `sha256:*`-hashed; otherwise an MSL-L010 info
88
+ * diagnostic is attached and the upstream is identity-only. Fetch
89
+ * failures attach MSL-L101 and degrade to identity-only.
90
+ */
91
+ export declare function resolveReferences(entries: readonly Entry[], fetchUrl: FetchUrl): Promise<ResolvedReference[]>;
92
+ /**
93
+ * Project an entry list to canonical edge quads. Walks the eleven core
94
+ * trace-link attributes (Satisfies, Derived-from, Verified-by, …) and
95
+ * emits one quad per resolved target ID, splitting CSV values on `,`
96
+ * or whitespace. Every quad is provenance `"local"` — externally
97
+ * sourced edges are folded in later (post-MVP).
98
+ */
99
+ export declare function extractEdgeQuads(entries: readonly Entry[]): EdgeQuad[];
100
+ /**
101
+ * Resolve every upstream the lockfile needs: References, profile chain
102
+ * tiers, federated registries, and bound entries. Computes the
103
+ * canonical edge hash from the same entry set. Returns the aggregate
104
+ * `ResolvedUpstreams` payload ready for {@link serializeLockfile}.
105
+ *
106
+ * The four sub-resolvers run sequentially (not concurrently) because
107
+ * (a) the callbacks they share — `fetchUrl`, `readFile` — may themselves
108
+ * serialize work, and (b) the diagnostics output is easier to reason
109
+ * about with a deterministic order. Wrap inside `Promise.all` only when
110
+ * profiling shows a clear win.
111
+ */
112
+ export declare function resolveUpstreams(opts: ResolveUpstreamsOptions): Promise<ResolvedUpstreams>;
113
+ /**
114
+ * Resolve every profile chain tier into an upstream record. Each tier's
115
+ * `markspec.yaml` is read from `tier.sourcePath` via `readFile` and
116
+ * `sha256:*`-hashed; a read failure attaches MSL-L102 and degrades the
117
+ * tier's hash to `sha256:0` (identity-only).
118
+ *
119
+ * The `extends` chain is reconstructed from list order: tiers are
120
+ * already root-parent → leaf-child, so each tier's `extends` points to
121
+ * the previous tier's id. The root tier has `extends: undefined`.
122
+ */
123
+ export declare function resolveProfileChain(chain: ProfileChain | readonly never[], readFile: ReadFile): Promise<ResolvedProfile[]>;
124
+ /**
125
+ * Resolve federated parent registries (and the fallback, when not already
126
+ * listed). Each URL's `<url>/manifest` is fetched; the body is parsed
127
+ * loosely for `markspec-schema` (defaults to 1 on parse failure).
128
+ */
129
+ export declare function resolveRegistries(config: ProjectConfig, fetchUrl: FetchUrl): Promise<ResolvedRegistry[]>;
130
+ /**
131
+ * Resolve every entry carrying `External-id:` attributes into a
132
+ * `ResolvedBoundEntry`. For each External-id, look up the mapping by
133
+ * scheme prefix, compute the locked-attribute set, and snapshot each
134
+ * local value as `sha256:*` of UTF-8 bytes.
135
+ *
136
+ * Unknown scheme → MSL-S021 error, that binding skipped. Entries with
137
+ * zero External-id attributes are silently dropped (no upstream lock
138
+ * needed). Multi-value attributes are joined with `\n` before hashing
139
+ * so a single locked-attribute hash captures the full attribute state.
140
+ */
141
+ export declare function resolveBoundEntries(entries: readonly Entry[], mappings: readonly Mapping[]): Promise<ResolvedBoundEntry[]>;
142
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/lock/resolve.ts"],"names":[],"mappings":"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"}