@dialecte/core 0.8.0 → 0.9.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 (295) hide show
  1. package/dist/assets/hub.worker-35vzG0HK.js +2 -0
  2. package/dist/dialecte/create-dialecte-project.d.ts +1 -2
  3. package/dist/dialecte/create-dialecte-project.d.ts.map +1 -1
  4. package/dist/dialecte/create-project-factory.d.ts +5 -5
  5. package/dist/dialecte/create-project-factory.d.ts.map +1 -1
  6. package/dist/dialecte/define-dialecte.d.ts +2 -2
  7. package/dist/dialecte/dialecte.types.d.ts +11 -23
  8. package/dist/dialecte/dialecte.types.d.ts.map +1 -1
  9. package/dist/{dialecte-gIPrRzni.js → dialecte-oAXwOG-Q.js} +1182 -1203
  10. package/dist/document/document.d.ts +1 -1
  11. package/dist/document/types.extensions.d.ts.map +1 -1
  12. package/dist/{engine-store-CIEqgPUb.js → engine-store-Deo9XNhr.js} +21 -21
  13. package/dist/engine.constants-Bi4gw6BR.js +205 -0
  14. package/dist/errors/{codes.d.ts → codes.constants.d.ts} +33 -105
  15. package/dist/errors/{codes.d.ts.map → codes.constants.d.ts.map} +1 -1
  16. package/dist/errors/core-codes.constants.d.ts +3 -0
  17. package/dist/errors/core-codes.constants.d.ts.map +1 -0
  18. package/dist/errors/errors.constants.d.ts +5 -0
  19. package/dist/errors/errors.constants.d.ts.map +1 -1
  20. package/dist/errors/errors.d.ts.map +1 -1
  21. package/dist/errors/index.d.ts +1 -1
  22. package/dist/errors/index.d.ts.map +1 -1
  23. package/dist/errors/types.d.ts +1 -1
  24. package/dist/errors/types.d.ts.map +1 -1
  25. package/dist/{helpers-DVShv41E.js → helpers-D8p0KiJu.js} +1 -1
  26. package/dist/helpers.js +2 -2
  27. package/dist/{in-process-link-DBeAOZRp.js → in-process-link-B-TCHrlb.js} +996 -993
  28. package/dist/index.js +8 -7
  29. package/dist/project/index.d.ts +1 -1
  30. package/dist/project/index.d.ts.map +1 -1
  31. package/dist/project/io/store-runtime.types.d.ts +1 -3
  32. package/dist/project/io/store-runtime.types.d.ts.map +1 -1
  33. package/dist/project/project.d.ts +13 -15
  34. package/dist/project/project.d.ts.map +1 -1
  35. package/dist/project/types.d.ts +24 -19
  36. package/dist/project/types.d.ts.map +1 -1
  37. package/dist/{project-key-Ch34EtFa.js → project-key-2ccZ-0gu.js} +195 -205
  38. package/dist/running-operations-DCKvzlU7.js +107 -0
  39. package/dist/{same-json-value-C6kUaoyt.js → same-json-value-_AChwM_n.js} +41 -41
  40. package/dist/sqlite-engine.d.ts +7 -0
  41. package/dist/sqlite-engine.d.ts.map +1 -0
  42. package/dist/{engine.js → sqlite-engine.js} +4136 -4075
  43. package/dist/sqlite.d.ts +27 -2
  44. package/dist/sqlite.d.ts.map +1 -1
  45. package/dist/sqlite.js +1118 -917
  46. package/dist/store/in-memory/in-memory-state.constants.d.ts +14 -0
  47. package/dist/store/in-memory/in-memory-state.constants.d.ts.map +1 -0
  48. package/dist/store/in-memory/in-memory-state.d.ts +0 -4
  49. package/dist/store/in-memory/in-memory-state.d.ts.map +1 -1
  50. package/dist/store/in-memory/in-memory-store.d.ts.map +1 -1
  51. package/dist/store/in-memory/types.d.ts +1 -2
  52. package/dist/store/in-memory/types.d.ts.map +1 -1
  53. package/dist/store/index.d.ts +2 -1
  54. package/dist/store/index.d.ts.map +1 -1
  55. package/dist/store/lost-write.d.ts +8 -8
  56. package/dist/store/lost-write.d.ts.map +1 -1
  57. package/dist/store/lost-write.types.d.ts +1 -1
  58. package/dist/store/lost-write.types.d.ts.map +1 -1
  59. package/dist/store/{engine/project-key.d.ts → project-key.d.ts} +0 -5
  60. package/dist/store/project-key.d.ts.map +1 -0
  61. package/dist/store/resolve-store.d.ts +6 -18
  62. package/dist/store/resolve-store.d.ts.map +1 -1
  63. package/dist/store/sqlite/adapter/in-process-link.constants.d.ts +12 -0
  64. package/dist/store/sqlite/adapter/in-process-link.constants.d.ts.map +1 -0
  65. package/dist/store/sqlite/adapter/in-process-link.d.ts +1 -1
  66. package/dist/store/sqlite/adapter/in-process-link.d.ts.map +1 -1
  67. package/dist/store/sqlite/adapter/sqlite-connector.d.ts +12 -11
  68. package/dist/store/sqlite/adapter/sqlite-connector.d.ts.map +1 -1
  69. package/dist/store/sqlite/adapter/sqlite-connector.types.d.ts +7 -0
  70. package/dist/store/sqlite/adapter/sqlite-connector.types.d.ts.map +1 -0
  71. package/dist/store/sqlite/adapter/sqlite-hub-spawner.d.ts +8 -3
  72. package/dist/store/sqlite/adapter/sqlite-hub-spawner.d.ts.map +1 -1
  73. package/dist/store/sqlite/adapter/sqlite-hub-spawner.types.d.ts +12 -1
  74. package/dist/store/sqlite/adapter/sqlite-hub-spawner.types.d.ts.map +1 -1
  75. package/dist/store/sqlite/adapter/sqlite-worker-connector.d.ts +2 -2
  76. package/dist/store/sqlite/adapter/sqlite-worker-connector.d.ts.map +1 -1
  77. package/dist/store/sqlite/adapter/sqlite-worker-connector.types.d.ts +1 -1
  78. package/dist/store/sqlite/adapter/sqlite-worker-connector.types.d.ts.map +1 -1
  79. package/dist/store/sqlite/engine/engine.types.d.ts +2 -2
  80. package/dist/store/sqlite/engine/engine.types.d.ts.map +1 -1
  81. package/dist/store/sqlite/engine/schema.d.ts.map +1 -1
  82. package/dist/store/sqlite/engine/sqlite-engine.d.ts.map +1 -1
  83. package/dist/store/{hub-public.d.ts → sqlite/hub-public.d.ts} +9 -9
  84. package/dist/store/sqlite/hub-public.d.ts.map +1 -0
  85. package/dist/store/sqlite/packaging/engine-packaging.constants.d.ts +15 -0
  86. package/dist/store/sqlite/packaging/engine-packaging.constants.d.ts.map +1 -0
  87. package/dist/store/sqlite/runtime/engine-control-loop.d.ts +11 -0
  88. package/dist/store/sqlite/runtime/engine-control-loop.d.ts.map +1 -0
  89. package/dist/store/sqlite/runtime/install-pool.d.ts +1 -1
  90. package/dist/store/sqlite/runtime/install-pool.d.ts.map +1 -1
  91. package/dist/store/sqlite/runtime/progress-beat.d.ts +1 -1
  92. package/dist/store/sqlite/runtime/progress-beat.d.ts.map +1 -1
  93. package/dist/store/sqlite/runtime/runtime.types.d.ts +4 -2
  94. package/dist/store/sqlite/runtime/runtime.types.d.ts.map +1 -1
  95. package/dist/store/sqlite/runtime/serve-sqlite-engine.d.ts +9 -0
  96. package/dist/store/sqlite/runtime/serve-sqlite-engine.d.ts.map +1 -0
  97. package/dist/store/sqlite/runtime/serve-sqlite-engine.types.d.ts +27 -0
  98. package/dist/store/sqlite/runtime/serve-sqlite-engine.types.d.ts.map +1 -0
  99. package/dist/store/sqlite/served/client/check-engine-wire.d.ts.map +1 -0
  100. package/dist/store/{engine → sqlite/served}/client/client.constants.d.ts +3 -3
  101. package/dist/store/sqlite/served/client/client.constants.d.ts.map +1 -0
  102. package/dist/store/{engine → sqlite/served}/client/client.types.d.ts +13 -8
  103. package/dist/store/sqlite/served/client/client.types.d.ts.map +1 -0
  104. package/dist/store/{engine → sqlite/served}/client/engine-client.d.ts +1 -1
  105. package/dist/store/sqlite/served/client/engine-client.d.ts.map +1 -0
  106. package/dist/store/sqlite/served/client/engine-control.d.ts.map +1 -0
  107. package/dist/store/sqlite/served/client/heartbeat-watch.d.ts.map +1 -0
  108. package/dist/store/{engine → sqlite/served}/client/hub-connector.d.ts +1 -1
  109. package/dist/store/sqlite/served/client/hub-connector.d.ts.map +1 -0
  110. package/dist/store/{engine → sqlite/served}/client/hub-connector.types.d.ts +6 -7
  111. package/dist/store/sqlite/served/client/hub-connector.types.d.ts.map +1 -0
  112. package/dist/store/sqlite/served/client/worker-connector.d.ts.map +1 -0
  113. package/dist/store/sqlite/served/creation-refusal.d.ts.map +1 -0
  114. package/dist/store/sqlite/served/dialecte-refusal.d.ts +19 -0
  115. package/dist/store/sqlite/served/dialecte-refusal.d.ts.map +1 -0
  116. package/dist/store/sqlite/served/engine-lock.d.ts +6 -0
  117. package/dist/store/sqlite/served/engine-lock.d.ts.map +1 -0
  118. package/dist/store/sqlite/served/engine-store.constants.d.ts +3 -0
  119. package/dist/store/sqlite/served/engine-store.constants.d.ts.map +1 -0
  120. package/dist/store/{engine → sqlite/served}/engine-store.d.ts +6 -6
  121. package/dist/store/sqlite/served/engine-store.d.ts.map +1 -0
  122. package/dist/store/sqlite/served/engine-store.types.d.ts.map +1 -0
  123. package/dist/store/sqlite/served/engine.constants.d.ts.map +1 -0
  124. package/dist/store/{engine → sqlite/served}/engine.types.d.ts +2 -4
  125. package/dist/store/sqlite/served/engine.types.d.ts.map +1 -0
  126. package/dist/store/sqlite/served/host/changed.d.ts +5 -0
  127. package/dist/store/sqlite/served/host/changed.d.ts.map +1 -0
  128. package/dist/store/sqlite/served/host/engine-wire.d.ts.map +1 -0
  129. package/dist/store/{engine → sqlite/served}/host/heartbeat.d.ts +1 -1
  130. package/dist/store/sqlite/served/host/heartbeat.d.ts.map +1 -0
  131. package/dist/store/sqlite/served/host/host.constants.d.ts.map +1 -0
  132. package/dist/store/{engine → sqlite/served}/host/host.types.d.ts +4 -3
  133. package/dist/store/sqlite/served/host/host.types.d.ts.map +1 -0
  134. package/dist/store/sqlite/served/host/store-events.constants.d.ts +9 -0
  135. package/dist/store/sqlite/served/host/store-events.constants.d.ts.map +1 -0
  136. package/dist/store/sqlite/served/host/store-events.d.ts.map +1 -0
  137. package/dist/store/sqlite/served/hub/hub-client.constants.d.ts.map +1 -0
  138. package/dist/store/sqlite/served/hub/hub-client.d.ts.map +1 -0
  139. package/dist/store/{engine → sqlite/served}/hub/hub-client.types.d.ts +2 -9
  140. package/dist/store/sqlite/served/hub/hub-client.types.d.ts.map +1 -0
  141. package/dist/store/sqlite/served/hub/hub-protocol.types.d.ts.map +1 -0
  142. package/dist/store/sqlite/served/hub/hub-router.d.ts.map +1 -0
  143. package/dist/store/sqlite/served/hub/hub-shell.d.ts.map +1 -0
  144. package/dist/store/sqlite/served/hub/hub-shell.types.d.ts.map +1 -0
  145. package/dist/store/{engine → sqlite/served}/hub/hub.constants.d.ts +3 -3
  146. package/dist/store/sqlite/served/hub/hub.constants.d.ts.map +1 -0
  147. package/dist/store/{engine → sqlite/served}/hub/hub.types.d.ts +2 -2
  148. package/dist/store/sqlite/served/hub/hub.types.d.ts.map +1 -0
  149. package/dist/store/sqlite/served/hub/hub.worker.d.ts.map +1 -0
  150. package/dist/store/sqlite/served/hub/realm-host.d.ts.map +1 -0
  151. package/dist/store/{engine → sqlite/served}/hub/realm-host.types.d.ts +3 -3
  152. package/dist/store/sqlite/served/hub/realm-host.types.d.ts.map +1 -0
  153. package/dist/store/sqlite/served/wire/error-envelope.d.ts.map +1 -0
  154. package/dist/store/sqlite/served/wire/wire-values.d.ts.map +1 -0
  155. package/dist/store/sqlite/served/wire/wire.constants.d.ts.map +1 -0
  156. package/dist/store/{engine → sqlite/served}/wire/wire.types.d.ts +1 -1
  157. package/dist/store/sqlite/served/wire/wire.types.d.ts.map +1 -0
  158. package/dist/store/sqlite/sqlite-connector-params.d.ts +13 -0
  159. package/dist/store/sqlite/sqlite-connector-params.d.ts.map +1 -0
  160. package/dist/store/sqlite/sqlite-engine-registration.d.ts +30 -0
  161. package/dist/store/sqlite/sqlite-engine-registration.d.ts.map +1 -0
  162. package/dist/store/sqlite/sqlite-error-entry.d.ts +10 -0
  163. package/dist/store/sqlite/sqlite-error-entry.d.ts.map +1 -0
  164. package/dist/store/sqlite/sqlite-errors.constants.d.ts +110 -0
  165. package/dist/store/sqlite/sqlite-errors.constants.d.ts.map +1 -0
  166. package/dist/store/sqlite/sqlite-errors.types.d.ts +7 -0
  167. package/dist/store/sqlite/sqlite-errors.types.d.ts.map +1 -0
  168. package/dist/store/sqlite/sqlite-storage-kind.constants.d.ts +10 -0
  169. package/dist/store/sqlite/sqlite-storage-kind.constants.d.ts.map +1 -0
  170. package/dist/store/sqlite/sqlite-storage-kind.d.ts +3 -0
  171. package/dist/store/sqlite/sqlite-storage-kind.d.ts.map +1 -0
  172. package/dist/store/sqlite/sqlite-storage.constants.d.ts +24 -0
  173. package/dist/store/sqlite/sqlite-storage.constants.d.ts.map +1 -0
  174. package/dist/store/sqlite/sqlite-storage.types.d.ts +27 -0
  175. package/dist/store/sqlite/sqlite-storage.types.d.ts.map +1 -0
  176. package/dist/store/sqlite/sqlite-store-of.d.ts +8 -3
  177. package/dist/store/sqlite/sqlite-store-of.d.ts.map +1 -1
  178. package/dist/store/storage-kinds.constants.d.ts +16 -0
  179. package/dist/store/storage-kinds.constants.d.ts.map +1 -0
  180. package/dist/store/storage-kinds.d.ts +43 -0
  181. package/dist/store/storage-kinds.d.ts.map +1 -0
  182. package/dist/store/storage-kinds.types.d.ts +46 -0
  183. package/dist/store/storage-kinds.types.d.ts.map +1 -0
  184. package/dist/store/store.types.d.ts +6 -4
  185. package/dist/store/store.types.d.ts.map +1 -1
  186. package/dist/test/create-test-dialecte.constants.d.ts +4 -0
  187. package/dist/test/create-test-dialecte.constants.d.ts.map +1 -0
  188. package/dist/test/create-test-dialecte.d.ts.map +1 -1
  189. package/dist/test/test-storage/index.d.ts +1 -1
  190. package/dist/test/test-storage/index.d.ts.map +1 -1
  191. package/dist/test/test-storage/sqlite-test-store.d.ts +15 -0
  192. package/dist/test/test-storage/sqlite-test-store.d.ts.map +1 -0
  193. package/dist/test/test-storage/test-storage.types.d.ts +12 -0
  194. package/dist/test/test-storage/test-storage.types.d.ts.map +1 -1
  195. package/dist/test/test-storage/test-store-for.d.ts +18 -6
  196. package/dist/test/test-storage/test-store-for.d.ts.map +1 -1
  197. package/dist/test/test-storage/test-store-providers.constants.d.ts +8 -0
  198. package/dist/test/test-storage/test-store-providers.constants.d.ts.map +1 -0
  199. package/dist/test/test-storage/test-store-providers.d.ts +11 -0
  200. package/dist/test/test-storage/test-store-providers.d.ts.map +1 -0
  201. package/dist/test.js +797 -763
  202. package/dist/types/dialecte-config.d.ts.map +1 -1
  203. package/dist/{utils-USNkj4sT.js → utils-Cv4oHia0.js} +63 -137
  204. package/dist/utils.js +1 -1
  205. package/package.json +16 -22
  206. package/skills/dialecte/SKILL.md +84 -15
  207. package/skills/dialecte/references/api.json +88 -61
  208. package/skills/dialecte/references/api.md +461 -459
  209. package/skills/dialecte/references/core-api.md +43 -15
  210. package/skills/dialecte-contributing/SKILL.md +94 -48
  211. package/skills/dialecte-contributing/references/code-rules.md +7 -0
  212. package/skills/dialecte-contributing/references/landing-changes.md +10 -6
  213. package/skills/dialecte-contributing/references/lot-in-a-package.md +45 -0
  214. package/skills/dialecte-contributing/references/perf.md +2 -1
  215. package/skills/dialecte-contributing/references/traps.md +20 -0
  216. package/skills/dialecte-lot/SKILL.md +106 -51
  217. package/skills/dialecte-lot/references/briefs.md +18 -9
  218. package/skills/dialecte-lot/references/model-tiers.md +3 -3
  219. package/skills/dialecte-lot/references/standard-check.md +45 -0
  220. package/skills/dialecte-lot/references/stations.md +110 -0
  221. package/dist/assets/hub.worker-B1HcVDhn.js +0 -2
  222. package/dist/engine.constants-DBMjMmV9.js +0 -98
  223. package/dist/engine.d.ts +0 -9
  224. package/dist/engine.d.ts.map +0 -1
  225. package/dist/running-operations-vnijBvn7.js +0 -76
  226. package/dist/store/engine/client/check-engine-wire.d.ts.map +0 -1
  227. package/dist/store/engine/client/client.constants.d.ts.map +0 -1
  228. package/dist/store/engine/client/client.types.d.ts.map +0 -1
  229. package/dist/store/engine/client/engine-client.d.ts.map +0 -1
  230. package/dist/store/engine/client/engine-control.d.ts.map +0 -1
  231. package/dist/store/engine/client/heartbeat-watch.d.ts.map +0 -1
  232. package/dist/store/engine/client/hub-connector.d.ts.map +0 -1
  233. package/dist/store/engine/client/hub-connector.types.d.ts.map +0 -1
  234. package/dist/store/engine/client/worker-connector.d.ts.map +0 -1
  235. package/dist/store/engine/creation-refusal.d.ts.map +0 -1
  236. package/dist/store/engine/dialecte-refusal.d.ts +0 -18
  237. package/dist/store/engine/dialecte-refusal.d.ts.map +0 -1
  238. package/dist/store/engine/engine-store.d.ts.map +0 -1
  239. package/dist/store/engine/engine-store.types.d.ts.map +0 -1
  240. package/dist/store/engine/engine.constants.d.ts.map +0 -1
  241. package/dist/store/engine/engine.types.d.ts.map +0 -1
  242. package/dist/store/engine/host/engine-wire.d.ts.map +0 -1
  243. package/dist/store/engine/host/heartbeat.d.ts.map +0 -1
  244. package/dist/store/engine/host/host.constants.d.ts.map +0 -1
  245. package/dist/store/engine/host/host.types.d.ts.map +0 -1
  246. package/dist/store/engine/host/store-events.d.ts.map +0 -1
  247. package/dist/store/engine/hub/hub-client.constants.d.ts.map +0 -1
  248. package/dist/store/engine/hub/hub-client.d.ts.map +0 -1
  249. package/dist/store/engine/hub/hub-client.types.d.ts.map +0 -1
  250. package/dist/store/engine/hub/hub-protocol.types.d.ts.map +0 -1
  251. package/dist/store/engine/hub/hub-router.d.ts.map +0 -1
  252. package/dist/store/engine/hub/hub-shell.d.ts.map +0 -1
  253. package/dist/store/engine/hub/hub-shell.types.d.ts.map +0 -1
  254. package/dist/store/engine/hub/hub.constants.d.ts.map +0 -1
  255. package/dist/store/engine/hub/hub.types.d.ts.map +0 -1
  256. package/dist/store/engine/hub/hub.worker.d.ts.map +0 -1
  257. package/dist/store/engine/hub/realm-host.d.ts.map +0 -1
  258. package/dist/store/engine/hub/realm-host.types.d.ts.map +0 -1
  259. package/dist/store/engine/project-key.d.ts.map +0 -1
  260. package/dist/store/engine/wire/error-envelope.d.ts.map +0 -1
  261. package/dist/store/engine/wire/wire-values.d.ts.map +0 -1
  262. package/dist/store/engine/wire/wire.constants.d.ts.map +0 -1
  263. package/dist/store/engine/wire/wire.types.d.ts.map +0 -1
  264. package/dist/store/hub-public.d.ts.map +0 -1
  265. package/dist/store/sqlite/runtime/serve-dialecte-engine.d.ts +0 -16
  266. package/dist/store/sqlite/runtime/serve-dialecte-engine.d.ts.map +0 -1
  267. package/dist/store/sqlite-storage.constants.d.ts +0 -14
  268. package/dist/store/sqlite-storage.constants.d.ts.map +0 -1
  269. package/dist/store/sqlite-storage.d.ts +0 -22
  270. package/dist/store/sqlite-storage.d.ts.map +0 -1
  271. package/dist/store/sqlite-storage.types.d.ts +0 -24
  272. package/dist/store/sqlite-storage.types.d.ts.map +0 -1
  273. package/dist/test/test-dialecte.worker.d.ts +0 -2
  274. package/dist/test/test-dialecte.worker.d.ts.map +0 -1
  275. /package/dist/store/{engine → sqlite/served}/client/check-engine-wire.d.ts +0 -0
  276. /package/dist/store/{engine → sqlite/served}/client/engine-control.d.ts +0 -0
  277. /package/dist/store/{engine → sqlite/served}/client/heartbeat-watch.d.ts +0 -0
  278. /package/dist/store/{engine → sqlite/served}/client/worker-connector.d.ts +0 -0
  279. /package/dist/store/{engine → sqlite/served}/creation-refusal.d.ts +0 -0
  280. /package/dist/store/{engine → sqlite/served}/engine-store.types.d.ts +0 -0
  281. /package/dist/store/{engine → sqlite/served}/engine.constants.d.ts +0 -0
  282. /package/dist/store/{engine → sqlite/served}/host/engine-wire.d.ts +0 -0
  283. /package/dist/store/{engine → sqlite/served}/host/host.constants.d.ts +0 -0
  284. /package/dist/store/{engine → sqlite/served}/host/store-events.d.ts +0 -0
  285. /package/dist/store/{engine → sqlite/served}/hub/hub-client.constants.d.ts +0 -0
  286. /package/dist/store/{engine → sqlite/served}/hub/hub-client.d.ts +0 -0
  287. /package/dist/store/{engine → sqlite/served}/hub/hub-protocol.types.d.ts +0 -0
  288. /package/dist/store/{engine → sqlite/served}/hub/hub-router.d.ts +0 -0
  289. /package/dist/store/{engine → sqlite/served}/hub/hub-shell.d.ts +0 -0
  290. /package/dist/store/{engine → sqlite/served}/hub/hub-shell.types.d.ts +0 -0
  291. /package/dist/store/{engine → sqlite/served}/hub/hub.worker.d.ts +0 -0
  292. /package/dist/store/{engine → sqlite/served}/hub/realm-host.d.ts +0 -0
  293. /package/dist/store/{engine → sqlite/served}/wire/error-envelope.d.ts +0 -0
  294. /package/dist/store/{engine → sqlite/served}/wire/wire-values.d.ts +0 -0
  295. /package/dist/store/{engine → sqlite/served}/wire/wire.constants.d.ts +0 -0
@@ -12,359 +12,364 @@ ruled out and why in your hand-over.
12
12
 
13
13
  <!-- dialecte-skills:generated intents -->
14
14
 
15
- | When you need to... | Use |
16
- | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
17
- | accumulate time spent in a hot per-node function | `doc.query.perf.time` |
18
- | add a child without duplicating it | `tx.ensureChild` |
19
- | add an attachment owned by a document | `project.addBlob` |
20
- | add custom extensions next to a dialecte's base extensions | `@dialecte/core/helpers.mergeExtensions` |
21
- | add error keys usable with invariant and throwDialecteError | `@dialecte/core.defineErrors` |
22
- | add or update or delete elements and commit them | `doc.transaction` |
23
- | announce how many steps a transaction or nested step has | `tx.progress.plan` |
24
- | applied or not applied | `@dialecte/core.importOutcomeOf` |
25
- | apply document updates in a custom store | `@dialecte/core.applyDocumentUpdates` |
26
- | ask a user to confirm an edit | `doc.prepare` |
27
- | assert a condition and throw a structured error | `@dialecte/core/utils.invariant` |
28
- | assert exported XML in tests | `@dialecte/core/test.createXmlAssertions` |
29
- | assert in a test that a document is structurally valid for its schema | `@dialecte/core/test.createXmlSchemaAssertions` |
30
- | assert on store read counts in a test | `doc.query.perf.report` |
31
- | assert that XML does not hold an element | `@dialecte/core/test.assertUnexpectedElementQueries` |
32
- | assert that XML holds the elements XPath queries select | `@dialecte/core/test.assertExpectedElementQueries` |
33
- | attach a blob to a record | `project.attachBlob` |
34
- | attach an extension map to a query or a transaction | `@dialecte/core.bindExtensions` |
35
- | attach meta to a diagnostic | `@dialecte/core.createDiagnostic` |
36
- | bind a child frame again after its page rejoined the hub | `@dialecte/core/sqlite.adoptHubPort` |
37
- | build a diagnostic from a dialecte's catalogue | `@dialecte/core.createDiagnostic` |
38
- | build a path from the root | `doc.query.findAncestors` |
39
- | build a tree record from a raw or tracked record | `@dialecte/core/helpers.toTreeRecord` |
40
- | build a valid element from its content model | `@dialecte/core/utils.requiredChoices` |
41
- | build new content in a transaction | `tx.addChild` |
42
- | build the Error throwDialecteError would throw | `@dialecte/core.createDialecteError` |
43
- | build typed test records for a dialecte | `@dialecte/core/test.createTestRecordFactory` |
44
- | call extension functions as methods of an instance | `@dialecte/core.bindExtensions` |
45
- | canonicalize attribute names before a write | `@dialecte/core/helpers.toFullAttributeArray` |
46
- | capture a CPU profile of an async operation in DevTools | `doc.query.perf.profile` |
47
- | cardinality of children | `@dialecte/core/utils.childOccurrences` |
48
- | change a document | `doc.transaction` |
49
- | change attribute values | `tx.update` |
50
- | check a built document against expected element counts | `@dialecte/core/helpers.evaluateExpectations` |
51
- | check a document exists | `project.getDocument` |
52
- | check a document path is valid and free before registering it | `@dialecte/core.assertDocumentPlace` |
53
- | check an element's tag with types | `@dialecte/core/helpers.isRecordOf` |
54
- | check exported XML against the XSD structure (namespaces, allowed children, known and required attributes) | `@dialecte/core/test.createXmlSchemaAssertions` |
55
- | check fixtures against the schema | `@dialecte/core/test.createTestHelpers` |
56
- | check that a document imported in another tab can be opened | `project.getDocumentStatus` |
57
- | check that a string is a tag name of the dialecte | `@dialecte/core/helpers.isElementOf` |
58
- | check that a string is an attribute of an element | `@dialecte/core/helpers.isAttributeOf` |
59
- | check that an element was removed from an export | `@dialecte/core/test.assertUnexpectedElementQueries` |
60
- | check that an export holds an element | `@dialecte/core/test.assertExpectedElementQueries` |
61
- | check the tag of a record's parent | `@dialecte/core/helpers.isParentOf` |
62
- | check whether a child exists | `doc.query.getChild` |
63
- | check whether a file or folder path is free | `@dialecte/core.pathHolderOf` |
64
- | check whether a project exists on SQLite storage without opening it | `@dialecte/core/sqlite.listProjects` |
65
- | check whether a wildcard admits a namespace | `@dialecte/core/utils.isNamespaceAllowedByWildcard` |
66
- | check whether an attribute is declared for an element | `@dialecte/core/utils.getAttributeRules` |
67
- | choose the store tests run on | `@dialecte/core/test.useTestStorage` |
68
- | clean up leftover imports when a custom store opens | `@dialecte/core.removeUnfinishedImports` |
69
- | clean up the imports a closed tab or a crash left behind | `@dialecte/core.removeUnfinishedImports` |
70
- | close a nested progress plan | `tx.progress.endPlan` |
71
- | close a project | `project.close` |
72
- | close the project's database connection from a document | `doc.close` |
73
- | collect descendants of given tag names under an element | `doc.query.findDescendants` |
74
- | collect perf from the store engine | `doc.query.perf.snapshot` |
75
- | collect results from every document | `project.queryAll` |
76
- | collect timing spans and read a report of them | `@dialecte/core.createPerf` |
77
- | combine extension modules into one registry | `@dialecte/core/helpers.mergeExtensions` |
78
- | combine timings measured in a worker with the page's | `doc.query.perf.merge` |
79
- | compare attributes ignoring schema defaults | `@dialecte/core/utils.isSchemaDefaultValue` |
80
- | compare XML holding generated ids | `@dialecte/core/test.normalizeUuids` |
81
- | compare xsi:type values written with different prefixes | `@dialecte/core/utils.canonicalXsiType` |
82
- | connect a page to the origin's hub | `@dialecte/core/sqlite.connectHub` |
83
- | copy a subtree with fresh ids | `tx.deepClone` |
84
- | count store reads or cache hits in dev | `doc.query.perf.count` |
85
- | count what a transaction will create | `@dialecte/core.summarizeOperations` |
86
- | create a new element under a parent | `tx.addChild` |
87
- | create a new empty document | `project.initEmptyDocument` |
88
- | debug what the store holds | `project.getDatabaseInstance` |
89
- | declare a dialecte package | `@dialecte/core.defineDialecte` |
90
- | declare a dialecte's own error catalogue | `@dialecte/core.defineErrors` |
91
- | delete a dialecte's project without opening it | `@dialecte/core.createProjectFactory` |
92
- | delete a document from the project | `project.removeDocument` |
93
- | delete a stored file | `project.removeBlob` |
94
- | delete a subtree | `tx.delete` |
95
- | delete a whole project | `project.destroy` |
96
- | delete the whole project database from a document | `doc.destroy` |
97
- | destructure several attributes at once | `doc.query.getAttributes` |
98
- | detach a blob from a record | `project.detachBlob` |
99
- | detect which config a file needs | `@dialecte/core.inspectXml` |
100
- | download a document | `project.export` |
101
- | download a stored file | `project.exportBlob` |
102
- | download an exported document | `@dialecte/core/utils.saveToDisk` |
103
- | drop attributes before cloning a record | `@dialecte/core/helpers.stripAttributes` |
104
- | dry-run a transaction | `doc.prepare` |
105
- | duplicate an element under another parent | `tx.deepClone` |
106
- | end a timed section opened with start | `doc.query.perf.stop` |
107
- | export a document from a store in batches | `@dialecte/core.runExport` |
108
- | export a document to an XML file | `project.export` |
109
- | expose a record factory in a dialecte's test entry | `@dialecte/core/test.createTestRecordFactory` |
110
- | fail with a core or dialecte error key | `@dialecte/core.throwDialecteError` |
111
- | fail with a dialecte error key | `@dialecte/core/utils.invariant` |
112
- | fill a dropdown with allowed values | `@dialecte/core/utils.enumeratedValues` |
113
- | fill an absent attribute with its schema default or fixed value | `@dialecte/core/utils.resolveSchemaAttributeValue` |
114
- | filter child refs by tag name | `@dialecte/core/helpers.isChildOf` |
115
- | filter one tag's elements by attribute | `doc.query.findByAttributes` |
116
- | find a declared namespace by its prefix | `@dialecte/core/utils.resolveNamespaceByPrefix` |
117
- | find a namespace by its config key | `@dialecte/core/utils.resolveNamespaceByScope` |
118
- | find elements by attribute value | `doc.query.findByAttributes` |
119
- | find nested elements at any depth below a scope | `doc.query.findDescendants` |
120
- | find orphan blobs to clean up | `project.getStandaloneBlobs` |
121
- | find outdated or lost projects on SQLite storage | `@dialecte/core/sqlite.listProjects` |
122
- | find the enclosing element of a tag | `doc.query.findAncestors` |
123
- | find the first match across every document | `project.queryFirst` |
124
- | find the prefix to store an attribute under | `@dialecte/core/utils.resolvePrefixByNamespaceScope` |
125
- | find which config a document uses | `doc.query.getDocumentInfo` |
126
- | find which document holds a path | `@dialecte/core.pathHolderOf` |
127
- | finish reporting progress for a step | `tx.progress.endPlan` |
128
- | fix an invariance type error on a record or ref | `@dialecte/core/helpers.widen` |
129
- | follow transaction progress | `doc.subscribe` |
130
- | format XML fixtures inside test files | `@dialecte/core/utils.formatEmbeddedXml` |
131
- | format XML for a snapshot or a fixture | `@dialecte/core/utils.formatXml` |
132
- | get a document as a Blob | `project.export` |
133
- | get a port to hand a child frame of another origin | `@dialecte/core/sqlite.connectHub` |
134
- | get deterministic uuids in a test | `@dialecte/core/test.createMockRandomUUID` |
135
- | get document metadata | `doc.query.getDocumentInfo` |
136
- | get documents to test against | `@dialecte/core/test.createTestProject` |
137
- | get every test helper of a dialecte | `@dialecte/core/test.createTestHelpers` |
138
- | get one direct child by tag name | `doc.query.getChild` |
139
- | get one result per file without a throw for a failed file | `project.import` |
140
- | get or create a child | `tx.ensureChild` |
141
- | get the dialecte config of a document | `project.getDocumentConfig` |
142
- | get the Document of an id | `project.openDocument` |
143
- | get the DOM of an exported XML file | `@dialecte/core.parseXmlDocument` |
144
- | get the factory that creates a dialecte's projects | `@dialecte/core.createProjectFactory` |
145
- | get the local name of a qualified name | `@dialecte/core/utils.extractLocalName` |
146
- | get the ref of a record or a relationship | `@dialecte/core/helpers.toRef` |
147
- | get the regular expressions an attribute value must match | `@dialecte/core/utils.valuePatterns` |
148
- | get the root element | `doc.query.getRoot` |
149
- | give a raw record a change status | `@dialecte/core/helpers.toTrackedRecord` |
150
- | group edits into one undo step | `doc.transaction` |
151
- | guard against a missing record | `@dialecte/core/utils.invariant` |
152
- | handle a dialecte error in a catch block | `@dialecte/core.toDialecteError` |
153
- | how many times a child may appear | `@dialecte/core/utils.childOccurrences` |
154
- | implement exportFile of a custom store | `@dialecte/core.runExport` |
155
- | implement importFile of a custom store | `@dialecte/core.runImport` |
156
- | import a file into a store with core's import pipeline | `@dialecte/core.runImport` |
157
- | import an XML file | `project.importFile` |
158
- | import several XML files at once | `project.import` |
159
- | indent XML without changing values | `@dialecte/core/utils.formatXml` |
160
- | insert a child with attributes | `tx.addChild` |
161
- | inspect the underlying database | `project.getDatabaseInstance` |
162
- | iterate one level below an element | `doc.query.getChildren` |
163
- | join the hub from an iframe of another origin | `@dialecte/core/sqlite.adoptHubPort` |
164
- | know what an element may hold under its parent | `@dialecte/core/utils.resolveDefinition` |
165
- | know what an xsi:type lets an element hold | `doc.query.getDefinition` |
166
- | know whether an attribute is required | `@dialecte/core/utils.getAttributeRules` |
167
- | know which schema a document uses | `project.getDocumentConfig` |
168
- | know which schema value an absent attribute takes | `@dialecte/core/utils.resolveSchemaAttributeValue` |
169
- | link a stored file to an element | `project.attachBlob` |
170
- | list allowed attributes or enumeration values | `doc.query.getDefinition` |
171
- | list direct children of one tag name | `doc.query.getChildren` |
172
- | list every element of a tag in the whole document | `doc.query.getRecordsByTagName` |
173
- | list the allowed values of an attribute | `@dialecte/core/utils.enumeratedValues` |
174
- | list the ancestors of an element | `doc.query.findAncestors` |
175
- | list the documents of a project | `project.getDocuments` |
176
- | list the files attached to a document | `project.getBlobsByDocument` |
177
- | list the files attached to one element | `project.getBlobsByRecord` |
178
- | list the projects stored in the browser on SQLite storage | `@dialecte/core/sqlite.listProjects` |
179
- | list the xsi:type values an element may take | `@dialecte/core/utils.admittedXsiTypes` |
180
- | list unattached files | `project.getStandaloneBlobs` |
181
- | listen to project events | `project.createChannel` |
182
- | load a blob by id | `project.getBlob` |
183
- | load a file into the project | `project.importFile` |
184
- | load one element by id | `doc.query.getRecord` |
185
- | load several elements by ref at once | `doc.query.getRecords` |
186
- | look up an attribute of a held record in a pure function with no query | `@dialecte/core/helpers.readAttribute` |
187
- | look up an attribute value on a record you already hold in an import hook | `@dialecte/core/helpers.readAttribute` |
188
- | look up an element by an identifying attribute | `doc.query.findByAttributes` |
189
- | look up the attribute values of a record you already hold in an import hook | `@dialecte/core/helpers.readAttributes` |
190
- | look up the attributes of a held record in a pure function with no query | `@dialecte/core/helpers.readAttributes` |
191
- | make generated ids reproducible | `@dialecte/core/utils.createSeededRandomUuid` |
192
- | make sure a singleton container exists before adding under it | `tx.ensureChild` |
193
- | make XPath assertions bound to a dialecte's namespaces | `@dialecte/core/test.createXmlAssertions` |
194
- | map a prefix to its namespace URI | `@dialecte/core/utils.resolveNamespaceByPrefix` |
195
- | map old ids to new ids | `tx.deepClone` |
196
- | mark a progress step done | `tx.progress.nextStep` |
197
- | measure how long an operation takes | `doc.query.perf.start` |
198
- | measure how long operations take in development | `@dialecte/core.createPerf` |
199
- | mock crypto.randomUUID | `@dialecte/core/test.createMockRandomUUID` |
200
- | name the store table holding a document's blob data | `@dialecte/core.blobTableName` |
201
- | name the store table holding a document's records | `@dialecte/core.recordTableName` |
202
- | narrow a child relationship to one tag | `@dialecte/core/helpers.isChildOf` |
203
- | narrow a diagnostic to a catalogue's codes | `@dialecte/core.isKnownDiagnostic` |
204
- | narrow a parent relationship to one tag | `@dialecte/core/helpers.isParentOf` |
205
- | narrow a record to a tree node | `@dialecte/core/helpers.isTreeRecord` |
206
- | narrow a record to its raw shape | `@dialecte/core/helpers.isRawRecord` |
207
- | narrow a record to its tracked shape | `@dialecte/core/helpers.isTrackedRecord` |
208
- | narrow a record to one tag name | `@dialecte/core/helpers.isRecordOf` |
209
- | narrow an attribute name before a typed read | `@dialecte/core/helpers.isAttributeOf` |
210
- | narrow an error key for a switch | `@dialecte/core.isKnownDialecteError` |
211
- | narrow an unknown tag name before a typed query | `@dialecte/core/helpers.isElementOf` |
212
- | narrow attribute input | `@dialecte/core/helpers.isFullAttributeArray` |
213
- | normalize attribute order after a hook | `@dialecte/core/utils.orderAttributesBySequence` |
214
- | offer a dialecte's engine to the hub (`factory.spawner`) | `@dialecte/core/sqlite.connectHub` |
215
- | offer type choices for an element | `@dialecte/core/utils.admittedXsiTypes` |
216
- | one report across realms | `doc.query.perf.merge` |
217
- | open a document to read or write it | `project.openDocument` |
218
- | open a project in a test with a fixture imported | `@dialecte/core/test.createTestProject` |
219
- | open a save dialog in the browser | `@dialecte/core/utils.saveToDisk` |
220
- | open or create a project database | `project.open` |
221
- | open projects of a dialecte from an app | `@dialecte/core.createProjectFactory` |
222
- | open projects on SQLite storage in a child frame through its page's engine | `@dialecte/core/sqlite.adoptHubPort` |
223
- | order nodes the way the export writes them | `@dialecte/core/utils.orderByConfigSequence` |
224
- | parse XML into records | `project.importFile` |
225
- | pass a per-element record or ref to an API typed with the element union | `@dialecte/core/helpers.widen` |
226
- | pass a raw or tree record where a tracked record is expected | `@dialecte/core/helpers.toTrackedRecord` |
227
- | pass a record where a raw record is expected | `@dialecte/core/helpers.toRawRecord` |
228
- | pass a ref to a query | `@dialecte/core/helpers.toRef` |
229
- | paste a tree read with getTree | `tx.deepClone` |
230
- | peek at an XML file before importing it | `@dialecte/core.inspectXml` |
231
- | pretty-print an XML string | `@dialecte/core/utils.formatXml` |
232
- | preview changes before committing | `doc.prepare` |
233
- | preview what a transaction would commit | `doc.query.getSnapshot` |
234
- | print perf metrics to the console | `doc.query.perf.log` |
235
- | project a filtered tree with select or omit | `doc.query.getTree` |
236
- | prune a child from its parent | `tx.delete` |
237
- | put attributes in schema order | `@dialecte/core/utils.orderAttributesBySequence` |
238
- | query an export with XPath | `@dialecte/core.parseXmlDocument` |
239
- | raise an error a consumer can read by key | `@dialecte/core.throwDialecteError` |
240
- | react to document changes in a UI | `doc.subscribe` |
241
- | read a blob with its file name | `project.exportBlob` |
242
- | read a document's name or config key by id | `project.getDocument` |
243
- | read a document's records from the local database directly | `@dialecte/core.recordTableName` |
244
- | read a namespaced attribute | `doc.query.getAttribute` |
245
- | read a subtree in document order | `doc.query.getTree` |
246
- | read a subtree to copy it with deepClone | `doc.query.getTree` |
247
- | read all attribute values of an element | `doc.query.getAttributes` |
248
- | read an attached file's content | `project.getBlob` |
249
- | read an attribute of an element | `doc.query.getAttribute` |
250
- | read an attribute with its schema default | `doc.query.getAttribute` |
251
- | read an attribute's default or fixed value | `@dialecte/core/utils.getAttributeRules` |
252
- | read an export as an XMLDocument in the page | `@dialecte/core.parseXmlDocument` |
253
- | read attributes of one namespace | `doc.query.getAttributes` |
254
- | read collected perf metrics | `doc.query.perf.report` |
255
- | read one attribute value | `doc.query.getAttribute` |
256
- | read staged changes as XML or as a tree | `doc.query.getSnapshot` |
257
- | read the attributes of an element | `doc.query.getAttributes` |
258
- | read the definition of a record you hold without a query | `@dialecte/core/utils.resolveDefinition` |
259
- | read the document name or extension | `doc.query.getDocumentInfo` |
260
- | read the enumeration of a datatype | `@dialecte/core/utils.enumeratedValues` |
261
- | read the exported XML as a DOM | `project.export` |
262
- | read the root element or a version attribute without a full parse | `@dialecte/core.inspectXml` |
263
- | read the schema definition of an element | `doc.query.getDefinition` |
264
- | read the structured error from a caught value | `@dialecte/core.toDialecteError` |
265
- | read the type an element names with xsi:type | `@dialecte/core/utils.resolveXsiType` |
266
- | receive commits and imports made in other tabs | `project.createChannel` |
267
- | recover after a connection lost during a write | `@dialecte/core.writeOutcomeOf` |
268
- | recover after a connection lost during an import | `@dialecte/core.importOutcomeOf` |
269
- | redo an undone change to a document | `project.redo` |
270
- | refresh a record | `doc.query.getRecord` |
271
- | refresh a view after a commit or an undo | `doc.subscribe` |
272
- | register a dialecte's configs and extensions and hooks once | `@dialecte/core.defineDialecte` |
273
- | register a dialecte's engine with the hub | `@dialecte/core.createProjectFactory` |
274
- | register documents in a custom store | `@dialecte/core.assertDocumentPlace` |
275
- | register this page's dialecte engines with the hub before any project opens | `@dialecte/core/sqlite.connectHub` |
276
- | reindent xml template literals in source code | `@dialecte/core/utils.formatEmbeddedXml` |
277
- | release the database connection when leaving a page | `project.close` |
278
- | remove a blob for good | `project.removeBlob` |
279
- | remove an element | `tx.delete` |
280
- | remove attributes from a record | `@dialecte/core/helpers.stripAttributes` |
281
- | remove one file and its records | `project.removeDocument` |
282
- | rename an element through its name attribute | `tx.update` |
283
- | rename or move a document by its path | `@dialecte/core.applyDocumentUpdates` |
284
- | reopen a project after close | `project.open` |
285
- | report a caught error as a dialecte error without throwing | `@dialecte/core.createDialecteError` |
286
- | report an import or validation problem as a typed diagnostic | `@dialecte/core.createDiagnostic` |
287
- | report progress of a long operation | `tx.progress.plan` |
288
- | required or optional children of an element | `@dialecte/core/utils.childOccurrences` |
289
- | reset perf metrics between measured scenarios | `doc.query.perf.reset` |
290
- | resolve a list of children or relationships in one batched read | `doc.query.getRecords` |
291
- | resolve a namespace scope to its prefix and URI | `@dialecte/core/utils.resolveNamespaceByScope` |
292
- | resolve a ref or parent/child relationship to its record | `doc.query.getRecord` |
293
- | resolve an xsi:type prefix to its namespace | `@dialecte/core/utils.resolveXsiType` |
294
- | roll back a commit | `project.undo` |
295
- | run node tests on the in-memory store | `@dialecte/core/test.useTestStorage` |
296
- | run one query over all documents | `project.queryAll` |
297
- | run table-driven test cases on a dialecte | `@dialecte/core/test.createTestRunner` |
298
- | run tests on SQLite | `@dialecte/core/test.useTestStorage` |
299
- | save a Blob as a file | `@dialecte/core/utils.saveToDisk` |
300
- | save a blob to disk | `project.exportBlob` |
301
- | save a document as XML | `project.export` |
302
- | scan all elements of one type regardless of position | `doc.query.getRecordsByTagName` |
303
- | search all documents of a project | `project.queryFirst` |
304
- | seed crypto.randomUUID for a script or a test | `@dialecte/core/utils.createSeededRandomUuid` |
305
- | send a worker's or another realm's timings to the page | `doc.query.perf.snapshot` |
306
- | serve a dialecte's engine from a worker | `@dialecte/core/engine.serveDialecteEngine` |
307
- | set an element's text value | `tx.update` |
308
- | set or clear an attribute | `tx.update` |
309
- | set up a dialecte package's tests | `@dialecte/core/test.createTestHelpers` |
310
- | set up a new dialecte | `@dialecte/core.defineDialecte` |
311
- | share one SQLite engine per project between the tabs of an app | `@dialecte/core.createProjectFactory` |
312
- | ship a dialecte's SQLite engine in its package | `@dialecte/core/engine.serveDialecteEngine` |
313
- | show a confirmation summary before commit | `@dialecte/core.summarizeOperations` |
314
- | show a progress bar caption | `tx.progress.plan` |
315
- | show how much space each project takes | `@dialecte/core/sqlite.listProjects` |
316
- | show the files a project holds | `project.getDocuments` |
317
- | show what a prepared transaction would produce | `doc.query.getSnapshot` |
318
- | snapshot a document independently of random uuids | `@dialecte/core/test.normalizeUuids` |
319
- | sort children in schema order | `@dialecte/core/utils.orderByConfigSequence` |
320
- | split a document path into folders and file name | `@dialecte/core.parseDocumentPath` |
321
- | start a document from scratch without a file | `project.initEmptyDocument` |
322
- | start a walk from the top of the document | `doc.query.getRoot` |
323
- | start working on a project | `project.open` |
324
- | store a binary file in the project | `project.addBlob` |
325
- | store blobs in a custom store | `@dialecte/core.blobTableName` |
326
- | strip a record to its stored fields | `@dialecte/core/helpers.toRawRecord` |
327
- | strip the prefix from an attribute name | `@dialecte/core/utils.extractLocalName` |
328
- | summarize a prepared transaction per tag | `@dialecte/core.summarizeOperations` |
329
- | tally calls of a hot function cheaply | `doc.query.perf.count` |
330
- | tell a stored record from a tracked or tree record | `@dialecte/core/helpers.isRawRecord` |
331
- | tell a tracked record from a raw or tree record | `@dialecte/core/helpers.isTrackedRecord` |
332
- | tell a tree record from a raw or tracked record | `@dialecte/core/helpers.isTreeRecord` |
333
- | tell an attribute array from an attribute value object | `@dialecte/core/helpers.isFullAttributeArray` |
334
- | tell whether a value equals an attribute's default | `@dialecte/core/utils.isSchemaDefaultValue` |
335
- | tell whether an import is running | `@dialecte/core.importOutcomeOf` |
336
- | tell whether an import or a commit was applied | `@dialecte/core.writeOutcomeOf` |
337
- | tell whether foreign attributes or elements are allowed | `@dialecte/core/utils.isNamespaceAllowedByWildcard` |
338
- | tell which diagnostic an import reported | `@dialecte/core.isKnownDiagnostic` |
339
- | tell which error was thrown | `@dialecte/core.isKnownDialecteError` |
340
- | test a transaction against expected XML | `@dialecte/core/test.createTestRunner` |
341
- | test what a prepared transaction would write | `@dialecte/core/helpers.evaluateExpectations` |
342
- | the branches of a required choice | `@dialecte/core/utils.requiredChoices` |
343
- | throw a structured error | `@dialecte/core.throwDialecteError` |
344
- | time a callback without flooding the timeline | `doc.query.perf.time` |
345
- | time a code section in dev | `doc.query.perf.start` |
346
- | turn a record into a tree node | `@dialecte/core/helpers.toTreeRecord` |
347
- | turn an attribute value object into an attribute array | `@dialecte/core/helpers.toFullAttributeArray` |
348
- | undo the last change to a document | `project.undo` |
349
- | unlink a file from an element | `project.detachBlob` |
350
- | update and delete | `@dialecte/core.summarizeOperations` |
351
- | update the progress caption | `tx.progress.nextStep` |
352
- | use SQLite storage in an app (import `@dialecte/core/sqlite` once and open with `storage: { type: 'sqlite' }`) | `@dialecte/core.createProjectFactory` |
353
- | validate a document path | `@dialecte/core.parseDocumentPath` |
354
- | validate an attribute value against its datatype patterns | `@dialecte/core/utils.valuePatterns` |
355
- | validate an exported XML file against the schema in a test | `@dialecte/core/test.createXmlSchemaAssertions` |
356
- | verify a script's result before committing | `@dialecte/core/helpers.evaluateExpectations` |
357
- | wait for a document from another realm | `project.getDocumentStatus` |
358
- | walk children recursively | `doc.query.getTree` |
359
- | walk definitions top-down | `@dialecte/core/utils.resolveDefinition` |
360
- | which children an element must hold where its content model offers a choice | `@dialecte/core/utils.requiredChoices` |
361
- | wipe every document of the project | `doc.destroy` |
362
- | wipe the project database with every document | `project.destroy` |
363
- | word a diagnostic for a user | `@dialecte/core.isKnownDiagnostic` |
364
- | word an error for a user | `@dialecte/core.isKnownDialecteError` |
365
- | write a dialecte package's engine worker file | `@dialecte/core/engine.serveDialecteEngine` |
366
- | write an attribute in a declared or custom namespace | `@dialecte/core/utils.resolvePrefixByNamespaceScope` |
367
- | write an xsi:type value the way core stores it | `@dialecte/core/utils.canonicalXsiType` |
15
+ | When you need to... | Use |
16
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
17
+ | accumulate time spent in a hot per-node function | `doc.query.perf.time` |
18
+ | add a child without duplicating it | `tx.ensureChild` |
19
+ | add a storage kind to core | `@dialecte/core.registerStorageKind` |
20
+ | add an attachment owned by a document | `project.addBlob` |
21
+ | add custom extensions next to a dialecte's base extensions | `@dialecte/core/helpers.mergeExtensions` |
22
+ | add error keys usable with invariant and throwDialecteError | `@dialecte/core.defineErrors` |
23
+ | add or update or delete elements and commit them | `doc.transaction` |
24
+ | announce how many steps a transaction or nested step has | `tx.progress.plan` |
25
+ | applied or not applied | `@dialecte/core.importOutcomeOf` |
26
+ | apply document updates in a custom store | `@dialecte/core.applyDocumentUpdates` |
27
+ | ask a user to confirm an edit | `doc.prepare` |
28
+ | assert a condition and throw a structured error | `@dialecte/core/utils.invariant` |
29
+ | assert exported XML in tests | `@dialecte/core/test.createXmlAssertions` |
30
+ | assert in a test that a document is structurally valid for its schema | `@dialecte/core/test.createXmlSchemaAssertions` |
31
+ | assert on store read counts in a test | `doc.query.perf.report` |
32
+ | assert that XML does not hold an element | `@dialecte/core/test.assertUnexpectedElementQueries` |
33
+ | assert that XML holds the elements XPath queries select | `@dialecte/core/test.assertExpectedElementQueries` |
34
+ | attach a blob to a record | `project.attachBlob` |
35
+ | attach an extension map to a query or a transaction | `@dialecte/core.bindExtensions` |
36
+ | attach meta to a diagnostic | `@dialecte/core.createDiagnostic` |
37
+ | bind a child frame again after its page rejoined the hub | `@dialecte/core/sqlite.adoptHubPort` |
38
+ | build a diagnostic from a dialecte's catalogue | `@dialecte/core.createDiagnostic` |
39
+ | build a path from the root | `doc.query.findAncestors` |
40
+ | build a tree record from a raw or tracked record | `@dialecte/core/helpers.toTreeRecord` |
41
+ | build a valid element from its content model | `@dialecte/core/utils.requiredChoices` |
42
+ | build new content in a transaction | `tx.addChild` |
43
+ | build the Error throwDialecteError would throw | `@dialecte/core.createDialecteError` |
44
+ | build typed test records for a dialecte | `@dialecte/core/test.createTestRecordFactory` |
45
+ | call extension functions as methods of an instance | `@dialecte/core.bindExtensions` |
46
+ | canonicalize attribute names before a write | `@dialecte/core/helpers.toFullAttributeArray` |
47
+ | capture a CPU profile of an async operation in DevTools | `doc.query.perf.profile` |
48
+ | cardinality of children | `@dialecte/core/utils.childOccurrences` |
49
+ | change a document | `doc.transaction` |
50
+ | change attribute values | `tx.update` |
51
+ | check a built document against expected element counts | `@dialecte/core/helpers.evaluateExpectations` |
52
+ | check a document exists | `project.getDocument` |
53
+ | check a document path is valid and free before registering it | `@dialecte/core.assertDocumentPlace` |
54
+ | check an element's tag with types | `@dialecte/core/helpers.isRecordOf` |
55
+ | check exported XML against the XSD structure (namespaces, allowed children, known and required attributes) | `@dialecte/core/test.createXmlSchemaAssertions` |
56
+ | check fixtures against the schema | `@dialecte/core/test.createTestHelpers` |
57
+ | check that a document imported in another tab can be opened | `project.getDocumentStatus` |
58
+ | check that a string is a tag name of the dialecte | `@dialecte/core/helpers.isElementOf` |
59
+ | check that a string is an attribute of an element | `@dialecte/core/helpers.isAttributeOf` |
60
+ | check that an element was removed from an export | `@dialecte/core/test.assertUnexpectedElementQueries` |
61
+ | check that an export holds an element | `@dialecte/core/test.assertExpectedElementQueries` |
62
+ | check the tag of a record's parent | `@dialecte/core/helpers.isParentOf` |
63
+ | check whether a child exists | `doc.query.getChild` |
64
+ | check whether a file or folder path is free | `@dialecte/core.pathHolderOf` |
65
+ | check whether a project exists on SQLite storage without opening it | `@dialecte/core/sqlite.listProjects` |
66
+ | check whether a wildcard admits a namespace | `@dialecte/core/utils.isNamespaceAllowedByWildcard` |
67
+ | check whether an attribute is declared for an element | `@dialecte/core/utils.getAttributeRules` |
68
+ | choose the store tests run on | `@dialecte/core/test.useTestStorage` |
69
+ | clean up leftover imports when a custom store opens | `@dialecte/core.removeUnfinishedImports` |
70
+ | clean up the imports a closed tab or a crash left behind | `@dialecte/core.removeUnfinishedImports` |
71
+ | close a nested progress plan | `tx.progress.endPlan` |
72
+ | close a project | `project.close` |
73
+ | close the project's database connection from a document | `doc.close` |
74
+ | collect descendants of given tag names under an element | `doc.query.findDescendants` |
75
+ | collect perf from the store engine | `doc.query.perf.snapshot` |
76
+ | collect results from every document | `project.queryAll` |
77
+ | collect timing spans and read a report of them | `@dialecte/core.createPerf` |
78
+ | combine extension modules into one registry | `@dialecte/core/helpers.mergeExtensions` |
79
+ | combine timings measured in a worker with the page's | `doc.query.perf.merge` |
80
+ | compare attributes ignoring schema defaults | `@dialecte/core/utils.isSchemaDefaultValue` |
81
+ | compare XML holding generated ids | `@dialecte/core/test.normalizeUuids` |
82
+ | compare xsi:type values written with different prefixes | `@dialecte/core/utils.canonicalXsiType` |
83
+ | connect a page to the origin's hub before any project opens | `@dialecte/core/sqlite.connectHub` |
84
+ | copy a subtree with fresh ids | `tx.deepClone` |
85
+ | count store reads or cache hits in dev | `doc.query.perf.count` |
86
+ | count what a transaction will create | `@dialecte/core.summarizeOperations` |
87
+ | create a new element under a parent | `tx.addChild` |
88
+ | create a new empty document | `project.initEmptyDocument` |
89
+ | debug what the store holds | `project.getDatabaseInstance` |
90
+ | declare a dialecte package | `@dialecte/core.defineDialecte` |
91
+ | declare a dialecte's own error catalogue | `@dialecte/core.defineErrors` |
92
+ | delete a dialecte's project without opening it | `@dialecte/core.createProjectFactory` |
93
+ | delete a document from the project | `project.removeDocument` |
94
+ | delete a stored file | `project.removeBlob` |
95
+ | delete a subtree | `tx.delete` |
96
+ | delete a whole project | `project.destroy` |
97
+ | delete the whole project database from a document | `doc.destroy` |
98
+ | destructure several attributes at once | `doc.query.getAttributes` |
99
+ | detach a blob from a record | `project.detachBlob` |
100
+ | detect which config a file needs | `@dialecte/core.inspectXml` |
101
+ | download a document | `project.export` |
102
+ | download a stored file | `project.exportBlob` |
103
+ | download an exported document | `@dialecte/core/utils.saveToDisk` |
104
+ | drop attributes before cloning a record | `@dialecte/core/helpers.stripAttributes` |
105
+ | dry-run a transaction | `doc.prepare` |
106
+ | duplicate an element under another parent | `tx.deepClone` |
107
+ | end a timed section opened with start | `doc.query.perf.stop` |
108
+ | export a document from a store in batches | `@dialecte/core.runExport` |
109
+ | export a document to an XML file | `project.export` |
110
+ | expose a record factory in a dialecte's test entry | `@dialecte/core/test.createTestRecordFactory` |
111
+ | fail with a core or dialecte error key | `@dialecte/core.throwDialecteError` |
112
+ | fail with a dialecte error key | `@dialecte/core/utils.invariant` |
113
+ | fill a dropdown with allowed values | `@dialecte/core/utils.enumeratedValues` |
114
+ | fill an absent attribute with its schema default or fixed value | `@dialecte/core/utils.resolveSchemaAttributeValue` |
115
+ | filter child refs by tag name | `@dialecte/core/helpers.isChildOf` |
116
+ | filter one tag's elements by attribute | `doc.query.findByAttributes` |
117
+ | find a declared namespace by its prefix | `@dialecte/core/utils.resolveNamespaceByPrefix` |
118
+ | find a namespace by its config key | `@dialecte/core/utils.resolveNamespaceByScope` |
119
+ | find elements by attribute value | `doc.query.findByAttributes` |
120
+ | find nested elements at any depth below a scope | `doc.query.findDescendants` |
121
+ | find orphan blobs to clean up | `project.getStandaloneBlobs` |
122
+ | find outdated or lost projects on SQLite storage | `@dialecte/core/sqlite.listProjects` |
123
+ | find the enclosing element of a tag | `doc.query.findAncestors` |
124
+ | find the first match across every document | `project.queryFirst` |
125
+ | find the prefix to store an attribute under | `@dialecte/core/utils.resolvePrefixByNamespaceScope` |
126
+ | find which config a document uses | `doc.query.getDocumentInfo` |
127
+ | find which document holds a path | `@dialecte/core.pathHolderOf` |
128
+ | finish reporting progress for a step | `tx.progress.endPlan` |
129
+ | fix an invariance type error on a record or ref | `@dialecte/core/helpers.widen` |
130
+ | follow transaction progress | `doc.subscribe` |
131
+ | format XML fixtures inside test files | `@dialecte/core/utils.formatEmbeddedXml` |
132
+ | format XML for a snapshot or a fixture | `@dialecte/core/utils.formatXml` |
133
+ | get a document as a Blob | `project.export` |
134
+ | get a port to hand a child frame of another origin | `@dialecte/core/sqlite.connectHub` |
135
+ | get deterministic uuids in a test | `@dialecte/core/test.createMockRandomUUID` |
136
+ | get document metadata | `doc.query.getDocumentInfo` |
137
+ | get documents to test against | `@dialecte/core/test.createTestProject` |
138
+ | get every test helper of a dialecte | `@dialecte/core/test.createTestHelpers` |
139
+ | get one direct child by tag name | `doc.query.getChild` |
140
+ | get one result per file without a throw for a failed file | `project.import` |
141
+ | get or create a child | `tx.ensureChild` |
142
+ | get the dialecte config of a document | `project.getDocumentConfig` |
143
+ | get the Document of an id | `project.openDocument` |
144
+ | get the DOM of an exported XML file | `@dialecte/core.parseXmlDocument` |
145
+ | get the factory that creates a dialecte's projects | `@dialecte/core.createProjectFactory` |
146
+ | get the local name of a qualified name | `@dialecte/core/utils.extractLocalName` |
147
+ | get the ref of a record or a relationship | `@dialecte/core/helpers.toRef` |
148
+ | get the regular expressions an attribute value must match | `@dialecte/core/utils.valuePatterns` |
149
+ | get the root element | `doc.query.getRoot` |
150
+ | give a raw record a change status | `@dialecte/core/helpers.toTrackedRecord` |
151
+ | group edits into one undo step | `doc.transaction` |
152
+ | guard against a missing record | `@dialecte/core/utils.invariant` |
153
+ | handle a dialecte error in a catch block | `@dialecte/core.toDialecteError` |
154
+ | how many times a child may appear | `@dialecte/core/utils.childOccurrences` |
155
+ | implement exportFile of a custom store | `@dialecte/core.runExport` |
156
+ | implement importFile of a custom store | `@dialecte/core.runImport` |
157
+ | import a file into a store with core's import pipeline | `@dialecte/core.runImport` |
158
+ | import an XML file | `project.importFile` |
159
+ | import several XML files at once | `project.import` |
160
+ | indent XML without changing values | `@dialecte/core/utils.formatXml` |
161
+ | insert a child with attributes | `tx.addChild` |
162
+ | inspect the underlying database | `project.getDatabaseInstance` |
163
+ | iterate one level below an element | `doc.query.getChildren` |
164
+ | join the hub from an iframe of another origin | `@dialecte/core/sqlite.adoptHubPort` |
165
+ | keep sqlite-wasm out of the page's bundle | `@dialecte/core/sqlite.serveSqliteEngine` |
166
+ | know what an element may hold under its parent | `@dialecte/core/utils.resolveDefinition` |
167
+ | know what an xsi:type lets an element hold | `doc.query.getDefinition` |
168
+ | know whether an attribute is required | `@dialecte/core/utils.getAttributeRules` |
169
+ | know which schema a document uses | `project.getDocumentConfig` |
170
+ | know which schema value an absent attribute takes | `@dialecte/core/utils.resolveSchemaAttributeValue` |
171
+ | link a stored file to an element | `project.attachBlob` |
172
+ | list allowed attributes or enumeration values | `doc.query.getDefinition` |
173
+ | list direct children of one tag name | `doc.query.getChildren` |
174
+ | list every element of a tag in the whole document | `doc.query.getRecordsByTagName` |
175
+ | list the allowed values of an attribute | `@dialecte/core/utils.enumeratedValues` |
176
+ | list the ancestors of an element | `doc.query.findAncestors` |
177
+ | list the documents of a project | `project.getDocuments` |
178
+ | list the files attached to a document | `project.getBlobsByDocument` |
179
+ | list the files attached to one element | `project.getBlobsByRecord` |
180
+ | list the projects stored in the browser on SQLite storage | `@dialecte/core/sqlite.listProjects` |
181
+ | list the xsi:type values an element may take | `@dialecte/core/utils.admittedXsiTypes` |
182
+ | list unattached files | `project.getStandaloneBlobs` |
183
+ | listen to project events | `project.createChannel` |
184
+ | load a blob by id | `project.getBlob` |
185
+ | load a file into the project | `project.importFile` |
186
+ | load one element by id | `doc.query.getRecord` |
187
+ | load several elements by ref at once | `doc.query.getRecords` |
188
+ | look up an attribute of a held record in a pure function with no query | `@dialecte/core/helpers.readAttribute` |
189
+ | look up an attribute value on a record you already hold in an import hook | `@dialecte/core/helpers.readAttribute` |
190
+ | look up an element by an identifying attribute | `doc.query.findByAttributes` |
191
+ | look up the attribute values of a record you already hold in an import hook | `@dialecte/core/helpers.readAttributes` |
192
+ | look up the attributes of a held record in a pure function with no query | `@dialecte/core/helpers.readAttributes` |
193
+ | make generated ids reproducible | `@dialecte/core/utils.createSeededRandomUuid` |
194
+ | make sure a singleton container exists before adding under it | `tx.ensureChild` |
195
+ | make XPath assertions bound to a dialecte's namespaces | `@dialecte/core/test.createXmlAssertions` |
196
+ | map a prefix to its namespace URI | `@dialecte/core/utils.resolveNamespaceByPrefix` |
197
+ | map old ids to new ids | `tx.deepClone` |
198
+ | mark a progress step done | `tx.progress.nextStep` |
199
+ | measure how long an operation takes | `doc.query.perf.start` |
200
+ | measure how long operations take in development | `@dialecte/core.createPerf` |
201
+ | mock crypto.randomUUID | `@dialecte/core/test.createMockRandomUUID` |
202
+ | name the store table holding a document's blob data | `@dialecte/core.blobTableName` |
203
+ | name the store table holding a document's records | `@dialecte/core.recordTableName` |
204
+ | narrow a child relationship to one tag | `@dialecte/core/helpers.isChildOf` |
205
+ | narrow a diagnostic to a catalogue's codes | `@dialecte/core.isKnownDiagnostic` |
206
+ | narrow a parent relationship to one tag | `@dialecte/core/helpers.isParentOf` |
207
+ | narrow a record to a tree node | `@dialecte/core/helpers.isTreeRecord` |
208
+ | narrow a record to its raw shape | `@dialecte/core/helpers.isRawRecord` |
209
+ | narrow a record to its tracked shape | `@dialecte/core/helpers.isTrackedRecord` |
210
+ | narrow a record to one tag name | `@dialecte/core/helpers.isRecordOf` |
211
+ | narrow an attribute name before a typed read | `@dialecte/core/helpers.isAttributeOf` |
212
+ | narrow an error key for a switch | `@dialecte/core.isKnownDialecteError` |
213
+ | narrow an unknown tag name before a typed query | `@dialecte/core/helpers.isElementOf` |
214
+ | narrow attribute input | `@dialecte/core/helpers.isFullAttributeArray` |
215
+ | normalize attribute order after a hook | `@dialecte/core/utils.orderAttributesBySequence` |
216
+ | offer the engines an app registered to the hub | `@dialecte/core/sqlite.connectHub` |
217
+ | offer type choices for an element | `@dialecte/core/utils.admittedXsiTypes` |
218
+ | one report across realms | `doc.query.perf.merge` |
219
+ | open a document to read or write it | `project.openDocument` |
220
+ | open a project in a test with a fixture imported | `@dialecte/core/test.createTestProject` |
221
+ | open a save dialog in the browser | `@dialecte/core/utils.saveToDisk` |
222
+ | open or create a project database | `project.open` |
223
+ | open projects of a dialecte from an app | `@dialecte/core.createProjectFactory` |
224
+ | open projects of several dialectes on one SQLite engine worker | `@dialecte/core/sqlite.registerSqliteEngine` |
225
+ | open projects on SQLite storage in a child frame through its page's engine | `@dialecte/core/sqlite.adoptHubPort` |
226
+ | order nodes the way the export writes them | `@dialecte/core/utils.orderByConfigSequence` |
227
+ | parse XML into records | `project.importFile` |
228
+ | pass a per-element record or ref to an API typed with the element union | `@dialecte/core/helpers.widen` |
229
+ | pass a raw or tree record where a tracked record is expected | `@dialecte/core/helpers.toTrackedRecord` |
230
+ | pass a record where a raw record is expected | `@dialecte/core/helpers.toRawRecord` |
231
+ | pass a ref to a query | `@dialecte/core/helpers.toRef` |
232
+ | paste a tree read with getTree | `tx.deepClone` |
233
+ | peek at an XML file before importing it | `@dialecte/core.inspectXml` |
234
+ | pretty-print an XML string | `@dialecte/core/utils.formatXml` |
235
+ | preview changes before committing | `doc.prepare` |
236
+ | preview what a transaction would commit | `doc.query.getSnapshot` |
237
+ | print perf metrics to the console | `doc.query.perf.log` |
238
+ | project a filtered tree with select or omit | `doc.query.getTree` |
239
+ | prune a child from its parent | `tx.delete` |
240
+ | put attributes in schema order | `@dialecte/core/utils.orderAttributesBySequence` |
241
+ | query an export with XPath | `@dialecte/core.parseXmlDocument` |
242
+ | raise an error a consumer can read by key | `@dialecte/core.throwDialecteError` |
243
+ | react to document changes in a UI | `doc.subscribe` |
244
+ | read a blob with its file name | `project.exportBlob` |
245
+ | read a document's name or config key by id | `project.getDocument` |
246
+ | read a document's records from the local database directly | `@dialecte/core.recordTableName` |
247
+ | read a namespaced attribute | `doc.query.getAttribute` |
248
+ | read a subtree in document order | `doc.query.getTree` |
249
+ | read a subtree to copy it with deepClone | `doc.query.getTree` |
250
+ | read all attribute values of an element | `doc.query.getAttributes` |
251
+ | read an attached file's content | `project.getBlob` |
252
+ | read an attribute of an element | `doc.query.getAttribute` |
253
+ | read an attribute with its schema default | `doc.query.getAttribute` |
254
+ | read an attribute's default or fixed value | `@dialecte/core/utils.getAttributeRules` |
255
+ | read an export as an XMLDocument in the page | `@dialecte/core.parseXmlDocument` |
256
+ | read attributes of one namespace | `doc.query.getAttributes` |
257
+ | read collected perf metrics | `doc.query.perf.report` |
258
+ | read one attribute value | `doc.query.getAttribute` |
259
+ | read staged changes as XML or as a tree | `doc.query.getSnapshot` |
260
+ | read the attributes of an element | `doc.query.getAttributes` |
261
+ | read the definition of a record you hold without a query | `@dialecte/core/utils.resolveDefinition` |
262
+ | read the document name or extension | `doc.query.getDocumentInfo` |
263
+ | read the enumeration of a datatype | `@dialecte/core/utils.enumeratedValues` |
264
+ | read the exported XML as a DOM | `project.export` |
265
+ | read the root element or a version attribute without a full parse | `@dialecte/core.inspectXml` |
266
+ | read the schema definition of an element | `doc.query.getDefinition` |
267
+ | read the structured error from a caught value | `@dialecte/core.toDialecteError` |
268
+ | read the type an element names with xsi:type | `@dialecte/core/utils.resolveXsiType` |
269
+ | receive commits and imports made in other tabs | `project.createChannel` |
270
+ | recover after a connection lost during a write | `@dialecte/core.writeOutcomeOf` |
271
+ | recover after a connection lost during an import | `@dialecte/core.importOutcomeOf` |
272
+ | redo an undone change to a document | `project.redo` |
273
+ | refresh a record | `doc.query.getRecord` |
274
+ | refresh a view after a commit or an undo | `doc.subscribe` |
275
+ | register a dialecte's configs and extensions and hooks once | `@dialecte/core.defineDialecte` |
276
+ | register a store a project opens on by its storage type | `@dialecte/core.registerStorageKind` |
277
+ | register documents in a custom store | `@dialecte/core.assertDocumentPlace` |
278
+ | register the dialectes an app's engine worker serves | `@dialecte/core/sqlite.registerSqliteEngine` |
279
+ | reindent xml template literals in source code | `@dialecte/core/utils.formatEmbeddedXml` |
280
+ | release the database connection when leaving a page | `project.close` |
281
+ | remove a blob for good | `project.removeBlob` |
282
+ | remove an element | `tx.delete` |
283
+ | remove attributes from a record | `@dialecte/core/helpers.stripAttributes` |
284
+ | remove one file and its records | `project.removeDocument` |
285
+ | rename an element through its name attribute | `tx.update` |
286
+ | rename or move a document by its path | `@dialecte/core.applyDocumentUpdates` |
287
+ | reopen a project after close | `project.open` |
288
+ | report a caught error as a dialecte error without throwing | `@dialecte/core.createDialecteError` |
289
+ | report an import or validation problem as a typed diagnostic | `@dialecte/core.createDiagnostic` |
290
+ | report progress of a long operation | `tx.progress.plan` |
291
+ | required or optional children of an element | `@dialecte/core/utils.childOccurrences` |
292
+ | reset perf metrics between measured scenarios | `doc.query.perf.reset` |
293
+ | resolve a list of children or relationships in one batched read | `doc.query.getRecords` |
294
+ | resolve a namespace scope to its prefix and URI | `@dialecte/core/utils.resolveNamespaceByScope` |
295
+ | resolve a ref or parent/child relationship to its record | `doc.query.getRecord` |
296
+ | resolve an xsi:type prefix to its namespace | `@dialecte/core/utils.resolveXsiType` |
297
+ | roll back a commit | `project.undo` |
298
+ | run node tests on the in-memory store | `@dialecte/core/test.useTestStorage` |
299
+ | run one query over all documents | `project.queryAll` |
300
+ | run table-driven test cases on a dialecte | `@dialecte/core/test.createTestRunner` |
301
+ | run tests on SQLite | `@dialecte/core/test.useTestStorage` |
302
+ | save a Blob as a file | `@dialecte/core/utils.saveToDisk` |
303
+ | save a blob to disk | `project.exportBlob` |
304
+ | save a document as XML | `project.export` |
305
+ | scan all elements of one type regardless of position | `doc.query.getRecordsByTagName` |
306
+ | search all documents of a project | `project.queryFirst` |
307
+ | seed crypto.randomUUID for a script or a test | `@dialecte/core/utils.createSeededRandomUuid` |
308
+ | send a worker's or another realm's timings to the page | `doc.query.perf.snapshot` |
309
+ | serve the engines of an app's dialectes from one worker | `@dialecte/core/sqlite.serveSqliteEngine` |
310
+ | set an element's text value | `tx.update` |
311
+ | set or clear an attribute | `tx.update` |
312
+ | set up a dialecte package's tests | `@dialecte/core/test.createTestHelpers` |
313
+ | set up a new dialecte | `@dialecte/core.defineDialecte` |
314
+ | share one SQLite engine per project between the tabs of an app | `@dialecte/core.createProjectFactory` |
315
+ | show a confirmation summary before commit | `@dialecte/core.summarizeOperations` |
316
+ | show a progress bar caption | `tx.progress.plan` |
317
+ | show how much space each project takes | `@dialecte/core/sqlite.listProjects` |
318
+ | show the files a project holds | `project.getDocuments` |
319
+ | show what a prepared transaction would produce | `doc.query.getSnapshot` |
320
+ | snapshot a document independently of random uuids | `@dialecte/core/test.normalizeUuids` |
321
+ | sort children in schema order | `@dialecte/core/utils.orderByConfigSequence` |
322
+ | split a document path into folders and file name | `@dialecte/core.parseDocumentPath` |
323
+ | start a document from scratch without a file | `project.initEmptyDocument` |
324
+ | start a walk from the top of the document | `doc.query.getRoot` |
325
+ | start working on a project | `project.open` |
326
+ | store a binary file in the project | `project.addBlob` |
327
+ | store blobs in a custom store | `@dialecte/core.blobTableName` |
328
+ | strip a record to its stored fields | `@dialecte/core/helpers.toRawRecord` |
329
+ | strip the prefix from an attribute name | `@dialecte/core/utils.extractLocalName` |
330
+ | summarize a prepared transaction per tag | `@dialecte/core.summarizeOperations` |
331
+ | tally calls of a hot function cheaply | `doc.query.perf.count` |
332
+ | tell a stored record from a tracked or tree record | `@dialecte/core/helpers.isRawRecord` |
333
+ | tell a tracked record from a raw or tree record | `@dialecte/core/helpers.isTrackedRecord` |
334
+ | tell a tree record from a raw or tracked record | `@dialecte/core/helpers.isTreeRecord` |
335
+ | tell an attribute array from an attribute value object | `@dialecte/core/helpers.isFullAttributeArray` |
336
+ | tell the page where an app's SQLite engine worker is | `@dialecte/core/sqlite.registerSqliteEngine` |
337
+ | tell whether a value equals an attribute's default | `@dialecte/core/utils.isSchemaDefaultValue` |
338
+ | tell whether an import is running | `@dialecte/core.importOutcomeOf` |
339
+ | tell whether an import or a commit was applied | `@dialecte/core.writeOutcomeOf` |
340
+ | tell whether foreign attributes or elements are allowed | `@dialecte/core/utils.isNamespaceAllowedByWildcard` |
341
+ | tell which diagnostic an import reported | `@dialecte/core.isKnownDiagnostic` |
342
+ | tell which error was thrown | `@dialecte/core.isKnownDialecteError` |
343
+ | test a transaction against expected XML | `@dialecte/core/test.createTestRunner` |
344
+ | test what a prepared transaction would write | `@dialecte/core/helpers.evaluateExpectations` |
345
+ | the branches of a required choice | `@dialecte/core/utils.requiredChoices` |
346
+ | throw a structured error | `@dialecte/core.throwDialecteError` |
347
+ | time a callback without flooding the timeline | `doc.query.perf.time` |
348
+ | time a code section in dev | `doc.query.perf.start` |
349
+ | turn a record into a tree node | `@dialecte/core/helpers.toTreeRecord` |
350
+ | turn an attribute value object into an attribute array | `@dialecte/core/helpers.toFullAttributeArray` |
351
+ | undo the last change to a document | `project.undo` |
352
+ | unlink a file from an element | `project.detachBlob` |
353
+ | update and delete | `@dialecte/core.summarizeOperations` |
354
+ | update the progress caption | `tx.progress.nextStep` |
355
+ | use SQLite storage in an app | `@dialecte/core/sqlite.registerSqliteEngine` |
356
+ | use SQLite storage in an app (register the app's engine with `registerSqliteEngine` from `@dialecte/core/sqlite` and open with `storage: { type: 'sqlite' }`) | `@dialecte/core.createProjectFactory` |
357
+ | validate a document path | `@dialecte/core.parseDocumentPath` |
358
+ | validate an attribute value against its datatype patterns | `@dialecte/core/utils.valuePatterns` |
359
+ | validate an exported XML file against the schema in a test | `@dialecte/core/test.createXmlSchemaAssertions` |
360
+ | verify a script's result before committing | `@dialecte/core/helpers.evaluateExpectations` |
361
+ | wait for a document from another realm | `project.getDocumentStatus` |
362
+ | walk children recursively | `doc.query.getTree` |
363
+ | walk definitions top-down | `@dialecte/core/utils.resolveDefinition` |
364
+ | which children an element must hold where its content model offers a choice | `@dialecte/core/utils.requiredChoices` |
365
+ | wipe every document of the project | `doc.destroy` |
366
+ | wipe the project database with every document | `project.destroy` |
367
+ | word a diagnostic for a user | `@dialecte/core.isKnownDiagnostic` |
368
+ | word an error for a user | `@dialecte/core.isKnownDialecteError` |
369
+ | write a package that brings its own storage | `@dialecte/core.registerStorageKind` |
370
+ | write an app's engine worker file | `@dialecte/core/sqlite.serveSqliteEngine` |
371
+ | write an attribute in a declared or custom namespace | `@dialecte/core/utils.resolvePrefixByNamespaceScope` |
372
+ | write an xsi:type value the way core stores it | `@dialecte/core/utils.canonicalXsiType` |
368
373
 
369
374
  <!-- /dialecte-skills:generated -->
370
375
 
@@ -372,104 +377,105 @@ ruled out and why in your hand-over.
372
377
 
373
378
  <!-- dialecte-skills:generated api -->
374
379
 
375
- | Method | What it answers | Reach for it to |
376
- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
377
- | `doc.close` | Close the connection to the project's store, shared by every document of the project: after it, no document of this project can read or write. With a built-in store (local, in-memory), opening the project again gives a new store: documents opened before stay closed, open them again from the project. A custom store is reopened in place. To finish with the project, use `project.close`. | close the project's database connection from a document |
378
- | `doc.destroy` | Delete the whole project database and let the connection go: every document of the project, its history and its blobs - not only this document; refused `PROJECT_OPEN_ELSEWHERE`, nothing removed and the connection kept, while another connection has the project open. To delete one document, use `project.removeDocument`. | delete the whole project database from a document; wipe every document of the project |
379
- | `doc.prepare` | Build up operations without committing. Returns a PreparedTransaction with staged operations for preview, then call commit() to apply or discard() to throw away. | preview changes before committing; ask a user to confirm an edit; dry-run a transaction |
380
- | `doc.query.findAncestors` | Walk the parent chain from an element upward, one store read per step; for the parent alone, `getRecord(record.parent)` is enough. | list the ancestors of an element; find the enclosing element of a tag; build a path from the root |
381
- | `doc.query.findByAttributes` | Find records of one tag matching specific attribute values; it scans every element of that tag in the document. | find elements by attribute value; look up an element by an identifying attribute; filter one tag's elements by attribute |
382
- | `doc.query.findDescendants` | Find all descendants of an element, grouped by tag name, in no guaranteed order: walk a `getTree` result for document order. | collect descendants of given tag names under an element; find nested elements at any depth below a scope |
383
- | `doc.query.getAttribute` | Read a single attribute value of an element (a ref, a record or a relationship). | read an attribute of an element; read one attribute value; read a namespaced attribute; read an attribute with its schema default |
384
- | `doc.query.getAttributes` | Read an element's attributes as a destructurable value object, each under the name it is stored by - what a write takes back. Get a record's attributes for a namespace scope, keyed by **local** name. Get a record's attributes for a custom namespace scope not declared in the config, keyed by local name. Get all attributes of a record as an array of full attribute objects. | read the attributes of an element; read all attribute values of an element; destructure several attributes at once; read attributes of one namespace |
385
- | `doc.query.getChild` | Get the first direct child of an element matching a given tag name; it looks one level down only. | get one direct child by tag name; check whether a child exists |
386
- | `doc.query.getChildren` | Get all direct children of an element matching a given tag name; it looks one level down only, no recursion. | list direct children of one tag name; iterate one level below an element |
387
- | `doc.query.getDefinition` | The definition of an element in its context: the declaration its parent holds when the schema declares the tag several ways, and what the type it names with xsi:type lets it hold. | read the schema definition of an element; list allowed attributes or enumeration values; know what an xsi:type lets an element hold |
388
- | `doc.query.getDocumentInfo` | Get the full metadata record of this document. | read the document name or extension; get document metadata; find which config a document uses |
389
- | `doc.query.getRecord` | Get a single record by ref, record, or relationship, in one store read. | load one element by id; resolve a ref or parent/child relationship to its record; refresh a record |
390
- | `doc.query.getRecords` | Get multiple records in a single call. | load several elements by ref at once; resolve a list of children or relationships in one batched read |
391
- | `doc.query.getRecordsByTagName` | Get all records of a given tag name in the whole document, read from the tag index: the cheapest whole-document scan. | list every element of a tag in the whole document; scan all elements of one type regardless of position |
392
- | `doc.query.getRoot` | Get the root element of the document. | get the root element; start a walk from the top of the document |
393
- | `doc.query.getSnapshot` | Snapshot the (uncommitted) document state as a tree, XML string, or both: a view that includes staged changes. The stored file, to save or download, comes from `project.export`. | preview what a transaction would commit; read staged changes as XML or as a tree; show what a prepared transaction would produce |
394
- | `doc.query.getTree` | Build a full tree structure from an element down. It loads the whole document unless it is a committed read with an id and a depth. | read a subtree in document order; walk children recursively; project a filtered tree with select or omit; read a subtree to copy it with deepClone |
395
- | `doc.query.perf.count` (also `doc.perf.count`, `project.perf.count`) | O(1) tally for a hot per-node primitive (e.g. store round-trips, cache hits/misses) — cheaper than a span and safe in a node loop where per-call `start`/`stop` would flood the timeline. Surfaced as `count` in `report()`. | count store reads or cache hits in dev; tally calls of a hot function cheaply |
396
- | `doc.query.perf.log` (also `doc.perf.log`, `project.perf.log`) | Print the perf report as a console table (`console.table(report())`). | print perf metrics to the console |
397
- | `doc.query.perf.merge` (also `doc.perf.merge`, `project.perf.merge`) | Fold another realm's snapshot in under `<prefix>::<name>`: its spans placed on this realm's timeline (shifted by the difference of the two `timeOrigin`s), its tallies added to this one's. | combine timings measured in a worker with the page's; one report across realms |
398
- | `doc.query.perf.profile` (also `doc.perf.profile`, `project.perf.profile`) | Run `fn` inside a DevTools CPU profile (no-op in node/headless). | capture a CPU profile of an async operation in DevTools |
399
- | `doc.query.perf.report` (also `doc.perf.report`, `project.perf.report`) | Aggregate the timeline synchronously on demand — no `PerformanceObserver`. | read collected perf metrics; assert on store read counts in a test |
400
- | `doc.query.perf.reset` (also `doc.perf.reset`, `project.perf.reset`) | Clear all marks + measures (bound memory between measured scenarios). | reset perf metrics between measured scenarios |
401
- | `doc.query.perf.snapshot` (also `doc.perf.snapshot`, `project.perf.snapshot`) | This realm's spans (the shared timeline's; this perf's own with `timeline: false`) and this perf's tallies, to hand to another realm. | send a worker's or another realm's timings to the page; collect perf from the store engine |
402
- | `doc.query.perf.start` (also `doc.perf.start`, `project.perf.start`) | Open a span. Name-keyed pair (like `console.time`); name = `layer::op`. | time a code section in dev; measure how long an operation takes |
403
- | `doc.query.perf.stop` (also `doc.perf.stop`, `project.perf.stop`) | Close the most recent open span for `name`. Unmatched `stop` is a no-op. | end a timed section opened with start |
404
- | `doc.query.perf.time` (also `doc.perf.time`, `project.perf.time`) | O(1) wall-time accumulator: runs `fn`, adds its elapsed time to a running total keyed by `name` WITHOUT emitting a timeline measure per call (unlike `start`/`stop`). Surfaced as calls/totalMs/avgMs in `report()`. Use to time a hot per-node primitive (e.g. the SAX handlers) where millions of measures would flood the timeline. | accumulate time spent in a hot per-node function; time a callback without flooding the timeline |
405
- | `doc.subscribe` | Register a callback fired (synchronously, same-realm) whenever this document's shared state changes: progress steps + loading toggles during a transaction, undo/redo, and folded-in cross-realm commits. `terminal` is `true` for the final frame of an operation, letting a consumer flush it without coalescing. Returns an unsubscribe function. Wired from the owning Project's registry. | react to document changes in a UI; refresh a view after a commit or an undo; follow transaction progress |
406
- | `doc.transaction` | Run `fn` against a new transaction and commit everything it staged as one undoable step; on a throw nothing is written. A second transaction started on this Document while one runs throws `CONCURRENT_TRANSACTION`. | change a document; add or update or delete elements and commit them; group edits into one undo step |
407
- | `project.addBlob` | Add a blob owned by `documentId`. The binary lives in `blob_{documentId}`. Returns the generated blob id. | store a binary file in the project; add an attachment owned by a document |
408
- | `project.attachBlob` | Reference an existing blob from an element of a document (optionally from one of its attributes) and tell other tabs. | link a stored file to an element; attach a blob to a record |
409
- | `project.close` | Close the store and release resources, once the imports in flight (running and queued), the project's writes running (a Document's transaction or prepared commit included) and the work other realms' messages started have settled. Then the channel and the store are closed, `state.documents` is emptied and the Documents' subscriptions are dropped. From the call on, the project is closed: a new call throws `PROJECT_NOT_OPENED`, a Document opened before answers `STORE_CLOSED` (on a `custom` store opened again it writes but tells nothing: open it again). The stored documents stay. Runs in turn with the Project's other `open`, `close` and `destroy` calls. | close a project; release the database connection when leaving a page |
410
- | `project.createChannel` | Convenience: a fresh BroadcastChannel on this project's channel. The caller owns it — call channel.close() when done listening. | listen to project events; receive commits and imports made in other tabs |
411
- | `project.destroy` | Destroy the project - deletes the database entirely, every document with its history and blobs, once the imports in flight have landed; refused `PROJECT_OPEN_ELSEWHERE`, nothing removed, while another connection - a project or store of the name, in this page or another tab - has it open. To delete one document, use `removeDocument`. | delete a whole project; wipe the project database with every document |
412
- | `project.detachBlob` | Drop the reference from an element of a document to a blob; the blob itself stays stored. | unlink a file from an element; detach a blob from a record |
413
- | `project.export` | Export a document through the store: its file (`Blob`, formatted unless `indent: false`) and filename. On the page, `xmlDocument: true` also answers its DOM (parsed from the compact file: pass `indent: false` to export once) and `download` saves the formatted file (the save dialog is asked first). Two store exports made for one call may see two states of the document if a commit lands between them. | export a document to an XML file; get a document as a Blob; download a document; save a document as XML; read the exported XML as a DOM |
414
- | `project.exportBlob` | Export a blob from the store: `{ entry, data, filename }`; `download` also saves it (the save dialog, or a browser download), under its name or the one given. | download a stored file; save a blob to disk; read a blob with its file name |
415
- | `project.getBlob` | Read a stored blob: its metadata entry and its binary data, or `undefined` when the id is unknown. | read an attached file's content; load a blob by id |
416
- | `project.getBlobsByDocument` | The blobs referenced from a document (any of their attachments points into it). | list the files attached to a document |
417
- | `project.getBlobsByRecord` | The blobs referenced from one element of a document. | list the files attached to one element |
418
- | `project.getDatabaseInstance` | Expose the store's own database object, for debugging: the Dexie instance on `local` (cast it: the type is the store's, `unknown` unless the Project's store type is given), `null` on `sqlite` and `inMemory`. | inspect the underlying database; debug what the store holds |
419
- | `project.getDocument` | The metadata record of one document of the project, or `undefined` when it is unknown or still importing. | check a document exists; read a document's name or config key by id |
420
- | `project.getDocumentConfig` | Get the dialecte config a document uses, or `undefined` for a document the project does not know. | get the dialecte config of a document; know which schema a document uses |
421
- | `project.getDocuments` | The documents of the project; one still importing - here or in another realm - is not among them. | list the documents of a project; show the files a project holds |
422
- | `project.getDocumentStatus` | Reconcile this realm's store against persisted state, then report the document's liveness and readiness: - `live` — the document is registered in this realm's registry (so `openDocument` will not throw DOCUMENT_NOT_REGISTERED). - `ready` — the store can serve the document's records (so reads / export will not throw, e.g. a missing per-document table). | check that a document imported in another tab can be opened; wait for a document from another realm |
423
- | `project.getStandaloneBlobs` | The blobs of the project that no document references (no attachment). | list unattached files; find orphan blobs to clean up |
424
- | `project.import` | Import Files into the project: one entry per file, in the order given. The files are imported one after the other - memory is bounded by one file's batches, the registry sees one import - and a file that fails is its own `failed` entry, the next file still attempted: nothing of a failed file lands (but an import whose engine was lost after it landed: see `importFile`). The call itself rejects only for what is about the call: an unknown `configKey`, a project not open, a `path` (`DOCUMENT_PATH_INVALID`: a path names one file, `importFile` takes it). | import several XML files at once; get one result per file without a throw for a failed file |
425
- | `project.importFile` | Import one File into the project: the store registers, parses and stores it next to the data. The document is in the project state and broadcast once the store answers it `ready`; whatever fails before that, or an abort through `options.signal`, leaves nothing and is thrown (`PARSE_ERROR` for a malformed file, `IMPORT_ABORTED`, `IMPORT_FAILED` wrapping a foreign error). One refusal leaves its document: an import whose engine was lost after it landed is refused `STORE_ENGINE_LOST`, `meta.outcome` `applied`, its document in the state and broadcast. `options.onProgress` is told after each stored batch, never awaited. One file is in flight per project: a call made while another import runs waits for it. | import an XML file; load a file into the project; parse XML into records |
426
- | `project.initEmptyDocument` | Register a new empty document in the project. Returns the new documentId. Records are added later via import or transactions. | create a new empty document; start a document from scratch without a file |
427
- | `project.open` | Open a named project: resolve store, open DB connection, hydrate state. Must be called before import/export/openDocument. | open or create a project database; start working on a project; reopen a project after close |
428
- | `project.openDocument` | Open a file-scoped Document for querying and mutating a specific file. | open a document to read or write it; get the Document of an id |
429
- | `project.queryAll` | Run a query function across all documents, collect and flatten results. Iterates documents sequentially; merges all non-empty arrays. | collect results from every document; run one query over all documents |
430
- | `project.queryFirst` | Run a query function across all documents, return the first non-undefined result. Iterates documents sequentially; stops at the first match. | find the first match across every document; search all documents of a project |
431
- | `project.redo` | Re-apply the last undone transaction of a document and tell other tabs. Does nothing when there is nothing to redo. | redo an undone change to a document |
432
- | `project.removeBlob` | Delete a blob and its binary data from the project and tell other tabs. Does nothing when the id is unknown. | delete a stored file; remove a blob for good |
433
- | `project.removeDocument` | Remove one document from the project - its records, history and blobs - and tell other tabs. The other documents stay. | delete a document from the project; remove one file and its records |
434
- | `project.undo` | Revert the last committed transaction of a document and tell other tabs. Does nothing when there is nothing to undo. | undo the last change to a document; roll back a commit |
435
- | `tx.addChild` | Add a child element to a parent. It always creates one; `ensureChild` reuses an existing child. | create a new element under a parent; insert a child with attributes; build new content in a transaction |
436
- | `tx.deepClone` | Deep-clone a subtree under a new parent. | copy a subtree with fresh ids; duplicate an element under another parent; paste a tree read with getTree; map old ids to new ids |
437
- | `tx.delete` | Delete an element and its entire subtree. | remove an element; delete a subtree; prune a child from its parent |
438
- | `tx.ensureChild` | Get an existing child record or create it under the given parent. | get or create a child; make sure a singleton container exists before adding under it; add a child without duplicating it |
439
- | `tx.progress.endPlan` | Pop the innermost plan. Clears progress only once the stack is empty. | close a nested progress plan; finish reporting progress for a step |
440
- | `tx.progress.nextStep` | Advance the innermost plan by one step (close-previous); optionally recaption. | mark a progress step done; update the progress caption |
441
- | `tx.progress.plan` | Push a plan level (child of the current innermost, or the main if none). | report progress of a long operation; announce how many steps a transaction or nested step has; show a progress bar caption |
442
- | `tx.update` | Update attributes of an existing element. | change attribute values; set or clear an attribute; rename an element through its name attribute; set an element's text value |
380
+ | Method | What it answers | Reach for it to |
381
+ | ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
382
+ | `doc.close` | Close the connection to the project's store, shared by every document of the project: after it, no document of this project can read or write. With a built-in store (local, in-memory), opening the project again gives a new store: documents opened before stay closed, open them again from the project. A custom store is reopened in place. To finish with the project, use `project.close`. | close the project's database connection from a document |
383
+ | `doc.destroy` | Delete the whole project database and let the connection go: every document of the project, its history and its blobs - not only this document; refused `PROJECT_OPEN_ELSEWHERE`, nothing removed and the connection kept, while another connection has the project open. To delete one document, use `project.removeDocument`. | delete the whole project database from a document; wipe every document of the project |
384
+ | `doc.prepare` | Build up operations without committing. Returns a PreparedTransaction with staged operations for preview, then call commit() to apply or discard() to throw away. | preview changes before committing; ask a user to confirm an edit; dry-run a transaction |
385
+ | `doc.query.findAncestors` | Walk the parent chain from an element upward, one store read per step; for the parent alone, `getRecord(record.parent)` is enough. | list the ancestors of an element; find the enclosing element of a tag; build a path from the root |
386
+ | `doc.query.findByAttributes` | Find records of one tag matching specific attribute values; it scans every element of that tag in the document. | find elements by attribute value; look up an element by an identifying attribute; filter one tag's elements by attribute |
387
+ | `doc.query.findDescendants` | Find all descendants of an element, grouped by tag name, in no guaranteed order: walk a `getTree` result for document order. | collect descendants of given tag names under an element; find nested elements at any depth below a scope |
388
+ | `doc.query.getAttribute` | Read a single attribute value of an element (a ref, a record or a relationship). | read an attribute of an element; read one attribute value; read a namespaced attribute; read an attribute with its schema default |
389
+ | `doc.query.getAttributes` | Read an element's attributes as a destructurable value object, each under the name it is stored by - what a write takes back. Get a record's attributes for a namespace scope, keyed by **local** name. Get a record's attributes for a custom namespace scope not declared in the config, keyed by local name. Get all attributes of a record as an array of full attribute objects. | read the attributes of an element; read all attribute values of an element; destructure several attributes at once; read attributes of one namespace |
390
+ | `doc.query.getChild` | Get the first direct child of an element matching a given tag name; it looks one level down only. | get one direct child by tag name; check whether a child exists |
391
+ | `doc.query.getChildren` | Get all direct children of an element matching a given tag name; it looks one level down only, no recursion. | list direct children of one tag name; iterate one level below an element |
392
+ | `doc.query.getDefinition` | The definition of an element in its context: the declaration its parent holds when the schema declares the tag several ways, and what the type it names with xsi:type lets it hold. | read the schema definition of an element; list allowed attributes or enumeration values; know what an xsi:type lets an element hold |
393
+ | `doc.query.getDocumentInfo` | Get the full metadata record of this document. | read the document name or extension; get document metadata; find which config a document uses |
394
+ | `doc.query.getRecord` | Get a single record by ref, record, or relationship, in one store read. | load one element by id; resolve a ref or parent/child relationship to its record; refresh a record |
395
+ | `doc.query.getRecords` | Get multiple records in a single call. | load several elements by ref at once; resolve a list of children or relationships in one batched read |
396
+ | `doc.query.getRecordsByTagName` | Get all records of a given tag name in the whole document, read from the tag index: the cheapest whole-document scan. | list every element of a tag in the whole document; scan all elements of one type regardless of position |
397
+ | `doc.query.getRoot` | Get the root element of the document. | get the root element; start a walk from the top of the document |
398
+ | `doc.query.getSnapshot` | Snapshot the (uncommitted) document state as a tree, XML string, or both: a view that includes staged changes. The stored file, to save or download, comes from `project.export`. | preview what a transaction would commit; read staged changes as XML or as a tree; show what a prepared transaction would produce |
399
+ | `doc.query.getTree` | Build a full tree structure from an element down. It loads the whole document unless it is a committed read with an id and a depth. | read a subtree in document order; walk children recursively; project a filtered tree with select or omit; read a subtree to copy it with deepClone |
400
+ | `doc.query.perf.count` (also `doc.perf.count`, `project.perf.count`) | O(1) tally for a hot per-node primitive (e.g. store round-trips, cache hits/misses) — cheaper than a span and safe in a node loop where per-call `start`/`stop` would flood the timeline. Surfaced as `count` in `report()`. | count store reads or cache hits in dev; tally calls of a hot function cheaply |
401
+ | `doc.query.perf.log` (also `doc.perf.log`, `project.perf.log`) | Print the perf report as a console table (`console.table(report())`). | print perf metrics to the console |
402
+ | `doc.query.perf.merge` (also `doc.perf.merge`, `project.perf.merge`) | Fold another realm's snapshot in under `<prefix>::<name>`: its spans placed on this realm's timeline (shifted by the difference of the two `timeOrigin`s), its tallies added to this one's. | combine timings measured in a worker with the page's; one report across realms |
403
+ | `doc.query.perf.profile` (also `doc.perf.profile`, `project.perf.profile`) | Run `fn` inside a DevTools CPU profile (no-op in node/headless). | capture a CPU profile of an async operation in DevTools |
404
+ | `doc.query.perf.report` (also `doc.perf.report`, `project.perf.report`) | Aggregate the timeline synchronously on demand — no `PerformanceObserver`. | read collected perf metrics; assert on store read counts in a test |
405
+ | `doc.query.perf.reset` (also `doc.perf.reset`, `project.perf.reset`) | Clear all marks + measures (bound memory between measured scenarios). | reset perf metrics between measured scenarios |
406
+ | `doc.query.perf.snapshot` (also `doc.perf.snapshot`, `project.perf.snapshot`) | This realm's spans (the shared timeline's; this perf's own with `timeline: false`) and this perf's tallies, to hand to another realm. | send a worker's or another realm's timings to the page; collect perf from the store engine |
407
+ | `doc.query.perf.start` (also `doc.perf.start`, `project.perf.start`) | Open a span. Name-keyed pair (like `console.time`); name = `layer::op`. | time a code section in dev; measure how long an operation takes |
408
+ | `doc.query.perf.stop` (also `doc.perf.stop`, `project.perf.stop`) | Close the most recent open span for `name`. Unmatched `stop` is a no-op. | end a timed section opened with start |
409
+ | `doc.query.perf.time` (also `doc.perf.time`, `project.perf.time`) | O(1) wall-time accumulator: runs `fn`, adds its elapsed time to a running total keyed by `name` WITHOUT emitting a timeline measure per call (unlike `start`/`stop`). Surfaced as calls/totalMs/avgMs in `report()`. Use to time a hot per-node primitive (e.g. the SAX handlers) where millions of measures would flood the timeline. | accumulate time spent in a hot per-node function; time a callback without flooding the timeline |
410
+ | `doc.subscribe` | Register a callback fired (synchronously, same-realm) whenever this document's shared state changes: progress steps + loading toggles during a transaction, undo/redo, and folded-in cross-realm commits. `terminal` is `true` for the final frame of an operation, letting a consumer flush it without coalescing. Returns an unsubscribe function. Wired from the owning Project's registry. | react to document changes in a UI; refresh a view after a commit or an undo; follow transaction progress |
411
+ | `doc.transaction` | Run `fn` against a new transaction and commit everything it staged as one undoable step; on a throw nothing is written. A second transaction started on this Document while one runs throws `CONCURRENT_TRANSACTION`. | change a document; add or update or delete elements and commit them; group edits into one undo step |
412
+ | `project.addBlob` | Add a blob owned by `documentId`. The binary lives in `blob_{documentId}`. Returns the generated blob id. | store a binary file in the project; add an attachment owned by a document |
413
+ | `project.attachBlob` | Reference an existing blob from an element of a document (optionally from one of its attributes) and tell other tabs. | link a stored file to an element; attach a blob to a record |
414
+ | `project.close` | Close the store and release resources, once the imports in flight (running and queued), the project's writes running (a Document's transaction or prepared commit included) and the work other realms' messages started have settled. Then the channel and the store are closed, `state.documents` is emptied and the Documents' subscriptions are dropped. From the call on, the project is closed: a new call throws `PROJECT_NOT_OPENED`, a Document opened before answers `STORE_CLOSED` (on a `custom` store opened again it writes but tells nothing: open it again). The stored documents stay. Runs in turn with the Project's other `open`, `close` and `destroy` calls. | close a project; release the database connection when leaving a page |
415
+ | `project.createChannel` | Convenience: a fresh BroadcastChannel on this project's channel. The caller owns it — call channel.close() when done listening. | listen to project events; receive commits and imports made in other tabs |
416
+ | `project.destroy` | Destroy the project - deletes the database entirely, every document with its history and blobs, once the imports in flight have landed; refused `PROJECT_OPEN_ELSEWHERE`, nothing removed, while another connection - a project or store of the name, in this page or another tab - has it open. To delete one document, use `removeDocument`. | delete a whole project; wipe the project database with every document |
417
+ | `project.detachBlob` | Drop the reference from an element of a document to a blob; the blob itself stays stored. | unlink a file from an element; detach a blob from a record |
418
+ | `project.export` | Export a document through the store: its file (`Blob`, formatted unless `indent: false`) and filename. On the page, `xmlDocument: true` also answers its DOM (parsed from the compact file: pass `indent: false` to export once) and `download` saves the formatted file (the save dialog is asked first). Two store exports made for one call may see two states of the document if a commit lands between them. | export a document to an XML file; get a document as a Blob; download a document; save a document as XML; read the exported XML as a DOM |
419
+ | `project.exportBlob` | Export a blob from the store: `{ entry, data, filename }`; `download` also saves it (the save dialog, or a browser download), under its name or the one given. | download a stored file; save a blob to disk; read a blob with its file name |
420
+ | `project.getBlob` | Read a stored blob: its metadata entry and its binary data, or `undefined` when the id is unknown. | read an attached file's content; load a blob by id |
421
+ | `project.getBlobsByDocument` | The blobs referenced from a document (any of their attachments points into it). | list the files attached to a document |
422
+ | `project.getBlobsByRecord` | The blobs referenced from one element of a document. | list the files attached to one element |
423
+ | `project.getDatabaseInstance` | Expose the store's own database object, for debugging: the Dexie instance on `local` (cast it: the type is the store's, `unknown` unless the Project's store type is given), `null` on `inMemory` and on a store with no such object. | inspect the underlying database; debug what the store holds |
424
+ | `project.getDocument` | The metadata record of one document of the project, or `undefined` when it is unknown or still importing. | check a document exists; read a document's name or config key by id |
425
+ | `project.getDocumentConfig` | Get the dialecte config a document uses, or `undefined` for a document the project does not know. | get the dialecte config of a document; know which schema a document uses |
426
+ | `project.getDocuments` | The documents of the project; one still importing - here or in another realm - is not among them. | list the documents of a project; show the files a project holds |
427
+ | `project.getDocumentStatus` | Reconcile this realm's store against persisted state, then report the document's liveness and readiness: - `live` — the document is registered in this realm's registry (so `openDocument` will not throw DOCUMENT_NOT_REGISTERED). - `ready` — the store can serve the document's records (so reads / export will not throw, e.g. a missing per-document table). | check that a document imported in another tab can be opened; wait for a document from another realm |
428
+ | `project.getStandaloneBlobs` | The blobs of the project that no document references (no attachment). | list unattached files; find orphan blobs to clean up |
429
+ | `project.import` | Import Files into the project: one entry per file, in the order given. The files are imported one after the other - memory is bounded by one file's batches, the registry sees one import - and a file that fails is its own `failed` entry, the next file still attempted: nothing of a failed file lands (but an import whose connection was lost after it landed: see `importFile`). The call itself rejects only for what is about the call: an unknown `configKey`, a project not open, a `path` (`DOCUMENT_PATH_INVALID`: a path names one file, `importFile` takes it). | import several XML files at once; get one result per file without a throw for a failed file |
430
+ | `project.importFile` | Import one File into the project: the store registers, parses and stores it next to the data. The document is in the project state and broadcast once the store answers it `ready`; whatever fails before that, or an abort through `options.signal`, leaves nothing and is thrown (`PARSE_ERROR` for a malformed file, `IMPORT_ABORTED`, `IMPORT_FAILED` wrapping a foreign error). One refusal leaves its document: an import whose connection was lost after it landed is refused `STORE_CONNECTION_LOST`, `meta.outcome` `applied`, its document in the state and broadcast. `options.onProgress` is told after each stored batch, never awaited. One file is in flight per project: a call made while another import runs waits for it. | import an XML file; load a file into the project; parse XML into records |
431
+ | `project.initEmptyDocument` | Register a new empty document in the project. Returns the new documentId. Records are added later via import or transactions. | create a new empty document; start a document from scratch without a file |
432
+ | `project.open` | Open a named project: resolve store, open DB connection, hydrate state. Must be called before import/export/openDocument. | open or create a project database; start working on a project; reopen a project after close |
433
+ | `project.openDocument` | Open a file-scoped Document for querying and mutating a specific file. | open a document to read or write it; get the Document of an id |
434
+ | `project.queryAll` | Run a query function across all documents, collect and flatten results. Iterates documents sequentially; merges all non-empty arrays. | collect results from every document; run one query over all documents |
435
+ | `project.queryFirst` | Run a query function across all documents, return the first non-undefined result. Iterates documents sequentially; stops at the first match. | find the first match across every document; search all documents of a project |
436
+ | `project.redo` | Re-apply the last undone transaction of a document and tell other tabs. Does nothing when there is nothing to redo. | redo an undone change to a document |
437
+ | `project.removeBlob` | Delete a blob and its binary data from the project and tell other tabs. Does nothing when the id is unknown. | delete a stored file; remove a blob for good |
438
+ | `project.removeDocument` | Remove one document from the project - its records, history and blobs - and tell other tabs. The other documents stay. | delete a document from the project; remove one file and its records |
439
+ | `project.undo` | Revert the last committed transaction of a document and tell other tabs. Does nothing when there is nothing to undo. | undo the last change to a document; roll back a commit |
440
+ | `tx.addChild` | Add a child element to a parent. It always creates one; `ensureChild` reuses an existing child. | create a new element under a parent; insert a child with attributes; build new content in a transaction |
441
+ | `tx.deepClone` | Deep-clone a subtree under a new parent. | copy a subtree with fresh ids; duplicate an element under another parent; paste a tree read with getTree; map old ids to new ids |
442
+ | `tx.delete` | Delete an element and its entire subtree. | remove an element; delete a subtree; prune a child from its parent |
443
+ | `tx.ensureChild` | Get an existing child record or create it under the given parent. | get or create a child; make sure a singleton container exists before adding under it; add a child without duplicating it |
444
+ | `tx.progress.endPlan` | Pop the innermost plan. Clears progress only once the stack is empty. | close a nested progress plan; finish reporting progress for a step |
445
+ | `tx.progress.nextStep` | Advance the innermost plan by one step (close-previous); optionally recaption. | mark a progress step done; update the progress caption |
446
+ | `tx.progress.plan` | Push a plan level (child of the current innermost, or the main if none). | report progress of a long operation; announce how many steps a transaction or nested step has; show a progress bar caption |
447
+ | `tx.update` | Update attributes of an existing element. | change attribute values; set or clear an attribute; rename an element through its name attribute; set an element's text value |
443
448
 
444
449
  ### `@dialecte/core`
445
450
 
446
- | Function | What it answers | Reach for it to |
447
- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
448
- | `applyDocumentUpdates` | A document with the updates applied, its file name and its path kept one fact: a `path` moves and renames it (its `name` follows the file name, which must end with the document's own `extension`); a `name` on a document with a path rewrites the file name in it, the folders kept; both given must agree; a field given as `undefined` is left as it was, a key beyond `DOCUMENT_UPDATE_FIELDS` ignored. Refused with `DOCUMENT_PATH_INVALID` when the result breaks a rule; the document given is left as it was. Whether the place is free is the store's to check (`assertDocumentPlace`). | rename or move a document by its path; apply document updates in a custom store |
449
- | `assertDocumentPlace` | Check a document to register against the registered ones: its path valid and ending with its file name (`DOCUMENT_PATH_INVALID`), then its place free (`DOCUMENT_PATH_TAKEN`). A document without a path passes. | check a document path is valid and free before registering it; register documents in a custom store |
450
- | `bindExtensions` | The extension map bound to an instance (a Query or a Transaction): same shape, each function called with the instance. Each function in the map gets `instance` prepended as its first argument, so the public API signature has that argument stripped. | attach an extension map to a query or a transaction; call extension functions as methods of an instance |
451
- | `blobTableName` | The name of the store table holding the blob data of the document `documentId`. | name the store table holding a document's blob data; store blobs in a custom store |
452
- | `createDiagnostic` | Build a diagnostic of a catalogue: `severity`, `source` and the default `message` come from the entry, so a producer only says what the diagnostic is about. The `meta` and `related` given keep their type on the way out, so a dialecte's typed diagnostic (`Diagnostic<'x'> & { meta: {…} }`) is what this returns when it is given that `meta`. | report an import or validation problem as a typed diagnostic; build a diagnostic from a dialecte's catalogue; attach meta to a diagnostic |
453
- | `createDialecteError` | Build the Error `throwDialecteError` throws, without throwing it — for a caller that reports an error it caught instead of raising one. | report a caught error as a dialecte error without throwing; build the Error throwDialecteError would throw |
454
- | `createPerf` | Dev metrics on the platform User Timing API. Disabled builds get `NOOP_PERF`. | measure how long operations take in development; collect timing spans and read a report of them |
455
- | `createProjectFactory` | The project factory of a dialecte: every config, the default key, the dialecte's extensions merged under the consumer's, and a fresh hooks instance per Project. It carries the declaration, `engineUrl`, the address of the dialecte's engine worker, for the store that spawns it, and `spawner`, the engine as a page registers it with the hub (`connectHub({ spawners })`). `destroyProject({ name })` deletes the dialecte's project of that name on SQLite storage without opening it (an outdated or lost one too). | open projects of a dialecte from an app; get the factory that creates a dialecte's projects; delete a dialecte's project without opening it; register a dialecte's engine with the hub; use SQLite storage in an app (import `@dialecte/core/sqlite` once and open with `storage: { type: 'sqlite' }`); share one SQLite engine per project between the tabs of an app |
456
- | `defineDialecte` | Declare a dialecte once: its identity, its configs, its extensions and how its hooks are made. Core derives the rest: `createProjectFactory`, `createTestRunner`, `createTestProject` and, in a worker, the engine. The declaration is frozen. | declare a dialecte package; register a dialecte's configs and extensions and hooks once; set up a new dialecte |
457
- | `defineErrors` | Declare the errors of a dialecte: each entry gets its property name as `key`, so it can be passed wherever a core key is — `throwDialecteError`, `invariant`. | declare a dialecte's own error catalogue; add error keys usable with invariant and throwDialecteError |
458
- | `importOutcomeOf` | What became of an import, read from the registry: the document its `writeId` is on is `running` while `importing`, `applied` once `ready`; no document carries it after a failure, an abort or a removal - `not-applied`. A store that knows which imports run says so (`isRunning`): a document `importing` whose import does not run is what a failed import left when its removal failed too - `not-applied`, removed when a store of the project next opens. | tell whether an import is running; applied or not applied; recover after a connection lost during an import |
459
- | `inspectXml` | Inspect an XML string for the first occurrence of each requested element name. Returns a typed report keyed by the requested names. | peek at an XML file before importing it; read the root element or a version attribute without a full parse; detect which config a file needs |
460
- | `isKnownDiagnostic` | Whether a diagnostic is one the caller knows: an entry of one of the catalogues named, matched on the pair (`source`, `code`) - two dialectes may both have an `unresolved-reference`. Its `code` is then narrowed to those catalogues' codes, so a `switch` on it or a table read with it is checked. | tell which diagnostic an import reported; narrow a diagnostic to a catalogue's codes; word a diagnostic for a user |
461
- | `isKnownDialecteError` | Whether a structured error is one the caller knows: a key of the core catalogue, or an entry of one of the catalogues named — same key, same code. Its `key` is then narrowed to those keys, so a `switch` on it or a table read with it is checked again. | tell which error was thrown; narrow an error key for a switch; word an error for a user |
462
- | `parseDocumentPath` | A document's path read apart into its folders and its file name. A path is relative and written one way only: segments joined by `/`, none empty, none `.` or `..`, no backslash, no invisible format, separator or control character, well-formed and in Unicode NFC, each segment at most 255 UTF-8 bytes and the whole at most 1024. Nothing is rewritten: a path breaking a rule is refused with `DOCUMENT_PATH_INVALID`, `detail` naming the rule, `meta.path` the path as given. | validate a document path; split a document path into folders and file name |
463
- | `parseXmlDocument` | The DOM of an XML file, in the page (a worker or Node has no `DOMParser`). Parse the compact export (`indent: false`) to get the document the stored records make, with no whitespace-only text node. A file that is not well-formed throws `PARSE_ERROR`, with what the parser said. | get the DOM of an exported XML file; read an export as an XMLDocument in the page; query an export with XPath |
464
- | `pathHolderOf` | The document whose path clashes with `path`, the document `documentId` excepted: one at that very place, or one whose path is a folder of the other's - a file system holds no file and folder of one name. Paths compare exactly; a document without a path holds no place. None when the place is free. | find which document holds a path; check whether a file or folder path is free |
465
- | `recordTableName` | The name of the store table holding the records of the document `documentId`. | name the store table holding a document's records; read a document's records from the local database directly |
466
- | `removeUnfinishedImports` | Remove every document an import left `importing`: an import never outlives the store that ran it, so what a store finds `importing` when it opens is a leftover - a closed tab, a crash. A store shared by several connections names the imports still running (`isRunning`): they are kept. A row is read again before it goes, so an import that ended since the registry was listed stays. | clean up the imports a closed tab or a crash left behind; clean up leftover imports when a custom store opens |
467
- | `runExport` | The export of one document, next to the data - what every store's `exportFile` runs. The records are read parent by parent, `batchSize` children per call in the order they are written (never the whole document in one call), and written as they come; each written batch becomes a part of the answered `Blob`, whose head (declaration and root start tag) is put in front at the end. A write on the document while it is exported restarts it once from the start; a second one fails it with `EXPORT_CONFLICT`. The progress listener and the abort come apart from the export's data, as a worker call carries them. | implement exportFile of a custom store; export a document from a store in batches |
468
- | `runImport` | The import of one file, next to the data - what every store's `importFile` runs. It registers the document `importing` under the caller's `writeId`, parses the file with the dialecte's import session and stores it batch by batch, applies the session's writes, marks the document `ready`. A document is whole or absent: whatever fails, or an abort, removes it and is thrown (a foreign error as `IMPORT_FAILED`, its cause kept; diagnostics that are not plain JSON as `STORE_VALUE_NOT_JSON`). The progress listener and the abort come apart from the import's data, as a worker call carries them. | implement importFile of a custom store; import a file into a store with core's import pipeline |
469
- | `summarizeOperations` | What staged operations write, counted per record as the commit merges them (a record created then updated is one creation; created then deleted, nothing): totals, and per tag in tag order. | count what a transaction will create; update and delete; summarize a prepared transaction per tag; show a confirmation summary before commit |
470
- | `throwDialecteError` | Create a structured error and throw it. When `method` is omitted, the caller's name is extracted from the stack trace. | throw a structured error; fail with a core or dialecte error key; raise an error a consumer can read by key |
471
- | `toDialecteError` | The structured error a caught value carries — thrown by `throwDialecteError` or `invariant` — or nothing when it is any other error or value. | read the structured error from a caught value; handle a dialecte error in a catch block |
472
- | `writeOutcomeOf` | What became of a write - an import or a commit - read from the registry first, then from the history: `committed` says whether a history entry carries the id (a commit is applied whole or not at all, never running). | tell whether an import or a commit was applied; recover after a connection lost during a write |
451
+ | Function | What it answers | Reach for it to |
452
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
453
+ | `applyDocumentUpdates` | A document with the updates applied, its file name and its path kept one fact: a `path` moves and renames it (its `name` follows the file name, which must end with the document's own `extension`); a `name` on a document with a path rewrites the file name in it, the folders kept; both given must agree; a field given as `undefined` is left as it was, a key beyond `DOCUMENT_UPDATE_FIELDS` ignored. Refused with `DOCUMENT_PATH_INVALID` when the result breaks a rule; the document given is left as it was. Whether the place is free is the store's to check (`assertDocumentPlace`). | rename or move a document by its path; apply document updates in a custom store |
454
+ | `assertDocumentPlace` | Check a document to register against the registered ones: its path valid and ending with its file name (`DOCUMENT_PATH_INVALID`), then its place free (`DOCUMENT_PATH_TAKEN`). A document without a path passes. | check a document path is valid and free before registering it; register documents in a custom store |
455
+ | `bindExtensions` | The extension map bound to an instance (a Query or a Transaction): same shape, each function called with the instance. Each function in the map gets `instance` prepended as its first argument, so the public API signature has that argument stripped. | attach an extension map to a query or a transaction; call extension functions as methods of an instance |
456
+ | `blobTableName` | The name of the store table holding the blob data of the document `documentId`. | name the store table holding a document's blob data; store blobs in a custom store |
457
+ | `createDiagnostic` | Build a diagnostic of a catalogue: `severity`, `source` and the default `message` come from the entry, so a producer only says what the diagnostic is about. The `meta` and `related` given keep their type on the way out, so a dialecte's typed diagnostic (`Diagnostic<'x'> & { meta: {…} }`) is what this returns when it is given that `meta`. | report an import or validation problem as a typed diagnostic; build a diagnostic from a dialecte's catalogue; attach meta to a diagnostic |
458
+ | `createDialecteError` | Build the Error `throwDialecteError` throws, without throwing it — for a caller that reports an error it caught instead of raising one. | report a caught error as a dialecte error without throwing; build the Error throwDialecteError would throw |
459
+ | `createPerf` | Dev metrics on the platform User Timing API. Disabled builds get `NOOP_PERF`. | measure how long operations take in development; collect timing spans and read a report of them |
460
+ | `createProjectFactory` | The project factory of a dialecte: every config, the default key, the dialecte's extensions merged under the consumer's, and a fresh hooks instance per Project. It carries the declaration and names no store: each Project it makes opens on the `storage` given to it, core's own or a kind an entry registers (SQLite storage with `@dialecte/core/sqlite`, whose page tells once where its engine worker is). `destroyProject({ name, storage })` deletes the dialecte's project of that name on that storage without opening it (one a store cannot open too). | open projects of a dialecte from an app; get the factory that creates a dialecte's projects; delete a dialecte's project without opening it; use SQLite storage in an app (register the app's engine with `registerSqliteEngine` from `@dialecte/core/sqlite` and open with `storage: { type: 'sqlite' }`); share one SQLite engine per project between the tabs of an app |
461
+ | `defineDialecte` | Declare a dialecte once: its identity, its configs, its extensions and how its hooks are made. Core derives the rest: `createProjectFactory`, `createTestRunner`, `createTestProject` and what a store serving it elsewhere runs (SQLite's engine worker). The declaration is frozen. | declare a dialecte package; register a dialecte's configs and extensions and hooks once; set up a new dialecte |
462
+ | `defineErrors` | Declare the errors of a dialecte: each entry gets its property name as `key`, so it can be passed wherever a core key is — `throwDialecteError`, `invariant`. | declare a dialecte's own error catalogue; add error keys usable with invariant and throwDialecteError |
463
+ | `importOutcomeOf` | What became of an import, read from the registry: the document its `writeId` is on is `running` while `importing`, `applied` once `ready`; no document carries it after a failure, an abort or a removal - `not-applied`. A store that knows which imports run says so (`isRunning`): a document `importing` whose import does not run is what a failed import left when its removal failed too - `not-applied`, removed when a store of the project next opens. | tell whether an import is running; applied or not applied; recover after a connection lost during an import |
464
+ | `inspectXml` | Inspect an XML string for the first occurrence of each requested element name. Returns a typed report keyed by the requested names. | peek at an XML file before importing it; read the root element or a version attribute without a full parse; detect which config a file needs |
465
+ | `isKnownDiagnostic` | Whether a diagnostic is one the caller knows: an entry of one of the catalogues named, matched on the pair (`source`, `code`) - two dialectes may both have an `unresolved-reference`. Its `code` is then narrowed to those catalogues' codes, so a `switch` on it or a table read with it is checked. | tell which diagnostic an import reported; narrow a diagnostic to a catalogue's codes; word a diagnostic for a user |
466
+ | `isKnownDialecteError` | Whether a structured error is one the caller knows: a key of the core catalogue, or an entry of one of the catalogues named — same key, same code. Its `key` is then narrowed to those keys, so a `switch` on it or a table read with it is checked again. | tell which error was thrown; narrow an error key for a switch; word an error for a user |
467
+ | `parseDocumentPath` | A document's path read apart into its folders and its file name. A path is relative and written one way only: segments joined by `/`, none empty, none `.` or `..`, no backslash, no invisible format, separator or control character, well-formed and in Unicode NFC, each segment at most 255 UTF-8 bytes and the whole at most 1024. Nothing is rewritten: a path breaking a rule is refused with `DOCUMENT_PATH_INVALID`, `detail` naming the rule, `meta.path` the path as given. | validate a document path; split a document path into folders and file name |
468
+ | `parseXmlDocument` | The DOM of an XML file, in the page (a worker or Node has no `DOMParser`). Parse the compact export (`indent: false`) to get the document the stored records make, with no whitespace-only text node. A file that is not well-formed throws `PARSE_ERROR`, with what the parser said. | get the DOM of an exported XML file; read an export as an XMLDocument in the page; query an export with XPath |
469
+ | `pathHolderOf` | The document whose path clashes with `path`, the document `documentId` excepted: one at that very place, or one whose path is a folder of the other's - a file system holds no file and folder of one name. Paths compare exactly; a document without a path holds no place. None when the place is free. | find which document holds a path; check whether a file or folder path is free |
470
+ | `recordTableName` | The name of the store table holding the records of the document `documentId`. | name the store table holding a document's records; read a document's records from the local database directly |
471
+ | `registerStorageKind` | Register the store a storage type gets, for every copy of `@dialecte/core` of the same storage version in this realm: a project opened on `{ type }` gets the store `kind.storeOf` builds, a test project the one `kind.testStoreOf` answers (or the storage as it is, without it). The type is first declared by a module augmentation (`declare module '@dialecte/core' { interface StorageKinds { <type>: { type: '<type>'; ... } } }`), then registered once, by the entry that brings the kind (importing it is the app's opt-in). The first registration of a type is kept: the same `kind.id` again does nothing (a module evaluated twice, another copy of the package); another `id` is refused `STORE_KIND_TAKEN`, nothing replaced. Core's own types (`local`, `inMemory`, `custom`) are refused `ASSERTION_FAILED`: core serves them, no kind takes their place. | add a storage kind to core; register a store a project opens on by its storage type; write a package that brings its own storage |
472
+ | `removeUnfinishedImports` | Remove every document an import left `importing`: an import never outlives the store that ran it, so what a store finds `importing` when it opens is a leftover - a closed tab, a crash. A store shared by several connections names the imports still running (`isRunning`): they are kept. A row is read again before it goes, so an import that ended since the registry was listed stays. | clean up the imports a closed tab or a crash left behind; clean up leftover imports when a custom store opens |
473
+ | `runExport` | The export of one document, next to the data - what every store's `exportFile` runs. The records are read parent by parent, `batchSize` children per call in the order they are written (never the whole document in one call), and written as they come; each written batch becomes a part of the answered `Blob`, whose head (declaration and root start tag) is put in front at the end. A write on the document while it is exported restarts it once from the start; a second one fails it with `EXPORT_CONFLICT`. The progress listener and the abort come apart from the export's data, as a worker call carries them. | implement exportFile of a custom store; export a document from a store in batches |
474
+ | `runImport` | The import of one file, next to the data - what every store's `importFile` runs. It registers the document `importing` under the caller's `writeId`, parses the file with the dialecte's import session and stores it batch by batch, applies the session's writes, marks the document `ready`. A document is whole or absent: whatever fails, or an abort, removes it and is thrown (a foreign error as `IMPORT_FAILED`, its cause kept; diagnostics that are not plain JSON as `STORE_VALUE_NOT_JSON`). The progress listener and the abort come apart from the import's data, as a worker call carries them. | implement importFile of a custom store; import a file into a store with core's import pipeline |
475
+ | `summarizeOperations` | What staged operations write, counted per record as the commit merges them (a record created then updated is one creation; created then deleted, nothing): totals, and per tag in tag order. | count what a transaction will create; update and delete; summarize a prepared transaction per tag; show a confirmation summary before commit |
476
+ | `throwDialecteError` | Create a structured error and throw it. When `method` is omitted, the caller's name is extracted from the stack trace. | throw a structured error; fail with a core or dialecte error key; raise an error a consumer can read by key |
477
+ | `toDialecteError` | The structured error a caught value carries — thrown by `throwDialecteError` or `invariant` — or nothing when it is any other error or value. | read the structured error from a caught value; handle a dialecte error in a catch block |
478
+ | `writeOutcomeOf` | What became of a write - an import or a commit - read from the registry first, then from the history: `committed` says whether a history entry carries the id (a commit is applied whole or not at all, never running). | tell whether an import or a commit was applied; recover after a connection lost during a write |
473
479
 
474
480
  ### `@dialecte/core/test`
475
481
 
@@ -540,18 +546,14 @@ ruled out and why in your hand-over.
540
546
  | `toTreeRecord` | A new `TreeRecord` of a raw, tracked or tree record: its stored fields and change status as `toTrackedRecord` gives them, and its child nodes - the `tree` given, else the record's own, else `[]`. The field values and the `tree` array are shared with the record, not cloned. | turn a record into a tree node; build a tree record from a raw or tracked record |
541
547
  | `widen` | Widen any per-element dialecte value to its element-union form — the same value, with its element type parameter widened from a specific `GenericElement` to `ElementsOf<GenericConfig>`. | pass a per-element record or ref to an API typed with the element union; fix an invariance type error on a record or ref |
542
548
 
543
- ### `@dialecte/core/engine`
544
-
545
- | Function | What it answers | Reach for it to |
546
- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
547
- | `serveDialecteEngine` | Serve the dialecte's project engine from this worker, the one call of a dialecte package's engine worker file - today the SQLite engine on the origin's private file system (opfs-sahpool). The realm that spawned it (or the hub, through it) sends control messages - open the project, adopt a client's port, a client gone, close, destroy - handled one at a time and each answered once; every adopted port is served the engine's members. One project per worker. | serve a dialecte's engine from a worker; write a dialecte package's engine worker file; ship a dialecte's SQLite engine in its package |
548
-
549
549
  ### `@dialecte/core/sqlite`
550
550
 
551
- | Function | What it answers | Reach for it to |
552
- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
553
- | `adoptHubPort` | Join the hub through a port a page made with `createHubPort` (a document that cannot reach the hub's script), and get that document's connection: a client only, whose liveness is that page's. A port nobody answers fails the join `STORE_CONNECTION_FAILED` once the welcome budget has passed. A document that connected already gets its connection - `undefined` when that one found no hub. One the hub dropped with its page (its calls refused `STORE_ENGINE_LOST`, `realm-dropped`) joins again on the new port, on its own: the page makes it one from `onRejoined`, and a join that fails leaves it dropped until the next one. | join the hub from an iframe of another origin; open projects on SQLite storage in a child frame through its page's engine; bind a child frame again after its page rejoined the hub |
554
- | `connectHub` | Connect this page to the origin's hub, once, and get its connection (`HubRealm`: `realmId`, `createHubPort` to bind a child frame, `onRejoined`, the moment to bind child frames again after a freeze or a drop): a second call - from this copy of the library or another one of the same protocol - gets the same connection. Answers `undefined` where the browser has no SharedWorker, or the hub never welcomed the page (its script failed to load or was blocked, or it stayed silent): a later call tries again. A hub of another protocol refuses the page: `STORE_PROTOCOL_MISMATCH`; the browser refusing to make the hub's worker (a `DOMException`) is no hub, any other error thrown making it is thrown. The page registers the engines it can start whose worker is of its own origin (each dialecte's `factory.spawner`); a later call adds those it does not run yet - a project opened on `sqlite` adds its own as it opens - and one naming a dialecte the page runs at another version is refused `STORE_HUB_SPAWNERS_FIXED`, the connection kept. A document that joined through `adoptHubPort` hosts no engine: the spawners it names are not registered; neither are those of a page that cannot store (no private file system; two versions of one dialecte refused all the same): its own projects on `sqlite` are refused `STORE_UNAVAILABLE` unless its page bound it, its connection serving to hand ports to its children. An engine's files (the SQLite wasm) are fetched when the page first starts one. | register this page's dialecte engines with the hub before any project opens; connect a page to the origin's hub; offer a dialecte's engine to the hub (`factory.spawner`); get a port to hand a child frame of another origin |
555
- | `listProjects` | The projects on SQLite storage of this origin - every dialecte's, or `dialecteId`'s - read from the origin's private file system alone (no engine started, no wasm loaded; a project whose engine runs is read too), sorted by dialecte and name: each one's state (`current`, `outdated`, `lost`, `new`, `unknown`), the bytes it takes and when it was last written. Where the browser gives no private file system (Node, a private window) it refuses `STORE_UNAVAILABLE`. | list the projects stored in the browser on SQLite storage; find outdated or lost projects on SQLite storage; show how much space each project takes; check whether a project exists on SQLite storage without opening it |
551
+ | Function | What it answers | Reach for it to |
552
+ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
553
+ | `adoptHubPort` | Join the hub through a port a page made with `createHubPort` (a document that cannot reach the hub's script), and get that document's connection: a client only, whose liveness is that page's. A port nobody answers fails the join `STORE_CONNECTION_FAILED` once the welcome budget has passed. A document that connected already gets its connection - `undefined` when that one found no hub. One the hub dropped with its page (its calls refused `STORE_CONNECTION_LOST`, `realm-dropped`) joins again on the new port, on its own: the page makes it one from `onRejoined`, and a join that fails leaves it dropped until the next one. | join the hub from an iframe of another origin; open projects on SQLite storage in a child frame through its page's engine; bind a child frame again after its page rejoined the hub |
554
+ | `connectHub` | Connect this page to the origin's hub, once, and get its connection (`HubRealm`: `realmId`, `createHubPort` to bind a child frame, `onRejoined`, the moment to bind child frames again after a freeze or a drop): a second call - from this copy of the library or another one of the same protocol - gets the same connection. Answers `undefined` where the browser has no SharedWorker, or the hub never welcomed the page (its script failed to load or was blocked, or it stayed silent): a later call tries again. A hub of another protocol refuses the page: `STORE_PROTOCOL_MISMATCH`; the browser refusing to make the hub's worker (a `DOMException`) is no hub, any other error thrown making it is thrown. The page offers the hub the engines the app registered (`registerSqliteEngine`), one per dialecte on the one worker file, when that file is of its own origin; connecting before registering is allowed and offers nothing - a later call adds those registered since, as a project opened on `sqlite` does - so register first. A document that joined through `adoptHubPort` hosts no engine and offers none; neither does a page that cannot store (no private file system): its own projects on `sqlite` are refused `STORE_UNAVAILABLE` unless its page bound it, its connection serving to hand ports to its children. An engine's files (the SQLite wasm) are fetched when the page first starts one. | connect a page to the origin's hub before any project opens; offer the engines an app registered to the hub; get a port to hand a child frame of another origin |
555
+ | `listProjects` | The projects on SQLite storage of this origin - every dialecte's, or `dialecteId`'s - read from the origin's private file system alone (no engine started, no wasm loaded; a project whose engine runs is read too), sorted by dialecte and name: each one's state (`current`, `outdated`, `lost`, `new`, `unknown`), the bytes it takes and when it was last written. Where the browser gives no private file system (Node, a private window) it refuses `STORE_UNAVAILABLE`. | list the projects stored in the browser on SQLite storage; find outdated or lost projects on SQLite storage; show how much space each project takes; check whether a project exists on SQLite storage without opening it |
556
+ | `registerSqliteEngine` | Tell this page where the app's SQLite engine is: `url`, its one worker file (a `?worker&url` import of the file that calls `serveSqliteEngine`), and `dialectes`, the dialectes that file serves (their declarations fit; only each id and version are kept, as plain data on the realm's `globalThis`, so every copy of the library of the same SQLite storage version finds them). Call it once, before the first project opens on `sqlite`; a project of a dialecte it does not name is refused `PROJECT_SQLITE_ENGINE_NOT_REGISTERED`. The same URL and the same dialectes again, in any order, do nothing (a module evaluated twice). Anything else is refused `STORE_SQLITE_ENGINE_FIXED`, the first kept: there is no additive call, the app names all its dialectes at once. Two versions of one dialecte are refused `STORE_HUB_SPAWNERS_FIXED`, nothing kept. A child frame of another origin does not register: its shell does, and it joins through `adoptHubPort`. | use SQLite storage in an app; tell the page where an app's SQLite engine worker is; register the dialectes an app's engine worker serves; open projects of several dialectes on one SQLite engine worker |
557
+ | `serveSqliteEngine` | This worker serves the engine of a project of any of the dialectes given, the one call of an app's engine worker file: the realm that spawned it (or the hub, through it) opens a project of the dialecte it names, adopts clients, closes and destroys it, each message answered once. A dialecte not given, or given at another version, is refused as data with nothing touched. One worker file for all the app's dialectes, one project per worker instance; the engine and its wasm stay out of the page's bundle. | serve the engines of an app's dialectes from one worker; write an app's engine worker file; keep sqlite-wasm out of the page's bundle |
556
558
 
557
559
  <!-- /dialecte-skills:generated -->