@superbee/core 0.2.0-pre.2 → 0.2.0-pre.21

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 (517) hide show
  1. package/README.md +1000 -0
  2. package/dist/artifact-contract.d.ts +90 -0
  3. package/dist/artifact-contract.d.ts.map +1 -0
  4. package/dist/artifact-contract.js +205 -0
  5. package/dist/artifact-contract.js.map +1 -0
  6. package/dist/backend.d.ts +19 -1
  7. package/dist/backend.d.ts.map +1 -1
  8. package/dist/backend.js +83 -36
  9. package/dist/backend.js.map +1 -1
  10. package/dist/blob-contract.d.ts +80 -0
  11. package/dist/blob-contract.d.ts.map +1 -0
  12. package/dist/blob-contract.js +131 -0
  13. package/dist/blob-contract.js.map +1 -0
  14. package/dist/blob-journal.d.ts +302 -0
  15. package/dist/blob-journal.d.ts.map +1 -0
  16. package/dist/blob-journal.js +540 -0
  17. package/dist/blob-journal.js.map +1 -0
  18. package/dist/body-replace-guards.d.ts +50 -0
  19. package/dist/body-replace-guards.d.ts.map +1 -0
  20. package/dist/body-replace-guards.js +158 -0
  21. package/dist/body-replace-guards.js.map +1 -0
  22. package/dist/builtin-recipes/content.d.ts +93 -0
  23. package/dist/builtin-recipes/content.d.ts.map +1 -0
  24. package/dist/builtin-recipes/content.js +288 -0
  25. package/dist/builtin-recipes/content.js.map +1 -0
  26. package/dist/builtin-recipes.d.ts +10 -0
  27. package/dist/builtin-recipes.d.ts.map +1 -0
  28. package/dist/builtin-recipes.js +97 -0
  29. package/dist/builtin-recipes.js.map +1 -0
  30. package/dist/bundle-health/index.d.ts +14 -0
  31. package/dist/bundle-health/index.d.ts.map +1 -0
  32. package/dist/bundle-health/index.js +12 -0
  33. package/dist/bundle-health/index.js.map +1 -0
  34. package/dist/bundle-health/kind-findings.d.ts +44 -0
  35. package/dist/bundle-health/kind-findings.d.ts.map +1 -0
  36. package/dist/bundle-health/kind-findings.js +68 -0
  37. package/dist/bundle-health/kind-findings.js.map +1 -0
  38. package/dist/bundle-health/legacy-page.d.ts +39 -0
  39. package/dist/bundle-health/legacy-page.d.ts.map +1 -0
  40. package/dist/bundle-health/legacy-page.js +50 -0
  41. package/dist/bundle-health/legacy-page.js.map +1 -0
  42. package/dist/bundle-health/report.d.ts +202 -0
  43. package/dist/bundle-health/report.d.ts.map +1 -0
  44. package/dist/bundle-health/report.js +438 -0
  45. package/dist/bundle-health/report.js.map +1 -0
  46. package/dist/bundle-ops.d.ts +1 -1
  47. package/dist/bundle-ops.d.ts.map +1 -1
  48. package/dist/bundle-ops.js +2 -2
  49. package/dist/bundle-ops.js.map +1 -1
  50. package/dist/bundle.d.ts +2 -1
  51. package/dist/bundle.d.ts.map +1 -1
  52. package/dist/bundle.js +3 -3
  53. package/dist/bundle.js.map +1 -1
  54. package/dist/code-point-order.d.ts +8 -0
  55. package/dist/code-point-order.d.ts.map +1 -0
  56. package/dist/code-point-order.js +20 -0
  57. package/dist/code-point-order.js.map +1 -0
  58. package/dist/connectors.d.ts +230 -0
  59. package/dist/connectors.d.ts.map +1 -0
  60. package/dist/connectors.js +1150 -0
  61. package/dist/connectors.js.map +1 -0
  62. package/dist/cross-bundle.d.ts +135 -0
  63. package/dist/cross-bundle.d.ts.map +1 -0
  64. package/dist/cross-bundle.js +186 -0
  65. package/dist/cross-bundle.js.map +1 -0
  66. package/dist/dependencies.d.ts +94 -0
  67. package/dist/dependencies.d.ts.map +1 -0
  68. package/dist/dependencies.js +180 -0
  69. package/dist/dependencies.js.map +1 -0
  70. package/dist/document-codec.d.ts +6 -1
  71. package/dist/document-codec.d.ts.map +1 -1
  72. package/dist/document-codec.js +8 -4
  73. package/dist/document-codec.js.map +1 -1
  74. package/dist/document-field-actions.d.ts +31 -1
  75. package/dist/document-field-actions.d.ts.map +1 -1
  76. package/dist/document-field-actions.js +137 -34
  77. package/dist/document-field-actions.js.map +1 -1
  78. package/dist/document-mutation.d.ts +22 -10
  79. package/dist/document-mutation.d.ts.map +1 -1
  80. package/dist/document-mutation.js +58 -27
  81. package/dist/document-mutation.js.map +1 -1
  82. package/dist/document-write-policy.d.ts.map +1 -1
  83. package/dist/document-write-policy.js +4 -2
  84. package/dist/document-write-policy.js.map +1 -1
  85. package/dist/engine.d.ts +9 -2
  86. package/dist/engine.d.ts.map +1 -1
  87. package/dist/engine.js +11 -4
  88. package/dist/engine.js.map +1 -1
  89. package/dist/file-journaled-backend-internal.d.ts +21 -0
  90. package/dist/file-journaled-backend-internal.d.ts.map +1 -0
  91. package/dist/file-journaled-backend-internal.js +12 -0
  92. package/dist/file-journaled-backend-internal.js.map +1 -0
  93. package/dist/file-journaled-backend.d.ts +200 -0
  94. package/dist/file-journaled-backend.d.ts.map +1 -0
  95. package/dist/file-journaled-backend.js +1334 -0
  96. package/dist/file-journaled-backend.js.map +1 -0
  97. package/dist/filesystem-host.d.ts +15 -0
  98. package/dist/filesystem-host.d.ts.map +1 -0
  99. package/dist/filesystem-host.js +20 -0
  100. package/dist/filesystem-host.js.map +1 -0
  101. package/dist/filesystem-identity.d.ts +86 -4
  102. package/dist/filesystem-identity.d.ts.map +1 -1
  103. package/dist/filesystem-identity.js +338 -102
  104. package/dist/filesystem-identity.js.map +1 -1
  105. package/dist/filesystem-lock.d.ts +16 -3
  106. package/dist/filesystem-lock.d.ts.map +1 -1
  107. package/dist/filesystem-lock.js +323 -77
  108. package/dist/filesystem-lock.js.map +1 -1
  109. package/dist/filesystem-push-role.d.ts +77 -0
  110. package/dist/filesystem-push-role.d.ts.map +1 -0
  111. package/dist/filesystem-push-role.js +165 -0
  112. package/dist/filesystem-push-role.js.map +1 -0
  113. package/dist/filesystem.d.ts +17 -0
  114. package/dist/filesystem.d.ts.map +1 -0
  115. package/dist/filesystem.js +18 -0
  116. package/dist/filesystem.js.map +1 -0
  117. package/dist/frontmatter.d.ts +8 -0
  118. package/dist/frontmatter.d.ts.map +1 -1
  119. package/dist/frontmatter.js +14 -4
  120. package/dist/frontmatter.js.map +1 -1
  121. package/dist/governed-body-write.d.ts +106 -0
  122. package/dist/governed-body-write.d.ts.map +1 -0
  123. package/dist/governed-body-write.js +251 -0
  124. package/dist/governed-body-write.js.map +1 -0
  125. package/dist/host-policy-snapshot.d.ts +9 -0
  126. package/dist/host-policy-snapshot.d.ts.map +1 -0
  127. package/dist/host-policy-snapshot.js +33 -0
  128. package/dist/host-policy-snapshot.js.map +1 -0
  129. package/dist/host-text.d.ts +31 -0
  130. package/dist/host-text.d.ts.map +1 -0
  131. package/dist/host-text.js +77 -0
  132. package/dist/host-text.js.map +1 -0
  133. package/dist/hosted-client/binding.d.ts +7 -0
  134. package/dist/hosted-client/binding.d.ts.map +1 -0
  135. package/dist/hosted-client/binding.js +10 -0
  136. package/dist/hosted-client/binding.js.map +1 -0
  137. package/dist/hosted-client/blob-delivery.d.ts +67 -0
  138. package/dist/hosted-client/blob-delivery.d.ts.map +1 -0
  139. package/dist/hosted-client/blob-delivery.js +169 -0
  140. package/dist/hosted-client/blob-delivery.js.map +1 -0
  141. package/dist/hosted-client/blob-write.d.ts +386 -0
  142. package/dist/hosted-client/blob-write.d.ts.map +1 -0
  143. package/dist/hosted-client/blob-write.js +770 -0
  144. package/dist/hosted-client/blob-write.js.map +1 -0
  145. package/dist/hosted-client/bundle-listing.d.ts +46 -0
  146. package/dist/hosted-client/bundle-listing.d.ts.map +1 -0
  147. package/dist/hosted-client/bundle-listing.js +36 -0
  148. package/dist/hosted-client/bundle-listing.js.map +1 -0
  149. package/dist/hosted-client/client.d.ts +219 -0
  150. package/dist/hosted-client/client.d.ts.map +1 -0
  151. package/dist/hosted-client/client.js +309 -0
  152. package/dist/hosted-client/client.js.map +1 -0
  153. package/dist/hosted-client/directory.d.ts +46 -0
  154. package/dist/hosted-client/directory.d.ts.map +1 -0
  155. package/dist/hosted-client/directory.js +74 -0
  156. package/dist/hosted-client/directory.js.map +1 -0
  157. package/dist/hosted-client/errors.d.ts +26 -0
  158. package/dist/hosted-client/errors.d.ts.map +1 -0
  159. package/dist/hosted-client/errors.js +35 -0
  160. package/dist/hosted-client/errors.js.map +1 -0
  161. package/dist/hosted-client/inbox.d.ts +320 -0
  162. package/dist/hosted-client/inbox.d.ts.map +1 -0
  163. package/dist/hosted-client/inbox.js +379 -0
  164. package/dist/hosted-client/inbox.js.map +1 -0
  165. package/dist/hosted-client/index.d.ts +30 -0
  166. package/dist/hosted-client/index.d.ts.map +1 -0
  167. package/dist/hosted-client/index.js +32 -0
  168. package/dist/hosted-client/index.js.map +1 -0
  169. package/dist/hosted-client/journal.d.ts +103 -0
  170. package/dist/hosted-client/journal.d.ts.map +1 -0
  171. package/dist/hosted-client/journal.js +464 -0
  172. package/dist/hosted-client/journal.js.map +1 -0
  173. package/dist/hosted-client/node.d.ts +74 -0
  174. package/dist/hosted-client/node.d.ts.map +1 -0
  175. package/dist/hosted-client/node.js +219 -0
  176. package/dist/hosted-client/node.js.map +1 -0
  177. package/dist/hosted-client/reference.d.ts +12 -0
  178. package/dist/hosted-client/reference.d.ts.map +1 -0
  179. package/dist/hosted-client/reference.js +29 -0
  180. package/dist/hosted-client/reference.js.map +1 -0
  181. package/dist/hosted-client/write.d.ts +217 -0
  182. package/dist/hosted-client/write.d.ts.map +1 -0
  183. package/dist/hosted-client/write.js +418 -0
  184. package/dist/hosted-client/write.js.map +1 -0
  185. package/dist/hosted-transport/answer-rows.d.ts +243 -0
  186. package/dist/hosted-transport/answer-rows.d.ts.map +1 -0
  187. package/dist/hosted-transport/answer-rows.js +454 -0
  188. package/dist/hosted-transport/answer-rows.js.map +1 -0
  189. package/dist/hosted-transport/blob-reads.d.ts +35 -0
  190. package/dist/hosted-transport/blob-reads.d.ts.map +1 -0
  191. package/dist/hosted-transport/blob-reads.js +179 -0
  192. package/dist/hosted-transport/blob-reads.js.map +1 -0
  193. package/dist/hosted-transport/blob-write.d.ts +34 -0
  194. package/dist/hosted-transport/blob-write.d.ts.map +1 -0
  195. package/dist/hosted-transport/blob-write.js +115 -0
  196. package/dist/hosted-transport/blob-write.js.map +1 -0
  197. package/dist/hosted-transport/carrier.d.ts +151 -0
  198. package/dist/hosted-transport/carrier.d.ts.map +1 -0
  199. package/dist/hosted-transport/carrier.js +260 -0
  200. package/dist/hosted-transport/carrier.js.map +1 -0
  201. package/dist/hosted-transport/history-pages.d.ts +55 -0
  202. package/dist/hosted-transport/history-pages.d.ts.map +1 -0
  203. package/dist/hosted-transport/history-pages.js +69 -0
  204. package/dist/hosted-transport/history-pages.js.map +1 -0
  205. package/dist/hosted-transport/index.d.ts +18 -0
  206. package/dist/hosted-transport/index.d.ts.map +1 -0
  207. package/dist/hosted-transport/index.js +18 -0
  208. package/dist/hosted-transport/index.js.map +1 -0
  209. package/dist/hosted-transport/operations.d.ts +85 -0
  210. package/dist/hosted-transport/operations.d.ts.map +1 -0
  211. package/dist/hosted-transport/operations.js +128 -0
  212. package/dist/hosted-transport/operations.js.map +1 -0
  213. package/dist/hosted-transport/paged-reads.d.ts +87 -0
  214. package/dist/hosted-transport/paged-reads.d.ts.map +1 -0
  215. package/dist/hosted-transport/paged-reads.js +238 -0
  216. package/dist/hosted-transport/paged-reads.js.map +1 -0
  217. package/dist/hosted-transport/read-adapter.d.ts +256 -0
  218. package/dist/hosted-transport/read-adapter.d.ts.map +1 -0
  219. package/dist/hosted-transport/read-adapter.js +568 -0
  220. package/dist/hosted-transport/read-adapter.js.map +1 -0
  221. package/dist/hosted-transport/root-write.d.ts +114 -0
  222. package/dist/hosted-transport/root-write.d.ts.map +1 -0
  223. package/dist/hosted-transport/root-write.js +171 -0
  224. package/dist/hosted-transport/root-write.js.map +1 -0
  225. package/dist/hosted-transport/whole-document-transport.d.ts +204 -0
  226. package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -0
  227. package/dist/hosted-transport/whole-document-transport.js +447 -0
  228. package/dist/hosted-transport/whole-document-transport.js.map +1 -0
  229. package/dist/index.d.ts +34 -10
  230. package/dist/index.d.ts.map +1 -1
  231. package/dist/index.js +26 -8
  232. package/dist/index.js.map +1 -1
  233. package/dist/indexeddb-backend.d.ts +28 -6
  234. package/dist/indexeddb-backend.d.ts.map +1 -1
  235. package/dist/indexeddb-backend.js +471 -92
  236. package/dist/indexeddb-backend.js.map +1 -1
  237. package/dist/journaled-backend.d.ts +247 -10
  238. package/dist/journaled-backend.d.ts.map +1 -1
  239. package/dist/journaled-backend.js +302 -1
  240. package/dist/journaled-backend.js.map +1 -1
  241. package/dist/kind-authoring.d.ts +170 -0
  242. package/dist/kind-authoring.d.ts.map +1 -0
  243. package/dist/kind-authoring.js +451 -0
  244. package/dist/kind-authoring.js.map +1 -0
  245. package/dist/kind-conformance-error.d.ts +15 -0
  246. package/dist/kind-conformance-error.d.ts.map +1 -0
  247. package/dist/kind-conformance-error.js +20 -0
  248. package/dist/kind-conformance-error.js.map +1 -0
  249. package/dist/kind-coverage.d.ts +99 -0
  250. package/dist/kind-coverage.d.ts.map +1 -0
  251. package/dist/kind-coverage.js +186 -0
  252. package/dist/kind-coverage.js.map +1 -0
  253. package/dist/kind-field-mutation.d.ts +4 -0
  254. package/dist/kind-field-mutation.d.ts.map +1 -1
  255. package/dist/kind-field-mutation.js +28 -3
  256. package/dist/kind-field-mutation.js.map +1 -1
  257. package/dist/kinds-load.js +4 -4
  258. package/dist/kinds-load.js.map +1 -1
  259. package/dist/kinds.d.ts +65 -2
  260. package/dist/kinds.d.ts.map +1 -1
  261. package/dist/kinds.js +341 -21
  262. package/dist/kinds.js.map +1 -1
  263. package/dist/link-types.d.ts +26 -0
  264. package/dist/link-types.d.ts.map +1 -0
  265. package/dist/link-types.js +57 -0
  266. package/dist/link-types.js.map +1 -0
  267. package/dist/links.d.ts +21 -3
  268. package/dist/links.d.ts.map +1 -1
  269. package/dist/links.js +213 -14
  270. package/dist/links.js.map +1 -1
  271. package/dist/managed-document-metadata.d.ts +2 -0
  272. package/dist/managed-document-metadata.d.ts.map +1 -0
  273. package/dist/managed-document-metadata.js +9 -0
  274. package/dist/managed-document-metadata.js.map +1 -0
  275. package/dist/memory-backend.d.ts +2 -2
  276. package/dist/memory-backend.d.ts.map +1 -1
  277. package/dist/memory-backend.js +26 -11
  278. package/dist/memory-backend.js.map +1 -1
  279. package/dist/paths.d.ts +16 -0
  280. package/dist/paths.d.ts.map +1 -1
  281. package/dist/paths.js +25 -0
  282. package/dist/paths.js.map +1 -1
  283. package/dist/platform.d.ts +13 -2
  284. package/dist/platform.d.ts.map +1 -1
  285. package/dist/platform.js +16 -0
  286. package/dist/platform.js.map +1 -1
  287. package/dist/portable-export.d.ts +119 -0
  288. package/dist/portable-export.d.ts.map +1 -0
  289. package/dist/portable-export.js +501 -0
  290. package/dist/portable-export.js.map +1 -0
  291. package/dist/publication-filesystem.d.ts +1 -1
  292. package/dist/publication-filesystem.d.ts.map +1 -1
  293. package/dist/publication-filesystem.js +1 -1
  294. package/dist/publication-filesystem.js.map +1 -1
  295. package/dist/qualified-links.d.ts +67 -0
  296. package/dist/qualified-links.d.ts.map +1 -0
  297. package/dist/qualified-links.js +117 -0
  298. package/dist/qualified-links.js.map +1 -0
  299. package/dist/query-filter.d.ts +16 -2
  300. package/dist/query-filter.d.ts.map +1 -1
  301. package/dist/query-filter.js +40 -1
  302. package/dist/query-filter.js.map +1 -1
  303. package/dist/query-order.d.ts +22 -0
  304. package/dist/query-order.d.ts.map +1 -0
  305. package/dist/query-order.js +42 -0
  306. package/dist/query-order.js.map +1 -0
  307. package/dist/recipe-lifecycle/errors.d.ts +96 -0
  308. package/dist/recipe-lifecycle/errors.d.ts.map +1 -0
  309. package/dist/recipe-lifecycle/errors.js +122 -0
  310. package/dist/recipe-lifecycle/errors.js.map +1 -0
  311. package/dist/recipe-lifecycle/evolution.d.ts +108 -0
  312. package/dist/recipe-lifecycle/evolution.d.ts.map +1 -0
  313. package/dist/recipe-lifecycle/evolution.js +884 -0
  314. package/dist/recipe-lifecycle/evolution.js.map +1 -0
  315. package/dist/recipe-lifecycle/index.d.ts +26 -0
  316. package/dist/recipe-lifecycle/index.d.ts.map +1 -0
  317. package/dist/recipe-lifecycle/index.js +22 -0
  318. package/dist/recipe-lifecycle/index.js.map +1 -0
  319. package/dist/recipe-lifecycle/install.d.ts +127 -0
  320. package/dist/recipe-lifecycle/install.d.ts.map +1 -0
  321. package/dist/recipe-lifecycle/install.js +526 -0
  322. package/dist/recipe-lifecycle/install.js.map +1 -0
  323. package/dist/recipe-lifecycle/legacy-aliases.d.ts +16 -0
  324. package/dist/recipe-lifecycle/legacy-aliases.d.ts.map +1 -0
  325. package/dist/recipe-lifecycle/legacy-aliases.js +51 -0
  326. package/dist/recipe-lifecycle/legacy-aliases.js.map +1 -0
  327. package/dist/recipe-lifecycle/stamp.d.ts +136 -0
  328. package/dist/recipe-lifecycle/stamp.d.ts.map +1 -0
  329. package/dist/recipe-lifecycle/stamp.js +326 -0
  330. package/dist/recipe-lifecycle/stamp.js.map +1 -0
  331. package/dist/recipes.d.ts +29 -1
  332. package/dist/recipes.d.ts.map +1 -1
  333. package/dist/recipes.js +137 -1
  334. package/dist/recipes.js.map +1 -1
  335. package/dist/record-overlay/apply.d.ts +43 -0
  336. package/dist/record-overlay/apply.d.ts.map +1 -0
  337. package/dist/record-overlay/apply.js +527 -0
  338. package/dist/record-overlay/apply.js.map +1 -0
  339. package/dist/record-overlay/canonical.d.ts +22 -0
  340. package/dist/record-overlay/canonical.d.ts.map +1 -0
  341. package/dist/record-overlay/canonical.js +47 -0
  342. package/dist/record-overlay/canonical.js.map +1 -0
  343. package/dist/record-overlay/digest.d.ts +4 -0
  344. package/dist/record-overlay/digest.d.ts.map +1 -0
  345. package/dist/record-overlay/digest.js +11 -0
  346. package/dist/record-overlay/digest.js.map +1 -0
  347. package/dist/record-overlay/errors.d.ts +44 -0
  348. package/dist/record-overlay/errors.d.ts.map +1 -0
  349. package/dist/record-overlay/errors.js +55 -0
  350. package/dist/record-overlay/errors.js.map +1 -0
  351. package/dist/record-overlay/findings.d.ts +5 -0
  352. package/dist/record-overlay/findings.d.ts.map +1 -0
  353. package/dist/record-overlay/findings.js +83 -0
  354. package/dist/record-overlay/findings.js.map +1 -0
  355. package/dist/record-overlay/index.d.ts +23 -0
  356. package/dist/record-overlay/index.d.ts.map +1 -0
  357. package/dist/record-overlay/index.js +21 -0
  358. package/dist/record-overlay/index.js.map +1 -0
  359. package/dist/record-overlay/plan.d.ts +12 -0
  360. package/dist/record-overlay/plan.d.ts.map +1 -0
  361. package/dist/record-overlay/plan.js +285 -0
  362. package/dist/record-overlay/plan.js.map +1 -0
  363. package/dist/record-overlay/policy.d.ts +69 -0
  364. package/dist/record-overlay/policy.d.ts.map +1 -0
  365. package/dist/record-overlay/policy.js +228 -0
  366. package/dist/record-overlay/policy.js.map +1 -0
  367. package/dist/record-overlay/redact.d.ts +3 -0
  368. package/dist/record-overlay/redact.d.ts.map +1 -0
  369. package/dist/record-overlay/redact.js +27 -0
  370. package/dist/record-overlay/redact.js.map +1 -0
  371. package/dist/record-overlay/signal-kind.d.ts +30 -0
  372. package/dist/record-overlay/signal-kind.d.ts.map +1 -0
  373. package/dist/record-overlay/signal-kind.js +38 -0
  374. package/dist/record-overlay/signal-kind.js.map +1 -0
  375. package/dist/record-overlay/signal-text.d.ts +45 -0
  376. package/dist/record-overlay/signal-text.d.ts.map +1 -0
  377. package/dist/record-overlay/signal-text.js +116 -0
  378. package/dist/record-overlay/signal-text.js.map +1 -0
  379. package/dist/record-overlay/source-index.d.ts +19 -0
  380. package/dist/record-overlay/source-index.d.ts.map +1 -0
  381. package/dist/record-overlay/source-index.js +102 -0
  382. package/dist/record-overlay/source-index.js.map +1 -0
  383. package/dist/record-overlay/types.d.ts +291 -0
  384. package/dist/record-overlay/types.d.ts.map +1 -0
  385. package/dist/record-overlay/types.js +2 -0
  386. package/dist/record-overlay/types.js.map +1 -0
  387. package/dist/remote-backend.d.ts +67 -67
  388. package/dist/remote-backend.d.ts.map +1 -1
  389. package/dist/remote-backend.js +169 -201
  390. package/dist/remote-backend.js.map +1 -1
  391. package/dist/remote-document-codec.d.ts +15 -0
  392. package/dist/remote-document-codec.d.ts.map +1 -0
  393. package/dist/remote-document-codec.js +103 -0
  394. package/dist/remote-document-codec.js.map +1 -0
  395. package/dist/remote-error.d.ts +38 -0
  396. package/dist/remote-error.d.ts.map +1 -0
  397. package/dist/remote-error.js +59 -0
  398. package/dist/remote-error.js.map +1 -0
  399. package/dist/remote-operations.d.ts +6 -3
  400. package/dist/remote-operations.d.ts.map +1 -1
  401. package/dist/remote-operations.js +23 -5
  402. package/dist/remote-operations.js.map +1 -1
  403. package/dist/remote-parsers.d.ts +86 -0
  404. package/dist/remote-parsers.d.ts.map +1 -0
  405. package/dist/remote-parsers.js +181 -0
  406. package/dist/remote-parsers.js.map +1 -0
  407. package/dist/remote.d.ts +5 -2
  408. package/dist/remote.d.ts.map +1 -1
  409. package/dist/remote.js +5 -1
  410. package/dist/remote.js.map +1 -1
  411. package/dist/search/backend-source.d.ts +6 -0
  412. package/dist/search/backend-source.d.ts.map +1 -0
  413. package/dist/search/backend-source.js +33 -0
  414. package/dist/search/backend-source.js.map +1 -0
  415. package/dist/search/contract.d.ts +151 -0
  416. package/dist/search/contract.d.ts.map +1 -0
  417. package/dist/search/contract.js +78 -0
  418. package/dist/search/contract.js.map +1 -0
  419. package/dist/search/errors.d.ts +30 -0
  420. package/dist/search/errors.d.ts.map +1 -0
  421. package/dist/search/errors.js +50 -0
  422. package/dist/search/errors.js.map +1 -0
  423. package/dist/search/identity.d.ts +12 -0
  424. package/dist/search/identity.d.ts.map +1 -0
  425. package/dist/search/identity.js +90 -0
  426. package/dist/search/identity.js.map +1 -0
  427. package/dist/search/index.d.ts +16 -0
  428. package/dist/search/index.d.ts.map +1 -0
  429. package/dist/search/index.js +15 -0
  430. package/dist/search/index.js.map +1 -0
  431. package/dist/search/memory-source.d.ts +36 -0
  432. package/dist/search/memory-source.d.ts.map +1 -0
  433. package/dist/search/memory-source.js +235 -0
  434. package/dist/search/memory-source.js.map +1 -0
  435. package/dist/search/rank.d.ts +34 -0
  436. package/dist/search/rank.d.ts.map +1 -0
  437. package/dist/search/rank.js +129 -0
  438. package/dist/search/rank.js.map +1 -0
  439. package/dist/search/row-text.d.ts +38 -0
  440. package/dist/search/row-text.d.ts.map +1 -0
  441. package/dist/search/row-text.js +88 -0
  442. package/dist/search/row-text.js.map +1 -0
  443. package/dist/search/search.d.ts +28 -0
  444. package/dist/search/search.d.ts.map +1 -0
  445. package/dist/search/search.js +257 -0
  446. package/dist/search/search.js.map +1 -0
  447. package/dist/search/source.d.ts +67 -0
  448. package/dist/search/source.d.ts.map +1 -0
  449. package/dist/search/source.js +2 -0
  450. package/dist/search/source.js.map +1 -0
  451. package/dist/search/text.d.ts +47 -0
  452. package/dist/search/text.d.ts.map +1 -0
  453. package/dist/search/text.js +148 -0
  454. package/dist/search/text.js.map +1 -0
  455. package/dist/site-capabilities.d.ts +339 -0
  456. package/dist/site-capabilities.d.ts.map +1 -0
  457. package/dist/site-capabilities.js +717 -0
  458. package/dist/site-capabilities.js.map +1 -0
  459. package/dist/source-engine/guard.d.ts +82 -0
  460. package/dist/source-engine/guard.d.ts.map +1 -0
  461. package/dist/source-engine/guard.js +396 -0
  462. package/dist/source-engine/guard.js.map +1 -0
  463. package/dist/source-engine/index.d.ts +24 -0
  464. package/dist/source-engine/index.d.ts.map +1 -0
  465. package/dist/source-engine/index.js +20 -0
  466. package/dist/source-engine/index.js.map +1 -0
  467. package/dist/source-engine/machine-state.d.ts +74 -0
  468. package/dist/source-engine/machine-state.d.ts.map +1 -0
  469. package/dist/source-engine/machine-state.js +48 -0
  470. package/dist/source-engine/machine-state.js.map +1 -0
  471. package/dist/source-engine/observe.d.ts +18 -0
  472. package/dist/source-engine/observe.d.ts.map +1 -0
  473. package/dist/source-engine/observe.js +598 -0
  474. package/dist/source-engine/observe.js.map +1 -0
  475. package/dist/source-engine/robots.d.ts +53 -0
  476. package/dist/source-engine/robots.d.ts.map +1 -0
  477. package/dist/source-engine/robots.js +158 -0
  478. package/dist/source-engine/robots.js.map +1 -0
  479. package/dist/source-engine/types.d.ts +285 -0
  480. package/dist/source-engine/types.d.ts.map +1 -0
  481. package/dist/source-engine/types.js +2 -0
  482. package/dist/source-engine/types.js.map +1 -0
  483. package/dist/source-harness/conformance.d.ts +16 -0
  484. package/dist/source-harness/conformance.d.ts.map +1 -0
  485. package/dist/source-harness/conformance.js +265 -0
  486. package/dist/source-harness/conformance.js.map +1 -0
  487. package/dist/source-harness/fixture.d.ts +95 -0
  488. package/dist/source-harness/fixture.d.ts.map +1 -0
  489. package/dist/source-harness/fixture.js +261 -0
  490. package/dist/source-harness/fixture.js.map +1 -0
  491. package/dist/source-harness/index.d.ts +22 -0
  492. package/dist/source-harness/index.d.ts.map +1 -0
  493. package/dist/source-harness/index.js +19 -0
  494. package/dist/source-harness/index.js.map +1 -0
  495. package/dist/source-harness/peer.d.ts +74 -0
  496. package/dist/source-harness/peer.d.ts.map +1 -0
  497. package/dist/source-harness/peer.js +106 -0
  498. package/dist/source-harness/peer.js.map +1 -0
  499. package/dist/storage.d.ts +6 -2
  500. package/dist/storage.d.ts.map +1 -1
  501. package/dist/storage.js +4 -1
  502. package/dist/storage.js.map +1 -1
  503. package/dist/types.d.ts +33 -5
  504. package/dist/types.d.ts.map +1 -1
  505. package/dist/uncertain-write.d.ts +156 -19
  506. package/dist/uncertain-write.d.ts.map +1 -1
  507. package/dist/uncertain-write.js +90 -31
  508. package/dist/uncertain-write.js.map +1 -1
  509. package/dist/versioning.d.ts +9 -4
  510. package/dist/versioning.d.ts.map +1 -1
  511. package/dist/versioning.js +9 -4
  512. package/dist/versioning.js.map +1 -1
  513. package/dist/write-identity.d.ts +5 -0
  514. package/dist/write-identity.d.ts.map +1 -0
  515. package/dist/write-identity.js +9 -0
  516. package/dist/write-identity.js.map +1 -0
  517. package/package.json +94 -2
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Qualified (cross-bundle) links: `[text](okf://<alias>/<path>.md[#fragment])`.
3
+ *
4
+ * `alias` is declared in the linking bundle's `docs/dependencies`; `path` is a concept id plus
5
+ * `.md`, relative to the TARGET bundle's root and used literally (never resolved against the
6
+ * linking file). The display text is the link's type, as for local typed links.
7
+ *
8
+ * The local link resolver ({@link parseLinksFromDoc}) treats `okf://` as external and ignores it,
9
+ * so local edges, backlinks and the renderer are unchanged; this module is the one parser for the
10
+ * qualified form. Pure and browser-safe.
11
+ */
12
+ import { isBundleAlias } from "./dependencies.js";
13
+ import { InvalidInputError } from "./errors.js";
14
+ import { extractMarkdownLinks } from "./links.js";
15
+ import { assertSafeConceptId, isReservedFile } from "./paths.js";
16
+ export const QUALIFIED_HREF_PREFIX = "okf://";
17
+ /**
18
+ * True when the href uses the `okf:` scheme in any letter case. A true answer means "this is a
19
+ * cross-bundle link"; {@link parseQualifiedHref} then says whether it is well formed (a malformed
20
+ * one is reported as `invalid_ref`, never silently ignored).
21
+ */
22
+ export function isQualifiedHref(href) {
23
+ return /^okf:/i.test(href.trim());
24
+ }
25
+ /**
26
+ * Parse an `okf://` href. Refused (`ok: false`, read as `invalid_ref`): another scheme or a
27
+ * non-lower-case `okf://`, an alias outside `^[a-z][a-z0-9-]{0,62}$`, a leading `/` in the path,
28
+ * an empty, `.`, `..` or dot-prefixed segment, a query, a `%`, a non-`.md` target, `index.md` or
29
+ * `log.md` in any letter case, and any id the storage seam would refuse. The fragment is returned but plays no part in resolution.
30
+ */
31
+ export function parseQualifiedHref(href) {
32
+ const raw = href.trim();
33
+ if (!raw.startsWith(QUALIFIED_HREF_PREFIX)) {
34
+ return { ok: false, detail: "a cross-bundle link must start with okf://" };
35
+ }
36
+ const hash = raw.indexOf("#");
37
+ const target = hash >= 0 ? raw.slice(QUALIFIED_HREF_PREFIX.length, hash) : raw.slice(QUALIFIED_HREF_PREFIX.length);
38
+ const fragment = hash >= 0 ? raw.slice(hash + 1) : undefined;
39
+ if (target.includes("?"))
40
+ return { ok: false, detail: "a query is not allowed" };
41
+ if (target.includes("%"))
42
+ return { ok: false, detail: "percent-encoding is not allowed" };
43
+ const slash = target.indexOf("/");
44
+ if (slash < 0)
45
+ return { ok: false, detail: "expected okf://<alias>/<path>.md" };
46
+ const alias = target.slice(0, slash);
47
+ const path = target.slice(slash + 1);
48
+ if (!isBundleAlias(alias))
49
+ return { ok: false, detail: "alias must match ^[a-z][a-z0-9-]{0,62}$" };
50
+ if (path.startsWith("/"))
51
+ return { ok: false, detail: "the path is relative to the target bundle's root and must not start with /" };
52
+ if (path.split("/").some((segment) => segment.startsWith("."))) {
53
+ return { ok: false, detail: "'.', '..' and dot-prefixed segments are not allowed" };
54
+ }
55
+ if (!path.endsWith(".md"))
56
+ return { ok: false, detail: "the target must be a .md document" };
57
+ // Case-insensitive: `INDEX.md` names the reserved file on a case-insensitive filesystem.
58
+ if (isReservedFile(path.toLowerCase()))
59
+ return { ok: false, detail: "index.md and log.md are not documents" };
60
+ const id = path.slice(0, -".md".length);
61
+ try {
62
+ assertSafeConceptId(id);
63
+ }
64
+ catch (error) {
65
+ if (error instanceof InvalidInputError)
66
+ return { ok: false, detail: error.message };
67
+ throw error;
68
+ }
69
+ return fragment === undefined ? { ok: true, ref: { alias, id } } : { ok: true, ref: { alias, id }, fragment };
70
+ }
71
+ /** Emit `okf://<alias>/<id>.md[#fragment]`. Throws {@link InvalidInputError} for a ref that would not parse back. */
72
+ export function qualifiedHref(ref, fragment) {
73
+ const href = `${QUALIFIED_HREF_PREFIX}${ref.alias}/${ref.id}.md${fragment === undefined ? "" : `#${fragment}`}`;
74
+ const parsed = parseQualifiedHref(href);
75
+ if (!parsed.ok || parsed.ref.alias !== ref.alias || parsed.ref.id !== ref.id || parsed.fragment !== fragment) {
76
+ throw new InvalidInputError(`Not a valid cross-bundle target: ${parsed.ok ? "it does not parse back to the same alias and id" : parsed.detail}.`);
77
+ }
78
+ return href;
79
+ }
80
+ /**
81
+ * Every `okf:` link in a document body, in document order, malformed ones included. A link inside
82
+ * an inline code span or a fenced or indented code block is example text, not a link.
83
+ */
84
+ export function parseQualifiedLinks(doc) {
85
+ const out = [];
86
+ for (const raw of extractMarkdownLinks(doc.body, { skipCode: true })) {
87
+ if (!isQualifiedHref(raw.href))
88
+ continue;
89
+ const parsed = parseQualifiedHref(raw.href);
90
+ out.push(parsed.ok
91
+ ? { from: doc.id, text: raw.text, href: raw.href, ref: parsed.ref }
92
+ : { from: doc.id, text: raw.text, href: raw.href, ref: null, detail: parsed.detail });
93
+ }
94
+ return out;
95
+ }
96
+ /** A well-formed qualified link as an edge: `to` is the id in the target bundle, `bundle` its alias. */
97
+ export function qualifiedLinkEdge(link) {
98
+ if (link.ref === null)
99
+ return null;
100
+ return { from: link.from, to: link.ref.id, text: link.text, href: link.href, bundle: link.ref.alias };
101
+ }
102
+ /**
103
+ * Read a Kind link target (`links: {pours: "beers:Beer"}`). The target is qualified when the text
104
+ * before the first `:` matches the alias grammar; anything else (`Beer`, `Some: Thing`) is a local
105
+ * Kind name and returns null, as does a qualified target with no Kind (`beers:`).
106
+ */
107
+ export function parseQualifiedKindTarget(target) {
108
+ const colon = target.indexOf(":");
109
+ if (colon < 0)
110
+ return null;
111
+ const alias = target.slice(0, colon);
112
+ if (!isBundleAlias(alias))
113
+ return null;
114
+ const kind = target.slice(colon + 1).trim();
115
+ return kind === "" ? null : { alias, kind };
116
+ }
117
+ //# sourceMappingURL=qualified-links.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qualified-links.js","sourceRoot":"","sources":["../src/qualified-links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AAY9C;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,QAAQ,CAAC,IA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E,CAAC;IAC5C,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC9C,CAAC"}
@@ -1,7 +1,8 @@
1
1
  /** Browser-safe, storage-free query predicate shared by every head-projection consumer. */
2
- import type { ConceptId, Frontmatter, QueryFilter } from "./types.js";
2
+ import type { ConceptId, Frontmatter, QueryFilter, SourceIdentity } from "./types.js";
3
3
  /**
4
- * THE canonical {@link QueryFilter} predicate — every facet (`prefix`, `type`, `tags`, `fields`),
4
+ * THE canonical {@link QueryFilter} predicate — every facet (`prefix`, `type`, `tags`, `fields`,
5
+ * `sources`),
5
6
  * ANDed. Kept in a storage-free module so both Node consumers and the browser View bridge can use
6
7
  * the same scalar/array/string-coercion semantics without importing the filesystem-backed engine.
7
8
  */
@@ -9,4 +10,17 @@ export declare function matchesFilter(doc: {
9
10
  id: ConceptId;
10
11
  frontmatter: Frontmatter;
11
12
  }, filter: QueryFilter): boolean;
13
+ /**
14
+ * The identity one `sources[]` entry carries: its own string `resource` and `id`, each omitted when
15
+ * absent, inherited or not a string. Undefined when the entry is not a mapping. The one reading of
16
+ * an entry's identity, shared by {@link matchesSourceIdentity} and identity indexes.
17
+ */
18
+ export declare function sourceIdentityOf(entry: unknown): {
19
+ resource?: string;
20
+ id?: string;
21
+ } | undefined;
22
+ /** THE `sources[]` identity predicate for one entry; see {@link SourceIdentity} for the rule. */
23
+ export declare function matchesSourceIdentity(entry: unknown, identity: SourceIdentity): boolean;
24
+ /** True when a frontmatter `sources` value is a list holding an entry with this identity. */
25
+ export declare function hasSourceIdentity(sources: unknown, identity: SourceIdentity): boolean;
12
26
  //# sourceMappingURL=query-filter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-filter.d.ts","sourceRoot":"","sources":["../src/query-filter.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE;IAAE,EAAE,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,WAAW,CAAA;CAAE,EAChD,MAAM,EAAE,WAAW,GAClB,OAAO,CAmBT"}
1
+ {"version":3,"file":"query-filter.d.ts","sourceRoot":"","sources":["../src/query-filter.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEtF;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE;IAAE,EAAE,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,WAAW,CAAA;CAAE,EAChD,MAAM,EAAE,WAAW,GAClB,OAAO,CAsBT;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAQ/F;AAED,iGAAiG;AACjG,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CASvF;AAED,6FAA6F;AAC7F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAErF"}
@@ -1,5 +1,6 @@
1
1
  /**
2
- * THE canonical {@link QueryFilter} predicate — every facet (`prefix`, `type`, `tags`, `fields`),
2
+ * THE canonical {@link QueryFilter} predicate — every facet (`prefix`, `type`, `tags`, `fields`,
3
+ * `sources`),
3
4
  * ANDed. Kept in a storage-free module so both Node consumers and the browser View bridge can use
4
5
  * the same scalar/array/string-coercion semantics without importing the filesystem-backed engine.
5
6
  */
@@ -24,6 +25,44 @@ export function matchesFilter(doc, filter) {
24
25
  return false;
25
26
  }
26
27
  }
28
+ if (filter.sources && (filter.sources.resource !== undefined || filter.sources.id !== undefined)) {
29
+ if (!hasSourceIdentity(doc.frontmatter.sources, filter.sources))
30
+ return false;
31
+ }
32
+ return true;
33
+ }
34
+ /**
35
+ * The identity one `sources[]` entry carries: its own string `resource` and `id`, each omitted when
36
+ * absent, inherited or not a string. Undefined when the entry is not a mapping. The one reading of
37
+ * an entry's identity, shared by {@link matchesSourceIdentity} and identity indexes.
38
+ */
39
+ export function sourceIdentityOf(entry) {
40
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry))
41
+ return undefined;
42
+ const row = entry;
43
+ const identity = {};
44
+ for (const key of ["resource", "id"]) {
45
+ if (Object.hasOwn(row, key) && typeof row[key] === "string")
46
+ identity[key] = row[key];
47
+ }
48
+ return identity;
49
+ }
50
+ /** THE `sources[]` identity predicate for one entry; see {@link SourceIdentity} for the rule. */
51
+ export function matchesSourceIdentity(entry, identity) {
52
+ const own = sourceIdentityOf(entry);
53
+ if (!own)
54
+ return false;
55
+ for (const key of ["resource", "id"]) {
56
+ const expected = identity[key];
57
+ if (expected === undefined)
58
+ continue;
59
+ if (own[key] === undefined || own[key] !== expected)
60
+ return false;
61
+ }
27
62
  return true;
28
63
  }
64
+ /** True when a frontmatter `sources` value is a list holding an entry with this identity. */
65
+ export function hasSourceIdentity(sources, identity) {
66
+ return Array.isArray(sources) && sources.some((entry) => matchesSourceIdentity(entry, identity));
67
+ }
29
68
  //# sourceMappingURL=query-filter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-filter.js","sourceRoot":"","sources":["../src/query-filter.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,GAAgD,EAChD,MAAmB;IAEnB,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IACrE,IAAI,MAAM,CAAC,IAAI,IAAI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E,OAAO,KAAK,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAU,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,QAAQ,KAAK,SAAS;YAAE,SAAS;QACrC,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;IACpE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,iBAAiB,CAAC,OAAgB,EAAE,QAAwB;IAC1E,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACnG,CAAC"}
@@ -0,0 +1,22 @@
1
+ export interface MeaningfulChangeOrderKey {
2
+ id: string;
3
+ /** The raw selected clock when it is a string, else `""`. */
4
+ timestamp: string;
5
+ /** The clock parsed under the bundle's OKF edition, or `null` when missing or invalid. */
6
+ timestampMs: number | null;
7
+ }
8
+ export declare function meaningfulChangeOrderKey(id: string, frontmatter: {
9
+ readonly generated?: unknown;
10
+ readonly timestamp?: unknown;
11
+ }, okfVersion?: string | null): MeaningfulChangeOrderKey;
12
+ /** Newest usable meaningful-change time first; canonical ID in code-unit order for all ties. */
13
+ export declare function compareByMeaningfulChange(a: MeaningfulChangeOrderKey, b: MeaningfulChangeOrderKey): number;
14
+ /** Return a new array of `rows` in newest-first order; the input array is left untouched. */
15
+ export declare function sortByMeaningfulChange<T extends {
16
+ id: string;
17
+ frontmatter: {
18
+ readonly generated?: unknown;
19
+ readonly timestamp?: unknown;
20
+ };
21
+ }>(rows: readonly T[], okfVersion?: string | null): T[];
22
+ //# sourceMappingURL=query-order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-order.d.ts","sourceRoot":"","sources":["../src/query-order.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,0FAA0F;IAC1F,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,MAAM,EACV,WAAW,EAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,EAC3E,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,wBAAwB,CAO1B;AAED,gGAAgG;AAChG,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,wBAAwB,EAAE,CAAC,EAAE,wBAAwB,GAAG,MAAM,CAS1G;AAED,6FAA6F;AAC7F,wBAAgB,sBAAsB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE;QAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,EAC1I,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,CAAC,EAAE,CAKL"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Newest-first order shared by `list`, `home` and the View Bridge `order: "newest"` query.
3
+ *
4
+ * Rows sort by their parsed meaningful-change time (`generated.at`, else legacy `timestamp`),
5
+ * newest first. Rows with a missing or unparseable time follow every timed row. Every tie,
6
+ * including the untimed tail, breaks on the canonical ID in UTF-16 code-unit order, which every
7
+ * host computes identically; `localeCompare` depends on the platform's ICU data.
8
+ *
9
+ * Browser-safe and pure.
10
+ */
11
+ import { parseTimestamp } from "./freshness.js";
12
+ import { meaningfulChangeTimeValue } from "./meaningful-change-time.js";
13
+ export function meaningfulChangeOrderKey(id, frontmatter, okfVersion) {
14
+ const value = meaningfulChangeTimeValue(frontmatter);
15
+ return {
16
+ id,
17
+ timestamp: typeof value === "string" ? value : "",
18
+ timestampMs: parseTimestamp(value, okfVersion ?? undefined),
19
+ };
20
+ }
21
+ /** Newest usable meaningful-change time first; canonical ID in code-unit order for all ties. */
22
+ export function compareByMeaningfulChange(a, b) {
23
+ if (a.timestampMs !== null && b.timestampMs !== null) {
24
+ if (a.timestampMs !== b.timestampMs)
25
+ return b.timestampMs - a.timestampMs;
26
+ }
27
+ else if (a.timestampMs !== null) {
28
+ return -1;
29
+ }
30
+ else if (b.timestampMs !== null) {
31
+ return 1;
32
+ }
33
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
34
+ }
35
+ /** Return a new array of `rows` in newest-first order; the input array is left untouched. */
36
+ export function sortByMeaningfulChange(rows, okfVersion) {
37
+ return rows
38
+ .map((row) => ({ row, key: meaningfulChangeOrderKey(row.id, row.frontmatter, okfVersion) }))
39
+ .sort((a, b) => compareByMeaningfulChange(a.key, b.key))
40
+ .map(({ row }) => row);
41
+ }
42
+ //# sourceMappingURL=query-order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-order.js","sourceRoot":"","sources":["../src/query-order.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAUxE,MAAM,UAAU,wBAAwB,CACtC,EAAU,EACV,WAA2E,EAC3E,UAA0B;IAE1B,MAAM,KAAK,GAAG,yBAAyB,CAAC,WAAW,CAAC,CAAC;IACrD,OAAO;QACL,EAAE;QACF,SAAS,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QACjD,WAAW,EAAE,cAA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}
@@ -0,0 +1,96 @@
1
+ import type { ConnectorErrorCode } from "../connectors.js";
2
+ import type { ConceptId, Version } from "../types.js";
3
+ import type { RecipeEvolutionBlocker } from "./evolution.js";
4
+ /**
5
+ * One recipe target the evolution apply has handled, in plan order: `changed` when its content was
6
+ * updated, `stamped` when this apply wrote it (a content update or a stamp alone).
7
+ */
8
+ export interface RecipeEvolutionCompletedDefinition {
9
+ /** Present only for Reference targets; existing definition receipts retain their shape. */
10
+ asset_kind?: "reference";
11
+ id: ConceptId;
12
+ changed: boolean;
13
+ stamped: boolean;
14
+ version: Version;
15
+ }
16
+ /** The common base: every recipe lifecycle failure is one of the subclasses below. */
17
+ export declare class RecipeLifecycleError extends Error {
18
+ constructor(message: string, options?: {
19
+ cause?: unknown;
20
+ });
21
+ }
22
+ /** The recipe itself cannot target this bundle: an unsupported edition or a contradictory field declaration. */
23
+ export declare class RecipeInputError extends RecipeLifecycleError {
24
+ constructor(message: string);
25
+ }
26
+ /** A recipe asset (View entry, View registry or Reference) differs from what the bundle already holds there. */
27
+ export declare class RecipeAssetConflict extends RecipeLifecycleError {
28
+ readonly recipe: string;
29
+ readonly key: string;
30
+ constructor(recipe: string, key: string);
31
+ }
32
+ /**
33
+ * A Connector the recipe carries maps onto a Kind this bundle (with the recipe's own conventions)
34
+ * does not declare, or onto fields that Kind does not allow. Install checks every connector before
35
+ * its first write, so nothing has been written.
36
+ */
37
+ export declare class ConnectorTargetUnsatisfied extends RecipeLifecycleError {
38
+ readonly recipe: string;
39
+ readonly connector: ConceptId;
40
+ /** The source whose target Kind refused it. */
41
+ readonly source: string;
42
+ readonly kind: string;
43
+ readonly code: ConnectorErrorCode;
44
+ /** The mapped fields the Kind refused; empty when the Kind itself is not declared. */
45
+ readonly fields: readonly string[];
46
+ constructor(recipe: string, connector: ConceptId, source: string, kind: string, code: ConnectorErrorCode, fields: readonly string[], detail: string);
47
+ }
48
+ /** The bundle's OKF edition changed between the lifecycle's read of it and a write. */
49
+ export declare class RecipeEditionChanged extends RecipeLifecycleError {
50
+ readonly from: string;
51
+ readonly to: string;
52
+ readonly operation: "installation" | "evolution";
53
+ constructor(from: string, to: string, operation: "installation" | "evolution");
54
+ }
55
+ /** The plan token the caller observed no longer matches the bundle's current plan. */
56
+ export declare class RecipeEvolutionPlanChanged extends RecipeLifecycleError {
57
+ readonly expected: string;
58
+ readonly current: string;
59
+ constructor(expected: string, current: string);
60
+ }
61
+ /** The observed plan is not ready: it carries blockers, so nothing was written. */
62
+ export declare class RecipeEvolutionBlocked extends RecipeLifecycleError {
63
+ readonly recipe: string;
64
+ readonly blockers: readonly RecipeEvolutionBlocker[];
65
+ constructor(recipe: string, blockers: readonly RecipeEvolutionBlocker[]);
66
+ }
67
+ /**
68
+ * Why a write loop stopped part way. `race`: a target's exact-version CAS failed or the target
69
+ * disappeared. `write_policy`: the write policy rejected a candidate after preflight.
70
+ * `edition_changed`: the bundle edition moved during the loop. `other`: any other failure, kept
71
+ * as `cause` for the presenting boundary to classify.
72
+ */
73
+ export type RecipeEvolutionInterruptionReason = "race" | "write_policy" | "edition_changed" | "other";
74
+ /** The evolution apply stopped after writing `completed`; `pending` names the targets still unwritten. */
75
+ export declare class RecipeEvolutionInterrupted extends RecipeLifecycleError {
76
+ readonly reason: RecipeEvolutionInterruptionReason;
77
+ readonly completed: RecipeEvolutionCompletedDefinition[];
78
+ readonly pending: ConceptId[];
79
+ constructor(reason: RecipeEvolutionInterruptionReason, message: string, completed: RecipeEvolutionCompletedDefinition[], pending: ConceptId[], cause: unknown);
80
+ }
81
+ /**
82
+ * Every write succeeded, but the re-plan after the loop could not run (`unverifiable`) or no longer
83
+ * reads ready and unchanged (`changed`), because the bundle has no cross-document transaction.
84
+ */
85
+ export declare class RecipeEvolutionPostcondition extends RecipeLifecycleError {
86
+ readonly reason: "unverifiable" | "changed";
87
+ readonly completed: RecipeEvolutionCompletedDefinition[];
88
+ readonly blockers?: readonly RecipeEvolutionBlocker[];
89
+ readonly postcondition_plan?: string;
90
+ constructor(reason: "unverifiable" | "changed", message: string, completed: RecipeEvolutionCompletedDefinition[], details?: {
91
+ blockers?: readonly RecipeEvolutionBlocker[];
92
+ postcondition_plan?: string;
93
+ cause?: unknown;
94
+ });
95
+ }
96
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/recipe-lifecycle/errors.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,kCAAkC;IACjD,2FAA2F;IAC3F,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,EAAE,EAAE,SAAS,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,sFAAsF;AACtF,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAI3D;AAED,gHAAgH;AAChH,qBAAa,gBAAiB,SAAQ,oBAAoB;gBAC5C,OAAO,EAAE,MAAM;CAI5B;AAED,gHAAgH;AAChH,qBAAa,mBAAoB,SAAQ,oBAAoB;IAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBAET,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;CASxC;AAED;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,oBAAoB;IAClE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAA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GAA0G;AAC1G,qBAAa,0BAA2B,SAAQ,oBAAoB;IAClE,QAAQ,CAAC,MAAM,EAAE,iCAAiC,CAAC;IACnD,QAAQ,CAAC,SAAS,EAAE,kCAAkC,EAAE,CAAC;IACzD,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC;gBAG5B,MAAM,EAAE,iCAAiC,EACzC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,kCAAkC,EAAE,EAC/C,OAAO,EAAE,SAAS,EAAE,EACpB,KAAK,EAAE,OAAO;CAQjB;AAED;;;GAGG;AACH,qBAAa,4BAA6B,SAAQ,oBAAoB;IACpE,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,kCAAkC,EAAE,CAAC;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACtD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;gBAGnC,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,kCAAkC,EAAE,EAC/C,OAAO,GAAE;QAAE,QAAQ,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO;CAS/G"}
@@ -0,0 +1,122 @@
1
+ /** The common base: every recipe lifecycle failure is one of the subclasses below. */
2
+ export class RecipeLifecycleError extends Error {
3
+ constructor(message, options) {
4
+ super(message, options);
5
+ this.name = "RecipeLifecycleError";
6
+ }
7
+ }
8
+ /** The recipe itself cannot target this bundle: an unsupported edition or a contradictory field declaration. */
9
+ export class RecipeInputError extends RecipeLifecycleError {
10
+ constructor(message) {
11
+ super(message);
12
+ this.name = "RecipeInputError";
13
+ }
14
+ }
15
+ /** A recipe asset (View entry, View registry or Reference) differs from what the bundle already holds there. */
16
+ export class RecipeAssetConflict extends RecipeLifecycleError {
17
+ recipe;
18
+ key;
19
+ constructor(recipe, key) {
20
+ super(`recipe '${recipe}' cannot install '${key}' because a different target already exists; ` +
21
+ "the existing bundle content was left untouched");
22
+ this.name = "RecipeAssetConflict";
23
+ this.recipe = recipe;
24
+ this.key = key;
25
+ }
26
+ }
27
+ /**
28
+ * A Connector the recipe carries maps onto a Kind this bundle (with the recipe's own conventions)
29
+ * does not declare, or onto fields that Kind does not allow. Install checks every connector before
30
+ * its first write, so nothing has been written.
31
+ */
32
+ export class ConnectorTargetUnsatisfied extends RecipeLifecycleError {
33
+ recipe;
34
+ connector;
35
+ /** The source whose target Kind refused it. */
36
+ source;
37
+ kind;
38
+ code;
39
+ /** The mapped fields the Kind refused; empty when the Kind itself is not declared. */
40
+ fields;
41
+ constructor(recipe, connector, source, kind, code, fields, detail) {
42
+ super(`recipe '${recipe}' cannot install Connector '${connector}': source '${source}' maps onto ${kind}, and ${detail}; ` +
43
+ "nothing was written");
44
+ this.name = "ConnectorTargetUnsatisfied";
45
+ this.recipe = recipe;
46
+ this.connector = connector;
47
+ this.source = source;
48
+ this.kind = kind;
49
+ this.code = code;
50
+ this.fields = fields;
51
+ }
52
+ }
53
+ /** The bundle's OKF edition changed between the lifecycle's read of it and a write. */
54
+ export class RecipeEditionChanged extends RecipeLifecycleError {
55
+ from;
56
+ to;
57
+ operation;
58
+ constructor(from, to, operation) {
59
+ super(`bundle OKF version changed from '${from}' to '${to}' during recipe ${operation}` +
60
+ (operation === "installation" ? "; retry" : ""));
61
+ this.name = "RecipeEditionChanged";
62
+ this.from = from;
63
+ this.to = to;
64
+ this.operation = operation;
65
+ }
66
+ }
67
+ /** The plan token the caller observed no longer matches the bundle's current plan. */
68
+ export class RecipeEvolutionPlanChanged extends RecipeLifecycleError {
69
+ expected;
70
+ current;
71
+ constructor(expected, current) {
72
+ super(`recipe evolution plan changed (expected ${expected}, current ${current}); inspect a fresh plan before applying`);
73
+ this.name = "RecipeEvolutionPlanChanged";
74
+ this.expected = expected;
75
+ this.current = current;
76
+ }
77
+ }
78
+ /** The observed plan is not ready: it carries blockers, so nothing was written. */
79
+ export class RecipeEvolutionBlocked extends RecipeLifecycleError {
80
+ recipe;
81
+ blockers;
82
+ constructor(recipe, blockers) {
83
+ super(`recipe '${recipe}' cannot evolve automatically (${blockers.length} blocker${blockers.length === 1 ? "" : "s"})`);
84
+ this.name = "RecipeEvolutionBlocked";
85
+ this.recipe = recipe;
86
+ this.blockers = blockers;
87
+ }
88
+ }
89
+ /** The evolution apply stopped after writing `completed`; `pending` names the targets still unwritten. */
90
+ export class RecipeEvolutionInterrupted extends RecipeLifecycleError {
91
+ reason;
92
+ completed;
93
+ pending;
94
+ constructor(reason, message, completed, pending, cause) {
95
+ super(message, { cause });
96
+ this.name = "RecipeEvolutionInterrupted";
97
+ this.reason = reason;
98
+ this.completed = completed;
99
+ this.pending = pending;
100
+ }
101
+ }
102
+ /**
103
+ * Every write succeeded, but the re-plan after the loop could not run (`unverifiable`) or no longer
104
+ * reads ready and unchanged (`changed`), because the bundle has no cross-document transaction.
105
+ */
106
+ export class RecipeEvolutionPostcondition extends RecipeLifecycleError {
107
+ reason;
108
+ completed;
109
+ blockers;
110
+ postcondition_plan;
111
+ constructor(reason, message, completed, details = {}) {
112
+ super(message, details.cause === undefined ? undefined : { cause: details.cause });
113
+ this.name = "RecipeEvolutionPostcondition";
114
+ this.reason = reason;
115
+ this.completed = completed;
116
+ if (details.blockers !== undefined)
117
+ this.blockers = details.blockers;
118
+ if (details.postcondition_plan !== undefined)
119
+ this.postcondition_plan = details.postcondition_plan;
120
+ }
121
+ }
122
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/recipe-lifecycle/errors.ts"],"names":[],"mappings":"AAoBA,sFAAsF;AACtF,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO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C,kBAAkB,CAAC;IACrG,CAAC;CACF"}
@@ -0,0 +1,108 @@
1
+ import type { LoadedRecipe } from "../recipes.js";
2
+ import type { Bundle, ConceptId, Version } from "../types.js";
3
+ import { type RecipeEvolutionCompletedDefinition } from "./errors.js";
4
+ import { type RecipeStampState } from "./stamp.js";
5
+ export interface RecipeEvolutionDefinition {
6
+ id: ConceptId;
7
+ /**
8
+ * The Kind a convention governs; `Connector` on a Connector row, a value no recipe convention
9
+ * may govern.
10
+ */
11
+ governs: string;
12
+ /** Content only: whether the definition's declarations change (a Connector's, as a whole). */
13
+ action: "missing" | "unchanged" | "update";
14
+ /** The installed definition's recipe stamp relative to this recipe. */
15
+ stamp: RecipeStampState;
16
+ expected_version: Version | null;
17
+ desired_version: Version;
18
+ /** Exact additive semantic paths this automatic plan will introduce. */
19
+ added_paths: string[];
20
+ /** Proven recipe-owned field guidance replacements, with the exact observed and proposed text. */
21
+ description_replacements?: Array<{
22
+ path: string;
23
+ old: string;
24
+ new: string;
25
+ }>;
26
+ }
27
+ /** A Reference decision is separate from convention/Connector definition counts. */
28
+ export interface RecipeEvolutionReference {
29
+ id: ConceptId;
30
+ action: "missing" | "unchanged" | "update";
31
+ stamp: RecipeStampState;
32
+ expected_version: Version | null;
33
+ desired_version: Version;
34
+ }
35
+ export interface RecipeEvolutionReferenceAssets {
36
+ rows: RecipeEvolutionReference[];
37
+ counts: {
38
+ updates: number;
39
+ stamp_writes: number;
40
+ unchanged: number;
41
+ missing: number;
42
+ };
43
+ }
44
+ export interface RecipeEvolutionBlocker {
45
+ code: string;
46
+ id: string;
47
+ message: string;
48
+ field?: string;
49
+ }
50
+ /** Public representation of one read-only, state-bound preflight decision. */
51
+ export interface RecipeEvolutionPlan {
52
+ recipe: "evolution plan";
53
+ id: string;
54
+ version: string;
55
+ source: string;
56
+ okf_version: string;
57
+ ready: boolean;
58
+ /** Content only: whether any definition or Reference changes. */
59
+ changed: boolean;
60
+ /** Total definition and Reference writes, including stamp-only adoption. */
61
+ writes: number;
62
+ plan_token: string;
63
+ definitions: RecipeEvolutionDefinition[];
64
+ /** Present only for recipes declaring References. Top-level writes/changed cover both sets. */
65
+ reference_assets?: RecipeEvolutionReferenceAssets;
66
+ counts: {
67
+ definitions: number;
68
+ updates: number;
69
+ /** Writes that only record the stamp: write-set members whose action is not `update`. */
70
+ stamp_writes: number;
71
+ unchanged: number;
72
+ missing: number;
73
+ instances_checked: number;
74
+ blockers: number;
75
+ };
76
+ blockers: RecipeEvolutionBlocker[];
77
+ }
78
+ export interface RecipeEvolutionApplyResult {
79
+ /** `evolved`: a content update was written; `stamped`: only stamps were; `already current`: nothing. */
80
+ recipe: "evolved" | "stamped" | "already current";
81
+ id: string;
82
+ version: string;
83
+ source: string;
84
+ /** True whenever anything was written. */
85
+ changed: boolean;
86
+ plan_token: string;
87
+ definitions: RecipeEvolutionCompletedDefinition[];
88
+ reference_assets?: {
89
+ rows: RecipeEvolutionCompletedDefinition[];
90
+ counts: {
91
+ updated: number;
92
+ stamped: number;
93
+ unchanged: number;
94
+ };
95
+ };
96
+ counts: {
97
+ updated: number;
98
+ stamped: number;
99
+ unchanged: number;
100
+ };
101
+ }
102
+ /** Build a read-only, state-bound preflight for recipe definitions and Reference ownership. */
103
+ export declare function planRecipeEvolution(bundle: Bundle, recipe: LoadedRecipe): Promise<RecipeEvolutionPlan>;
104
+ /** Apply only the exact ready plan the caller previously observed. */
105
+ export declare function applyRecipeEvolution(bundle: Bundle, recipe: LoadedRecipe, expectedPlanToken: string, options?: {
106
+ actor?: string;
107
+ }): Promise<RecipeEvolutionApplyResult>;
108
+ //# sourceMappingURL=evolution.d.ts.map