@owlmeans/server-planning 0.1.18-rc.8 → 0.1.18

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 (438) hide show
  1. package/README.md +92 -19
  2. package/agent-meta/manifest.json +105 -4
  3. package/agent-meta/skills/server-planning/SKILL.md +89 -138
  4. package/agent-meta/skills/server-planning/parts/auxiliary.md +54 -0
  5. package/agent-meta/skills/server-planning/parts/executor.md +82 -0
  6. package/agent-meta/skills/server-planning/parts/schemas.md +26 -0
  7. package/agent-meta/skills/server-planning/parts/serving.md +88 -0
  8. package/agent-meta/skills/server-planning/parts/stores.md +91 -0
  9. package/build/actions/apply-schema-request.d.ts +8 -0
  10. package/build/actions/apply-schema-request.d.ts.map +1 -0
  11. package/build/actions/apply-schema-request.js +33 -0
  12. package/build/actions/apply-schema-request.js.map +1 -0
  13. package/build/actions/commit.d.ts +3 -3
  14. package/build/actions/commit.d.ts.map +1 -1
  15. package/build/actions/commit.js +5 -4
  16. package/build/actions/commit.js.map +1 -1
  17. package/build/actions/define-schemas.d.ts +13 -0
  18. package/build/actions/define-schemas.d.ts.map +1 -0
  19. package/build/actions/define-schemas.js +28 -0
  20. package/build/actions/define-schemas.js.map +1 -0
  21. package/build/actions/execute.d.ts +11 -10
  22. package/build/actions/execute.d.ts.map +1 -1
  23. package/build/actions/execute.js +17 -27
  24. package/build/actions/execute.js.map +1 -1
  25. package/build/actions/execution/types.d.ts +34 -0
  26. package/build/actions/execution/types.d.ts.map +1 -0
  27. package/build/actions/execution/types.js +2 -0
  28. package/build/actions/execution/types.js.map +1 -0
  29. package/build/actions/execution.d.ts +4 -0
  30. package/build/actions/execution.d.ts.map +1 -0
  31. package/build/actions/execution.js +88 -0
  32. package/build/actions/execution.js.map +1 -0
  33. package/build/actions/get-card.d.ts +6 -0
  34. package/build/actions/get-card.d.ts.map +1 -0
  35. package/build/actions/get-card.js +9 -0
  36. package/build/actions/get-card.js.map +1 -0
  37. package/build/actions/get-specification.d.ts +6 -0
  38. package/build/actions/get-specification.d.ts.map +1 -0
  39. package/build/actions/get-specification.js +9 -0
  40. package/build/actions/get-specification.js.map +1 -0
  41. package/build/actions/index.d.ts +12 -3
  42. package/build/actions/index.d.ts.map +1 -1
  43. package/build/actions/index.js +11 -3
  44. package/build/actions/index.js.map +1 -1
  45. package/build/actions/links.d.ts +3 -3
  46. package/build/actions/links.d.ts.map +1 -1
  47. package/build/actions/links.js +6 -5
  48. package/build/actions/links.js.map +1 -1
  49. package/build/actions/list-card-specifications.d.ts +6 -0
  50. package/build/actions/list-card-specifications.d.ts.map +1 -0
  51. package/build/actions/list-card-specifications.js +11 -0
  52. package/build/actions/list-card-specifications.js.map +1 -0
  53. package/build/actions/list-card-transitions.d.ts +6 -0
  54. package/build/actions/list-card-transitions.d.ts.map +1 -0
  55. package/build/actions/list-card-transitions.js +11 -0
  56. package/build/actions/list-card-transitions.js.map +1 -0
  57. package/build/actions/list-cards.d.ts +6 -0
  58. package/build/actions/list-cards.d.ts.map +1 -0
  59. package/build/actions/list-cards.js +10 -0
  60. package/build/actions/list-cards.js.map +1 -0
  61. package/build/actions/list-schemas.d.ts +13 -0
  62. package/build/actions/list-schemas.d.ts.map +1 -0
  63. package/build/actions/list-schemas.js +20 -0
  64. package/build/actions/list-schemas.js.map +1 -0
  65. package/build/actions/list-specification-revisions.d.ts +6 -0
  66. package/build/actions/list-specification-revisions.d.ts.map +1 -0
  67. package/build/actions/list-specification-revisions.js +10 -0
  68. package/build/actions/list-specification-revisions.js.map +1 -0
  69. package/build/actions/resources.d.ts +5 -0
  70. package/build/actions/resources.d.ts.map +1 -0
  71. package/build/actions/resources.js +111 -0
  72. package/build/actions/resources.js.map +1 -0
  73. package/build/actions/summarize-cards.d.ts +6 -0
  74. package/build/actions/summarize-cards.d.ts.map +1 -0
  75. package/build/actions/summarize-cards.js +11 -0
  76. package/build/actions/summarize-cards.js.map +1 -0
  77. package/build/actions/transitions.d.ts +3 -3
  78. package/build/actions/transitions.d.ts.map +1 -1
  79. package/build/actions/transitions.js +4 -3
  80. package/build/actions/transitions.js.map +1 -1
  81. package/build/actions/types.d.ts +6 -0
  82. package/build/actions/types.d.ts.map +1 -0
  83. package/build/actions/types.js +2 -0
  84. package/build/actions/types.js.map +1 -0
  85. package/build/actions/watch.d.ts +2 -2
  86. package/build/actions/watch.d.ts.map +1 -1
  87. package/build/actions/watch.js +8 -6
  88. package/build/actions/watch.js.map +1 -1
  89. package/build/conformance/assert/types.d.ts +19 -0
  90. package/build/conformance/assert/types.d.ts.map +1 -0
  91. package/build/conformance/assert/types.js +2 -0
  92. package/build/conformance/assert/types.js.map +1 -0
  93. package/build/conformance/assert.d.ts +15 -0
  94. package/build/conformance/assert.d.ts.map +1 -0
  95. package/build/conformance/assert.js +52 -0
  96. package/build/conformance/assert.js.map +1 -0
  97. package/build/conformance/cases.d.ts +7 -0
  98. package/build/conformance/cases.d.ts.map +1 -0
  99. package/build/conformance/cases.js +544 -0
  100. package/build/conformance/cases.js.map +1 -0
  101. package/build/conformance/clock.d.ts +6 -0
  102. package/build/conformance/clock.d.ts.map +1 -0
  103. package/build/conformance/clock.js +12 -0
  104. package/build/conformance/clock.js.map +1 -0
  105. package/build/conformance/consts.d.ts +30 -0
  106. package/build/conformance/consts.d.ts.map +1 -0
  107. package/build/conformance/consts.js +159 -0
  108. package/build/conformance/consts.js.map +1 -0
  109. package/build/conformance/errors.d.ts +5 -0
  110. package/build/conformance/errors.d.ts.map +1 -0
  111. package/build/conformance/errors.js +8 -0
  112. package/build/conformance/errors.js.map +1 -0
  113. package/build/conformance/fixtures/types.d.ts +13 -0
  114. package/build/conformance/fixtures/types.d.ts.map +1 -0
  115. package/build/conformance/fixtures/types.js +2 -0
  116. package/build/conformance/fixtures/types.js.map +1 -0
  117. package/build/conformance/fixtures.d.ts +14 -0
  118. package/build/conformance/fixtures.d.ts.map +1 -0
  119. package/build/conformance/fixtures.js +26 -0
  120. package/build/conformance/fixtures.js.map +1 -0
  121. package/build/conformance/index.d.ts +15 -0
  122. package/build/conformance/index.d.ts.map +1 -0
  123. package/build/conformance/index.js +12 -0
  124. package/build/conformance/index.js.map +1 -0
  125. package/build/conformance/resources.d.ts +4 -0
  126. package/build/conformance/resources.d.ts.map +1 -0
  127. package/build/conformance/resources.js +228 -0
  128. package/build/conformance/resources.js.map +1 -0
  129. package/build/conformance/types.d.ts +18 -0
  130. package/build/conformance/types.d.ts.map +1 -0
  131. package/build/conformance/types.js +2 -0
  132. package/build/conformance/types.js.map +1 -0
  133. package/build/consts.d.ts +5 -0
  134. package/build/consts.d.ts.map +1 -1
  135. package/build/consts.js +5 -0
  136. package/build/consts.js.map +1 -1
  137. package/build/definitions.d.ts +18 -0
  138. package/build/definitions.d.ts.map +1 -0
  139. package/build/definitions.js +225 -0
  140. package/build/definitions.js.map +1 -0
  141. package/build/executor/changes/types.d.ts +36 -0
  142. package/build/executor/changes/types.d.ts.map +1 -0
  143. package/build/executor/changes/types.js +2 -0
  144. package/build/executor/changes/types.js.map +1 -0
  145. package/build/executor/changes.d.ts +3 -30
  146. package/build/executor/changes.d.ts.map +1 -1
  147. package/build/executor/changes.js +42 -51
  148. package/build/executor/changes.js.map +1 -1
  149. package/build/executor/code/types.d.ts +17 -0
  150. package/build/executor/code/types.d.ts.map +1 -0
  151. package/build/executor/code/types.js +2 -0
  152. package/build/executor/code/types.js.map +1 -0
  153. package/build/executor/code.d.ts +3 -14
  154. package/build/executor/code.d.ts.map +1 -1
  155. package/build/executor/code.js +50 -54
  156. package/build/executor/code.js.map +1 -1
  157. package/build/executor/consts.local.d.ts +5 -0
  158. package/build/executor/consts.local.d.ts.map +1 -0
  159. package/build/executor/consts.local.js +6 -0
  160. package/build/executor/consts.local.js.map +1 -0
  161. package/build/executor/creator/types.d.ts +33 -0
  162. package/build/executor/creator/types.d.ts.map +1 -0
  163. package/build/executor/creator/types.js +2 -0
  164. package/build/executor/creator/types.js.map +1 -0
  165. package/build/executor/creator.d.ts +11 -0
  166. package/build/executor/creator.d.ts.map +1 -0
  167. package/build/executor/creator.js +32 -0
  168. package/build/executor/creator.js.map +1 -0
  169. package/build/executor/resolve/types.d.ts +30 -0
  170. package/build/executor/resolve/types.d.ts.map +1 -0
  171. package/build/executor/resolve/types.js +2 -0
  172. package/build/executor/resolve/types.js.map +1 -0
  173. package/build/executor/resolve.d.ts +5 -34
  174. package/build/executor/resolve.d.ts.map +1 -1
  175. package/build/executor/resolve.js +169 -110
  176. package/build/executor/resolve.js.map +1 -1
  177. package/build/executor/types.d.ts +23 -0
  178. package/build/executor/types.d.ts.map +1 -0
  179. package/build/executor/types.js +2 -0
  180. package/build/executor/types.js.map +1 -0
  181. package/build/executor/validate.d.ts +6 -5
  182. package/build/executor/validate.d.ts.map +1 -1
  183. package/build/executor/validate.js +38 -27
  184. package/build/executor/validate.js.map +1 -1
  185. package/build/executor.d.ts +11 -7
  186. package/build/executor.d.ts.map +1 -1
  187. package/build/executor.js +27 -21
  188. package/build/executor.js.map +1 -1
  189. package/build/facade.d.ts +20 -2
  190. package/build/facade.d.ts.map +1 -1
  191. package/build/facade.js +144 -22
  192. package/build/facade.js.map +1 -1
  193. package/build/helper.d.ts +5 -9
  194. package/build/helper.d.ts.map +1 -1
  195. package/build/helper.js +12 -11
  196. package/build/helper.js.map +1 -1
  197. package/build/hierarchy/types.d.ts +20 -0
  198. package/build/hierarchy/types.d.ts.map +1 -0
  199. package/build/hierarchy/types.js +2 -0
  200. package/build/hierarchy/types.js.map +1 -0
  201. package/build/hierarchy.d.ts +5 -0
  202. package/build/hierarchy.d.ts.map +1 -0
  203. package/build/hierarchy.js +133 -0
  204. package/build/hierarchy.js.map +1 -0
  205. package/build/index.d.ts +1 -0
  206. package/build/index.d.ts.map +1 -1
  207. package/build/index.js +1 -0
  208. package/build/index.js.map +1 -1
  209. package/build/invariants/types.d.ts +6 -0
  210. package/build/invariants/types.d.ts.map +1 -0
  211. package/build/invariants/types.js +2 -0
  212. package/build/invariants/types.js.map +1 -0
  213. package/build/invariants.d.ts +5 -0
  214. package/build/invariants.d.ts.map +1 -0
  215. package/build/invariants.js +126 -0
  216. package/build/invariants.js.map +1 -0
  217. package/build/projection.d.ts +4 -10
  218. package/build/projection.d.ts.map +1 -1
  219. package/build/projection.js +7 -5
  220. package/build/projection.js.map +1 -1
  221. package/build/queue/consts.d.ts +5 -0
  222. package/build/queue/consts.d.ts.map +1 -0
  223. package/build/queue/consts.js +5 -0
  224. package/build/queue/consts.js.map +1 -0
  225. package/build/queue/declare.d.ts +5 -0
  226. package/build/queue/declare.d.ts.map +1 -0
  227. package/build/queue/declare.js +5 -0
  228. package/build/queue/declare.js.map +1 -0
  229. package/build/queue/index.d.ts +3 -18
  230. package/build/queue/index.d.ts.map +1 -1
  231. package/build/queue/index.js +2 -7
  232. package/build/queue/index.js.map +1 -1
  233. package/build/queue/types.d.ts +13 -0
  234. package/build/queue/types.d.ts.map +1 -0
  235. package/build/queue/types.js +2 -0
  236. package/build/queue/types.js.map +1 -0
  237. package/build/registry.d.ts +5 -22
  238. package/build/registry.d.ts.map +1 -1
  239. package/build/registry.js +16 -10
  240. package/build/registry.js.map +1 -1
  241. package/build/resources.d.ts +5 -0
  242. package/build/resources.d.ts.map +1 -0
  243. package/build/resources.js +287 -0
  244. package/build/resources.js.map +1 -0
  245. package/build/service.d.ts +3 -16
  246. package/build/service.d.ts.map +1 -1
  247. package/build/service.js +12 -0
  248. package/build/service.js.map +1 -1
  249. package/build/store/commits.d.ts.map +1 -1
  250. package/build/store/commits.js +3 -1
  251. package/build/store/commits.js.map +1 -1
  252. package/build/store/composite.d.ts +1 -0
  253. package/build/store/composite.d.ts.map +1 -1
  254. package/build/store/composite.js +7 -2
  255. package/build/store/composite.js.map +1 -1
  256. package/build/store/consts.local.d.ts +2 -0
  257. package/build/store/consts.local.d.ts.map +1 -0
  258. package/build/store/consts.local.js +2 -0
  259. package/build/store/consts.local.js.map +1 -0
  260. package/build/store/fold/types.d.ts +43 -0
  261. package/build/store/fold/types.d.ts.map +1 -0
  262. package/build/store/fold/types.js +2 -0
  263. package/build/store/fold/types.js.map +1 -0
  264. package/build/store/fold.d.ts +8 -30
  265. package/build/store/fold.d.ts.map +1 -1
  266. package/build/store/fold.js +190 -198
  267. package/build/store/fold.js.map +1 -1
  268. package/build/store/index.d.ts +1 -0
  269. package/build/store/index.d.ts.map +1 -1
  270. package/build/store/index.js.map +1 -1
  271. package/build/store/memory.d.ts +12 -0
  272. package/build/store/memory.d.ts.map +1 -1
  273. package/build/store/memory.js +0 -0
  274. package/build/store/memory.js.map +1 -1
  275. package/build/store/types.d.ts +15 -1
  276. package/build/store/types.d.ts.map +1 -1
  277. package/build/store/types.local.d.ts +5 -0
  278. package/build/store/types.local.d.ts.map +1 -0
  279. package/build/store/types.local.js +2 -0
  280. package/build/store/types.local.js.map +1 -0
  281. package/build/types.d.ts +126 -2
  282. package/build/types.d.ts.map +1 -1
  283. package/build/types.local.d.ts +7 -0
  284. package/build/types.local.d.ts.map +1 -0
  285. package/build/types.local.js +2 -0
  286. package/build/types.local.js.map +1 -0
  287. package/build/utils/access/types.d.ts +30 -0
  288. package/build/utils/access/types.d.ts.map +1 -0
  289. package/build/utils/access/types.js +2 -0
  290. package/build/utils/access/types.js.map +1 -0
  291. package/build/utils/access.d.ts +4 -0
  292. package/build/utils/access.d.ts.map +1 -0
  293. package/build/utils/access.js +28 -0
  294. package/build/utils/access.js.map +1 -0
  295. package/build/utils/guard/types.d.ts +23 -0
  296. package/build/utils/guard/types.d.ts.map +1 -0
  297. package/build/utils/guard/types.js +2 -0
  298. package/build/utils/guard/types.js.map +1 -0
  299. package/build/utils/guard.d.ts +7 -10
  300. package/build/utils/guard.d.ts.map +1 -1
  301. package/build/utils/guard.js +36 -32
  302. package/build/utils/guard.js.map +1 -1
  303. package/build/utils/handler/types.d.ts +26 -0
  304. package/build/utils/handler/types.d.ts.map +1 -0
  305. package/build/utils/handler/types.js +2 -0
  306. package/build/utils/handler/types.js.map +1 -0
  307. package/build/utils/handler.d.ts +6 -0
  308. package/build/utils/handler.d.ts.map +1 -0
  309. package/build/utils/handler.js +21 -0
  310. package/build/utils/handler.js.map +1 -0
  311. package/build/utils/index.d.ts +8 -0
  312. package/build/utils/index.d.ts.map +1 -1
  313. package/build/utils/index.js +3 -0
  314. package/build/utils/index.js.map +1 -1
  315. package/build/utils/request/types.d.ts +23 -0
  316. package/build/utils/request/types.d.ts.map +1 -0
  317. package/build/utils/request/types.js +2 -0
  318. package/build/utils/request/types.js.map +1 -0
  319. package/build/utils/request.d.ts +4 -0
  320. package/build/utils/request.d.ts.map +1 -0
  321. package/build/utils/request.js +27 -0
  322. package/build/utils/request.js.map +1 -0
  323. package/build/utils/scope.d.ts +17 -13
  324. package/build/utils/scope.d.ts.map +1 -1
  325. package/build/utils/scope.js +21 -35
  326. package/build/utils/scope.js.map +1 -1
  327. package/build/utils/types.d.ts +8 -0
  328. package/build/utils/types.d.ts.map +1 -0
  329. package/build/utils/types.js +2 -0
  330. package/build/utils/types.js.map +1 -0
  331. package/package.json +30 -22
  332. package/src/actions/apply-schema-request.ts +36 -0
  333. package/src/actions/commit.ts +7 -5
  334. package/src/actions/define-schemas.ts +34 -0
  335. package/src/actions/execute.ts +32 -34
  336. package/src/actions/execution/types.ts +34 -0
  337. package/src/actions/execution.ts +100 -0
  338. package/src/actions/get-card.ts +14 -0
  339. package/src/actions/get-specification.ts +14 -0
  340. package/src/actions/index.ts +13 -3
  341. package/src/actions/links.ts +8 -6
  342. package/src/actions/list-card-specifications.ts +15 -0
  343. package/src/actions/list-card-transitions.ts +15 -0
  344. package/src/actions/list-cards.ts +14 -0
  345. package/src/actions/list-schemas.ts +29 -0
  346. package/src/actions/list-specification-revisions.ts +15 -0
  347. package/src/actions/resources.ts +79 -0
  348. package/src/actions/summarize-cards.ts +15 -0
  349. package/src/actions/transitions.ts +6 -4
  350. package/src/actions/types.ts +5 -0
  351. package/src/actions/watch.ts +11 -7
  352. package/src/conformance/assert/types.ts +16 -0
  353. package/src/conformance/assert.ts +67 -0
  354. package/src/conformance/cases.ts +631 -0
  355. package/src/conformance/clock.ts +11 -0
  356. package/src/conformance/consts.ts +165 -0
  357. package/src/conformance/errors.ts +7 -0
  358. package/src/conformance/fixtures/types.ts +11 -0
  359. package/src/conformance/fixtures.ts +46 -0
  360. package/src/conformance/index.ts +14 -0
  361. package/src/conformance/resources.ts +227 -0
  362. package/src/conformance/types.ts +20 -0
  363. package/src/consts.ts +6 -0
  364. package/src/definitions.ts +264 -0
  365. package/src/executor/changes/types.ts +38 -0
  366. package/src/executor/changes.ts +49 -68
  367. package/src/executor/code/types.ts +23 -0
  368. package/src/executor/code.ts +62 -69
  369. package/src/executor/consts.local.ts +8 -0
  370. package/src/executor/creator/types.ts +33 -0
  371. package/src/executor/creator.ts +43 -0
  372. package/src/executor/resolve/types.ts +30 -0
  373. package/src/executor/resolve.ts +181 -139
  374. package/src/executor/types.ts +23 -0
  375. package/src/executor/validate.ts +40 -38
  376. package/src/executor.ts +33 -27
  377. package/src/facade.ts +132 -29
  378. package/src/helper.ts +12 -11
  379. package/src/hierarchy/types.ts +20 -0
  380. package/src/hierarchy.ts +113 -0
  381. package/src/index.ts +1 -0
  382. package/src/invariants/types.ts +6 -0
  383. package/src/invariants.ts +106 -0
  384. package/src/projection.ts +12 -18
  385. package/src/queue/consts.ts +5 -0
  386. package/src/queue/declare.ts +7 -0
  387. package/src/queue/index.ts +3 -25
  388. package/src/queue/types.ts +14 -0
  389. package/src/registry.ts +18 -36
  390. package/src/resources.ts +256 -0
  391. package/src/service.ts +16 -20
  392. package/src/store/commits.ts +5 -4
  393. package/src/store/composite.ts +7 -2
  394. package/src/store/consts.local.ts +1 -0
  395. package/src/store/fold/types.ts +44 -0
  396. package/src/store/fold.ts +214 -212
  397. package/src/store/index.ts +1 -0
  398. package/src/store/memory.ts +0 -0
  399. package/src/store/types.local.ts +3 -0
  400. package/src/store/types.ts +16 -1
  401. package/src/types.local.ts +7 -0
  402. package/src/types.ts +139 -6
  403. package/src/utils/access/types.ts +30 -0
  404. package/src/utils/access.ts +33 -0
  405. package/src/utils/guard/types.ts +21 -0
  406. package/src/utils/guard.ts +44 -31
  407. package/src/utils/handler/types.ts +28 -0
  408. package/src/utils/handler.ts +35 -0
  409. package/src/utils/index.ts +9 -0
  410. package/src/utils/request/types.ts +23 -0
  411. package/src/utils/request.ts +40 -0
  412. package/src/utils/scope.ts +39 -42
  413. package/src/utils/types.ts +8 -0
  414. package/tests/access.spec.ts +160 -0
  415. package/tests/app.spec.ts +112 -0
  416. package/tests/conformance.spec.ts +47 -0
  417. package/tests/create-example.spec.ts +202 -0
  418. package/tests/creator.spec.ts +257 -0
  419. package/tests/entrypoints.spec.ts +5 -0
  420. package/tests/memory-store.spec.ts +52 -0
  421. package/tests/narrowing.spec.ts +94 -0
  422. package/tests/plugins.spec.ts +4 -3
  423. package/tests/writes.spec.ts +140 -0
  424. package/build/actions/cards.d.ts +0 -16
  425. package/build/actions/cards.d.ts.map +0 -1
  426. package/build/actions/cards.js +0 -32
  427. package/build/actions/cards.js.map +0 -1
  428. package/build/actions/schemas.d.ts +0 -6
  429. package/build/actions/schemas.d.ts.map +0 -1
  430. package/build/actions/schemas.js +0 -9
  431. package/build/actions/schemas.js.map +0 -1
  432. package/build/actions/specs.d.ts +0 -10
  433. package/build/actions/specs.d.ts.map +0 -1
  434. package/build/actions/specs.js +0 -14
  435. package/build/actions/specs.js.map +0 -1
  436. package/src/actions/cards.ts +0 -52
  437. package/src/actions/schemas.ts +0 -15
  438. package/src/actions/specs.ts +0 -23
@@ -1,3 +1,6 @@
1
+ export * from './access.js';
1
2
  export * from './guard.js';
3
+ export * from './handler.js';
4
+ export * from './request.js';
2
5
  export * from './scope.js';
3
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAMA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,23 @@
1
+ import type { PlanningScope, TransitionActor } from '@owlmeans/planning';
2
+ import type { PlanningAccess } from '../../types.js';
3
+ /** One request's identity as planning reads it — built at the top of a handler, never stored. */
4
+ export interface RequestScope {
5
+ /** The authenticated subject of a request, as a transition names it. */
6
+ actorOf: () => TransitionActor;
7
+ /**
8
+ * The scope a request reads and writes as.
9
+ *
10
+ * `entityId` is `requireEntityKey(req)` — the resolved organization id, never a value from the
11
+ * body or the query — and `extra` cannot replace it; `extra` adds what the deployment derives
12
+ * (a `channel`, a `service`). The actor is the authenticated subject plus that channel.
13
+ *
14
+ * @throws {AuthorizationError} when the request carries no organization
15
+ */
16
+ scopeOf: (extra?: Partial<PlanningScope>) => PlanningScope;
17
+ /**
18
+ * The scope of a request under a resolved {@link PlanningAccess}: the organization is the
19
+ * resolver's — never the token's, never `extra`'s — and `projects` narrows it.
20
+ */
21
+ accessScopeOf: (access: PlanningAccess, extra?: Partial<PlanningScope>) => PlanningScope;
22
+ }
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/request/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,iGAAiG;AACjG,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,OAAO,EAAE,MAAM,eAAe,CAAA;IAC9B;;;;;;;;OAQG;IACH,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,aAAa,CAAA;IAC1D;;;OAGG;IACH,aAAa,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,aAAa,CAAA;CACzF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/request/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { AbstractRequest } from '@owlmeans/entrypoint';
2
+ import type { RequestScope } from './request/types.js';
3
+ export declare const makeRequestScope: (req: AbstractRequest) => RequestScope;
4
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/utils/request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAG3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAMtD,eAAO,MAAM,gBAAgB,QAAS,eAAe,KAAG,YA6BvD,CAAA"}
@@ -0,0 +1,27 @@
1
+ import { makeEntityScope } from '@owlmeans/auth-common';
2
+ const clean = (record) => Object.fromEntries(Object.entries(record).filter(([, value]) => value != null && value !== ''));
3
+ export const makeRequestScope = (req) => {
4
+ const actorOf = () => clean({
5
+ profileId: req.auth?.profileId,
6
+ userId: req.auth?.userId,
7
+ });
8
+ const scopeWith = (entityId, extra) => {
9
+ const subject = actorOf();
10
+ const channel = extra?.channel ?? extra?.actor?.channel;
11
+ return clean({
12
+ ...extra,
13
+ ...subject,
14
+ entityId,
15
+ channel,
16
+ actor: clean({ ...extra?.actor, ...subject, channel }),
17
+ });
18
+ };
19
+ const scopeOf = (extra) => scopeWith(makeEntityScope(req).requireEntityKey(), extra);
20
+ const accessScopeOf = (access, extra) => {
21
+ const { projects: _projects, entityId: _entityId, ...rest } = extra ?? {};
22
+ const scope = scopeWith(access.entityId, rest);
23
+ return access.projects != null ? { ...scope, projects: [...access.projects] } : scope;
24
+ };
25
+ return { actorOf, scopeOf, accessScopeOf };
26
+ };
27
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/utils/request.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,MAAM,KAAK,GAAG,CAAmB,MAAS,EAAK,EAAE,CAC/C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC,CAAM,CAAA;AAEtG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAoB,EAAgB,EAAE;IACrE,MAAM,OAAO,GAAG,GAAoB,EAAE,CAAC,KAAK,CAAC;QAC3C,SAAS,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS;QAC9B,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM;KACzB,CAAC,CAAA;IAEF,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,KAA8B,EAAiB,EAAE;QACpF,MAAM,OAAO,GAAG,OAAO,EAAE,CAAA;QACzB,MAAM,OAAO,GAAG,KAAK,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,EAAE,OAAO,CAAA;QAEvD,OAAO,KAAK,CAAC;YACX,GAAG,KAAK;YACR,GAAG,OAAO;YACV,QAAQ;YACR,OAAO;YACP,KAAK,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;SACvD,CAAkB,CAAA;IACrB,CAAC,CAAA;IAED,MAAM,OAAO,GAAG,CAAC,KAA8B,EAAiB,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE,KAAK,CAAC,CAAA;IAE5H,MAAM,aAAa,GAAG,CAAC,MAAsB,EAAE,KAA8B,EAAiB,EAAE;QAC9F,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE,CAAA;QACzE,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QAE9C,OAAO,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;IACvF,CAAC,CAAA;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAA;AAC5C,CAAC,CAAA"}
@@ -1,20 +1,24 @@
1
1
  import type { BasicConfig, BasicContext } from '@owlmeans/context';
2
2
  import type { AbstractRequest } from '@owlmeans/entrypoint';
3
- import type { PlanningFacade, PlanningScope, PlanningService, TransitionActor } from '@owlmeans/planning';
4
- import type { PlanningHandlerOptions } from '../types.js';
5
- /** The authenticated subject of a request, as a transition names it. */
3
+ import type { PlanningFacade, PlanningScope, PlanningService, TransitionActor, Workcard } from '@owlmeans/planning';
4
+ import type { PlanningAccess, PlanningAccessGrants, PlanningHandlerOptions } from '../types.js';
5
+ import type { HandlerScope } from './types.js';
6
+ /** @deprecated compat:factory-refactor — use `makeRequestScope(req).actorOf()` */
6
7
  export declare const actorOf: (req: AbstractRequest) => TransitionActor;
7
- /**
8
- * The scope a request reads and writes as.
9
- *
10
- * `entityId` is `requireEntityKey(req)` — the resolved organization id, never a value from the
11
- * body or the query — and `extra` cannot replace it; `extra` adds what the deployment derives
12
- * (a `channel`, a `service`). The actor is the authenticated subject plus that channel.
13
- *
14
- * @throws {AuthorizationError} when the request carries no organization
15
- */
8
+ /** @deprecated compat:factory-refactor — use `makeRequestScope(req).scopeOf(…)` */
16
9
  export declare const scopeOf: (req: AbstractRequest, extra?: Partial<PlanningScope>) => PlanningScope;
10
+ /** @deprecated compat:factory-refactor — use `makeRequestScope(req).accessScopeOf(…)` */
11
+ export declare const accessScopeOf: (req: AbstractRequest, access: PlanningAccess, extra?: Partial<PlanningScope>) => PlanningScope;
12
+ /** @deprecated compat:factory-refactor — use `planningHandlerOf(ctx).planningServiceOf(…)` */
17
13
  export declare const planningServiceOf: (ctx: BasicContext<BasicConfig>, opts?: Pick<PlanningHandlerOptions, 'service'>) => PlanningService;
18
- /** The facade a handler works through: the request's scope plus what `opts.scope` derives. */
14
+ /** @deprecated compat:factory-refactor — use `planningHandlerOf(ctx).handlerScopeOf(…)` */
15
+ export declare const handlerScopeOf: (ctx: BasicContext<BasicConfig>, req: AbstractRequest, opts?: PlanningHandlerOptions) => Promise<HandlerScope>;
16
+ /** @deprecated compat:factory-refactor — use `planningHandlerOf(ctx).handlerFacade(…)` */
19
17
  export declare const handlerFacade: (ctx: BasicContext<BasicConfig>, req: AbstractRequest, opts?: PlanningHandlerOptions) => Promise<PlanningFacade>;
18
+ /** @deprecated compat:factory-refactor — use `makePlanningAccessModel(access).assertGranted(…)` */
19
+ export declare const assertGranted: (access: PlanningAccess | undefined, grant: keyof PlanningAccessGrants, target?: string) => void;
20
+ /** @deprecated compat:factory-refactor — use `makePlanningAccessModel(access).writableIn(…)` */
21
+ export declare const writableIn: (access: PlanningAccess | undefined, card: Pick<Workcard, 'id' | 'parents'>) => boolean;
22
+ /** @deprecated compat:factory-refactor — use `makePlanningAccessModel(access).assertWrites(…)` */
23
+ export declare const assertWrites: (access: PlanningAccess | undefined, target?: string) => void;
20
24
  //# sourceMappingURL=scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/utils/scope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE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S,eAAe,UAAU,OAAO,CAAC,aAAa,CAAC,KAAG,aACzC,CAAA;AAEtC,yFAAyF;AACzF,eAAO,MAAM,aAAa,QACnB,eAAe,UAAU,cAAc,UAAU,OAAO,CAAC,aAAa,CAAC,KAC3E,aAAmE,CAAA;AAEtE,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,QACvB,YAAY,CAAC,WAAW,CAAC,SAAS,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,KAC7E,eAAiE,CAAA;AAEpE,2FAA2F;AAC3F,eAAO,MAAM,cAAc,QACpB,YAAY,CAAC,WAAW,CAAC,OAAO,eAAe,SAAS,sBAAsB,KAClF,OAAO,CAAC,YAAY,CAA2D,CAAA;AAElF,0FAA0F;AAC1F,eAAO,MAAM,aAAa,QACnB,YAAY,CAAC,WAAW,CAAC,OAAO,eAAe,SAAS,sBAAsB,KAClF,OAAO,CAAC,cAAc,CAA0D,CAAA;AAEnF,mGAAmG;AACnG,eAAO,MAAM,aAAa,WAChB,cAAc,GAAG,SAAS,SAAS,MAAM,oBAAoB,WAAW,MAAM,KACrF,IAAoE,CAAA;AAEvE,gGAAgG;AAChG,eAAO,MAAM,UAAU,WAAY,cAAc,GAAG,SAAS,QAAQ,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC,KAAG,OACtD,CAAA;AAElD,kGAAkG;AAClG,eAAO,MAAM,YAAY,WAAY,cAAc,GAAG,SAAS,WAAW,MAAM,KAAG,IAC7B,CAAA"}
@@ -1,36 +1,22 @@
1
- import { requireEntityKey } from '@owlmeans/auth-common';
2
- import { PLANNING_SERVICE } from '@owlmeans/planning';
3
- const clean = (record) => Object.fromEntries(Object.entries(record).filter(([, value]) => value != null && value !== ''));
4
- /** The authenticated subject of a request, as a transition names it. */
5
- export const actorOf = (req) => clean({
6
- profileId: req.auth?.profileId,
7
- userId: req.auth?.userId,
8
- });
9
- /**
10
- * The scope a request reads and writes as.
11
- *
12
- * `entityId` is `requireEntityKey(req)` — the resolved organization id, never a value from the
13
- * body or the query — and `extra` cannot replace it; `extra` adds what the deployment derives
14
- * (a `channel`, a `service`). The actor is the authenticated subject plus that channel.
15
- *
16
- * @throws {AuthorizationError} when the request carries no organization
17
- */
18
- export const scopeOf = (req, extra) => {
19
- const entityId = requireEntityKey(req);
20
- const subject = actorOf(req);
21
- const channel = extra?.channel ?? extra?.actor?.channel;
22
- return clean({
23
- ...extra,
24
- ...subject,
25
- entityId,
26
- channel,
27
- actor: clean({ ...extra?.actor, ...subject, channel }),
28
- });
29
- };
30
- export const planningServiceOf = (ctx, opts) => ctx.service(opts?.service ?? PLANNING_SERVICE);
31
- /** The facade a handler works through: the request's scope plus what `opts.scope` derives. */
32
- export const handlerFacade = async (ctx, req, opts) => {
33
- const extra = await opts?.scope?.(req, ctx);
34
- return planningServiceOf(ctx, opts).for(scopeOf(req, extra ?? undefined));
35
- };
1
+ import { makePlanningAccessModel } from './access.js';
2
+ import { planningHandlerOf } from './handler.js';
3
+ import { makeRequestScope } from './request.js';
4
+ /** @deprecated compat:factory-refactor — use `makeRequestScope(req).actorOf()` */
5
+ export const actorOf = (req) => makeRequestScope(req).actorOf();
6
+ /** @deprecated compat:factory-refactor — use `makeRequestScope(req).scopeOf(…)` */
7
+ export const scopeOf = (req, extra) => makeRequestScope(req).scopeOf(extra);
8
+ /** @deprecated compat:factory-refactor — use `makeRequestScope(req).accessScopeOf(…)` */
9
+ export const accessScopeOf = (req, access, extra) => makeRequestScope(req).accessScopeOf(access, extra);
10
+ /** @deprecated compat:factory-refactor — use `planningHandlerOf(ctx).planningServiceOf(…)` */
11
+ export const planningServiceOf = (ctx, opts) => planningHandlerOf(ctx).planningServiceOf(opts);
12
+ /** @deprecated compat:factory-refactor — use `planningHandlerOf(ctx).handlerScopeOf(…)` */
13
+ export const handlerScopeOf = async (ctx, req, opts) => await planningHandlerOf(ctx).handlerScopeOf(req, opts);
14
+ /** @deprecated compat:factory-refactor — use `planningHandlerOf(ctx).handlerFacade(…)` */
15
+ export const handlerFacade = async (ctx, req, opts) => await planningHandlerOf(ctx).handlerFacade(req, opts);
16
+ /** @deprecated compat:factory-refactor — use `makePlanningAccessModel(access).assertGranted(…)` */
17
+ export const assertGranted = (access, grant, target) => makePlanningAccessModel(access).assertGranted(grant, target);
18
+ /** @deprecated compat:factory-refactor — use `makePlanningAccessModel(access).writableIn(…)` */
19
+ export const writableIn = (access, card) => makePlanningAccessModel(access).writableIn(card);
20
+ /** @deprecated compat:factory-refactor — use `makePlanningAccessModel(access).assertWrites(…)` */
21
+ export const assertWrites = (access, target) => makePlanningAccessModel(access).assertWrites(target);
36
22
  //# sourceMappingURL=scope.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/utils/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAIrD,MAAM,KAAK,GAAG,CAAmB,MAAS,EAAK,EAAE,CAC/C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC,CAAM,CAAA;AAEtG,wEAAwE;AACxE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAoB,EAAmB,EAAE,CAAC,KAAK,CAAC;IACtE,SAAS,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS;IAC9B,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM;CACzB,CAAC,CAAA;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAoB,EAAE,KAA8B,EAAiB,EAAE;IAC7F,MAAM,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;IACtC,MAAM,OAAO,GAAG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AkG;AAClG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAkC,EAAE,MAAe,EAAQ,EAAE,CACxF,uBAAuB,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { PlanningFacade } from '@owlmeans/planning';
2
+ import type { PlanningAccess } from '../types.js';
3
+ export interface HandlerScope {
4
+ facade: PlanningFacade;
5
+ /** The resolver's answer, when the handler options carry one. */
6
+ access?: PlanningAccess;
7
+ }
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,cAAc,CAAA;IACtB,iEAAiE;IACjE,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@owlmeans/server-planning",
3
- "version": "0.1.18-rc.8",
3
+ "version": "0.1.18",
4
4
  "license": "MIT",
5
- "description": "The general planning implementation — the planning service and its plugin/middleware registry, the transition executor, the in-memory store, the protocol handlers and the commit feed.",
5
+ "description": "The general planning implementation \u2014 the planning service and its plugin/middleware registry, the transition executor, the in-memory store, the protocol handlers and the commit feed.",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "build": "tsc -b",
@@ -34,35 +34,43 @@
34
34
  "default": "./build/queue/index.js",
35
35
  "module": "./build/queue/index.js",
36
36
  "types": "./build/queue/index.d.ts"
37
+ },
38
+ "./conformance": {
39
+ "import": "./build/conformance/index.js",
40
+ "require": "./build/conformance/index.js",
41
+ "default": "./build/conformance/index.js",
42
+ "module": "./build/conformance/index.js",
43
+ "types": "./build/conformance/index.d.ts"
37
44
  }
38
45
  },
39
46
  "dependencies": {
40
- "@owlmeans/auth": "^0.1.18-rc.33",
41
- "@owlmeans/auth-common": "^0.1.18-rc.35",
42
- "@owlmeans/basic-ids": "^0.1.18-rc.32",
43
- "@owlmeans/context": "^0.1.18-rc.31",
44
- "@owlmeans/entrypoint": "^0.1.18-rc.34",
45
- "@owlmeans/error": "^0.1.18-rc.33",
46
- "@owlmeans/planning": "^0.1.18-rc.7",
47
- "@owlmeans/queue": "^0.1.18-rc.29",
48
- "@owlmeans/resource": "^0.1.18-rc.33",
49
- "@owlmeans/route": "^0.1.18-rc.32",
50
- "@owlmeans/server-api": "^0.1.18-rc.39",
51
- "@owlmeans/server-context": "^0.1.18-rc.34",
52
- "@owlmeans/server-entrypoint": "^0.1.18-rc.33",
53
- "@owlmeans/server-socket": "^0.1.18-rc.42",
54
- "@owlmeans/socket": "^0.1.18-rc.31"
47
+ "@owlmeans/auth": "^0.1.18",
48
+ "@owlmeans/auth-common": "^0.1.18",
49
+ "@owlmeans/basic-ids": "^0.1.18",
50
+ "@owlmeans/context": "^0.1.18",
51
+ "@owlmeans/entrypoint": "^0.1.18",
52
+ "@owlmeans/error": "^0.1.18",
53
+ "@owlmeans/planning": "^0.1.18",
54
+ "@owlmeans/queue": "^0.1.18",
55
+ "@owlmeans/resource": "^0.1.18",
56
+ "@owlmeans/log": "^0.1.18",
57
+ "@owlmeans/route": "^0.1.18",
58
+ "@owlmeans/server-api": "^0.1.18",
59
+ "@owlmeans/server-context": "^0.1.18",
60
+ "@owlmeans/server-entrypoint": "^0.1.18",
61
+ "@owlmeans/server-socket": "^0.1.18",
62
+ "@owlmeans/socket": "^0.1.18"
55
63
  },
56
64
  "peerDependencies": {
57
65
  "ajv": "*",
58
66
  "ajv-formats": "*"
59
67
  },
60
68
  "devDependencies": {
61
- "@owlmeans/dep-config": "workspace:*",
62
- "@owlmeans/test": "^0.1.18-rc.31",
63
- "@types/bun": "^1.4.0",
64
- "@types/node": "^26.1.0",
65
- "ajv": "^8.17.1",
69
+ "@owlmeans/dep-config": "^0.1.18",
70
+ "@owlmeans/test": "^0.1.18",
71
+ "@types/bun": "^1.4.2",
72
+ "@types/node": "^26.6.4",
73
+ "ajv": "^8.20.0",
66
74
  "ajv-formats": "^3.0.1",
67
75
  "nodemon": "^3.1.14",
68
76
  "typescript": "^7.0.2"
@@ -0,0 +1,36 @@
1
+ import { SchemaWriteMode, type PlanningDefinitions, type SchemaDefineReply, type SchemaDefineRequest, type ScopedSchemaRecord } from '@owlmeans/planning'
2
+
3
+ /**
4
+ * Apply one `schema.define` request to a facade's definitions: the declarations in the request's
5
+ * mode (flows before types), then the retirements — answering what was written and the layer as it
6
+ * resolves afterwards.
7
+ */
8
+ export const applySchemaRequest = async (
9
+ definitions: PlanningDefinitions, request: SchemaDefineRequest
10
+ ): Promise<SchemaDefineReply> => {
11
+ const layer = request.project != null ? { project: request.project } : {}
12
+ const declarations = { types: request.types ?? [], flows: request.flows ?? [], assigneeTypes: request.assigneeTypes ?? [] }
13
+ const records: ScopedSchemaRecord[] = []
14
+
15
+ switch (request.mode ?? SchemaWriteMode.Define) {
16
+ case SchemaWriteMode.Put:
17
+ for (const schema of declarations.assigneeTypes) records.push(await definitions.putAssigneeType(schema))
18
+ for (const flow of declarations.flows) {
19
+ records.push(await definitions.putFlow(flow, layer))
20
+ }
21
+ for (const type of declarations.types) {
22
+ records.push(await definitions.putType(type, layer))
23
+ }
24
+ break
25
+ case SchemaWriteMode.Seed:
26
+ records.push(...await definitions.seed(declarations, layer))
27
+ break
28
+ default:
29
+ records.push(...await definitions.define(declarations, layer))
30
+ }
31
+ for (const key of request.retire ?? []) {
32
+ records.push(await definitions.retire(key.kind, key.key, layer))
33
+ }
34
+
35
+ return { records, bundle: await definitions.bundle(request.project) }
36
+ }
@@ -2,7 +2,9 @@ import { handlers } from '@owlmeans/server-api'
2
2
  import { CommitState, MAX_COMMIT_POLL } from '@owlmeans/planning'
3
3
  import type { CommitStatus, PlanningProtocols } from '@owlmeans/planning'
4
4
  import type { Context, PlanningHandlerOptions } from '../types.js'
5
- import { clampSeconds, concealed, handlerFacade } from '../utils/index.js'
5
+ import { guardHelper } from '../utils/guard.js'
6
+ import { planningHandlerOf } from '../utils/handler.js'
7
+ import type { RequestHandler } from './types.js'
6
8
 
7
9
  /**
8
10
  * The poll tool: a commit's status, held open up to `wait` seconds (clamped to `maxPoll`).
@@ -15,13 +17,13 @@ import { clampSeconds, concealed, handlerFacade } from '../utils/index.js'
15
17
  */
16
18
  export const getCommit = (
17
19
  protocol: PlanningProtocols['commit']['get'], opts?: PlanningHandlerOptions
18
- ): ReturnType<ReturnType<typeof handlers<Context>>['request']> =>
19
- handlers<Context>().request(protocol, async (req, ctx) => concealed(async (): Promise<CommitStatus> => {
20
- const facade = await handlerFacade(ctx, req, opts)
20
+ ): RequestHandler =>
21
+ handlers<Context>().request(protocol, async (req, ctx) => guardHelper.reply(async (): Promise<CommitStatus> => {
22
+ const facade = await planningHandlerOf(ctx).handlerFacade(req, opts)
21
23
  const transition = `${req.params.transition}`
22
24
 
23
25
  let status = await facade.commits.status(transition)
24
- const wait = clampSeconds(req.query?.wait, opts?.maxPoll ?? MAX_COMMIT_POLL)
26
+ const wait = guardHelper.clampSeconds(req.query?.wait, opts?.maxPoll ?? MAX_COMMIT_POLL)
25
27
  if (status.state !== CommitState.Pending || wait <= 0) {
26
28
  return status
27
29
  }
@@ -0,0 +1,34 @@
1
+ import { handlers } from '@owlmeans/server-api'
2
+ import { PlanningUnsupported, type PlanningProtocols, type SchemaDefineReply, type SchemaDefineRequest } from '@owlmeans/planning'
3
+ import type { Context, PlanningHandlerOptions } from '../types.js'
4
+ import { makePlanningAccessModel } from '../utils/access.js'
5
+ import { guardHelper } from '../utils/guard.js'
6
+ import { planningHandlerOf } from '../utils/handler.js'
7
+ import { applySchemaRequest } from './apply-schema-request.js'
8
+ import type { RequestHandler } from './types.js'
9
+
10
+ /**
11
+ * The write of data-defined types and flows. A project layer needs the project in the access's
12
+ * `writes` when the resolver answers it; then `grants.defineSchemas` gates when the resolver answers
13
+ * grants (the organization-wide layer needs `true`, a project layer its id).
14
+ *
15
+ * @throws {PlanningUnsupported} where the store holds no data-defined schemas
16
+ * @throws {PlanningForbidden | SchemaConflict | SchemaSealed | SchemaInvalid | SchemaInUse | WorkcardNotFound}
17
+ */
18
+ export const defineSchemas = (
19
+ protocol: NonNullable<PlanningProtocols['schema']['define']>, opts?: PlanningHandlerOptions
20
+ ): RequestHandler =>
21
+ handlers<Context>().request(protocol, async (req, ctx) => guardHelper.reply(async (): Promise<SchemaDefineReply> => {
22
+ const { facade, access } = await planningHandlerOf(ctx).handlerScopeOf(req, opts)
23
+ const request = (req.body ?? {}) as SchemaDefineRequest
24
+ if (facade.definitions == null) {
25
+ throw new PlanningUnsupported('definitions')
26
+ }
27
+ const model = makePlanningAccessModel(access)
28
+ if (request.project != null) {
29
+ model.assertWrites(request.project)
30
+ }
31
+ model.assertGranted('defineSchemas', request.project)
32
+
33
+ return await applySchemaRequest(facade.definitions, request)
34
+ }))
@@ -1,47 +1,45 @@
1
1
  import { handlers } from '@owlmeans/server-api'
2
- import { DEFAULT_COMMIT_TIMEOUT, MAX_COMMIT_POLL, TransitionAction } from '@owlmeans/planning'
2
+ import { MAX_COMMIT_POLL } from '@owlmeans/planning'
3
3
  import type {
4
- ExecuteOptions, ExecuteRequest, PlanningProtocols, PlanningScope, TransitionExecution, TransitionReceiptView,
4
+ ExecuteOptions, ExecuteRequest, PlanningFacade, PlanningProtocols, PlanningScope, TransitionExecution,
5
+ TransitionReceiptView,
5
6
  } from '@owlmeans/planning'
6
- import type { Context, PlanningHandlerOptions } from '../types.js'
7
- import { concealed, handlerFacade } from '../utils/index.js'
8
-
9
- /**
10
- * What a wire execution may say. `actor` is dropped — the scope names the writer — and a create's
11
- * `createdBy` is the authenticated subject, whatever the body claimed.
12
- */
13
- export const wireExecution = (body: ExecuteRequest, scope: PlanningScope): TransitionExecution => {
14
- const { wait: _wait, timeout: _timeout, actor: _actor, ...exec } = body
15
- if (exec.action === TransitionAction.Create && exec.card != null && typeof exec.card === 'object') {
16
- const { createdBy: _createdBy, ...draft } = exec.card
17
- const subject = scope.profileId ?? scope.userId
18
- exec.card = subject != null ? { ...draft, createdBy: subject } : draft
19
- }
20
- return exec
21
- }
22
-
23
- /** `wait`/`timeout` as a server grants them: the timeout never holds a request past `maxPoll`. */
24
- export const executeOptionsOf = (body: Pick<ExecuteRequest, 'wait' | 'timeout'>, maxPoll: number): ExecuteOptions => {
25
- const ceiling = maxPoll * 1000
26
- if (body.wait !== true) {
27
- return {}
28
- }
29
- const asked = Number(body.timeout ?? DEFAULT_COMMIT_TIMEOUT)
30
- return { wait: true, timeout: Math.min(Number.isFinite(asked) && asked > 0 ? asked : DEFAULT_COMMIT_TIMEOUT, ceiling) }
31
- }
7
+ import type { Context, PlanningAccess, PlanningHandlerOptions } from '../types.js'
8
+ import { guardHelper } from '../utils/guard.js'
9
+ import { planningHandlerOf } from '../utils/handler.js'
10
+ import { executionHelper } from './execution.js'
11
+ import type { RequestHandler } from './types.js'
32
12
 
33
13
  /** The one write route. */
34
14
  export const executePlanning = (
35
15
  protocol: PlanningProtocols['execute'], opts?: PlanningHandlerOptions
36
- ): ReturnType<ReturnType<typeof handlers<Context>>['request']> =>
37
- handlers<Context>().request(protocol, async (req, ctx) => concealed(async (): Promise<TransitionReceiptView> => {
38
- const facade = await handlerFacade(ctx, req, opts)
16
+ ): RequestHandler =>
17
+ handlers<Context>().request(protocol, async (req, ctx) => guardHelper.reply(async (): Promise<TransitionReceiptView> => {
18
+ const { facade, access } = await planningHandlerOf(ctx).handlerScopeOf(req, opts)
39
19
  const body = (req.body ?? {}) as ExecuteRequest
40
- const receipt = await facade.execute(
41
- wireExecution(body, facade.scope), executeOptionsOf(body, opts?.maxPoll ?? MAX_COMMIT_POLL)
42
- )
20
+ const exec = executionHelper.wireExecution(body, facade.scope)
21
+ await executionHelper.assertExecutionGranted(facade, exec, access)
22
+ const receipt = await facade.execute(exec, executionHelper.executeOptionsOf(body, opts?.maxPoll ?? MAX_COMMIT_POLL))
43
23
 
44
24
  return receipt.card !== undefined
45
25
  ? { transition: receipt.transition, card: receipt.card }
46
26
  : { transition: receipt.transition }
47
27
  }))
28
+
29
+ /** @deprecated compat:factory-refactor — use `executionHelper.wireExecution(…)` */
30
+ export const wireExecution = (body: ExecuteRequest, scope: PlanningScope): TransitionExecution =>
31
+ executionHelper.wireExecution(body, scope)
32
+
33
+ /** @deprecated compat:factory-refactor — use `executionHelper.executeOptionsOf(…)` */
34
+ export const executeOptionsOf = (body: Pick<ExecuteRequest, 'wait' | 'timeout'>, maxPoll: number): ExecuteOptions =>
35
+ executionHelper.executeOptionsOf(body, maxPoll)
36
+
37
+ /** @deprecated compat:factory-refactor — use `executionHelper.assertExecutionWrites(…)` */
38
+ export const assertExecutionWrites = async (
39
+ facade: PlanningFacade, exec: TransitionExecution, access?: PlanningAccess
40
+ ): Promise<void> => await executionHelper.assertExecutionWrites(facade, exec, access)
41
+
42
+ /** @deprecated compat:factory-refactor — use `executionHelper.assertExecutionGranted(…)` */
43
+ export const assertExecutionGranted = async (
44
+ facade: PlanningFacade, exec: TransitionExecution, access?: PlanningAccess
45
+ ): Promise<void> => await executionHelper.assertExecutionGranted(facade, exec, access)
@@ -0,0 +1,34 @@
1
+ import type { ExecuteOptions, ExecuteRequest, PlanningFacade, PlanningScope, TransitionExecution } from '@owlmeans/planning'
2
+ import type { PlanningAccess } from '../../types.js'
3
+
4
+ /** What a wire execution may say, how long it may hold, and what access it needs. */
5
+ export interface ExecutionHelper {
6
+ /**
7
+ * What a wire execution may say. `actor` is dropped — the scope names the writer — and a create's
8
+ * `createdBy` claim is dropped too: the executor's `creatorHelper.withCreator` stamps the
9
+ * authenticated subject, the same rule an in-process create follows. Applied here as well, so the
10
+ * returned execution already carries it. A `createdBy` in `changes` or `unset` is not dropped: the
11
+ * executor refuses it on every action (`assertCreatorFixed`), so no body moves an owner.
12
+ */
13
+ wireExecution: (body: ExecuteRequest, scope: PlanningScope) => TransitionExecution
14
+ /** `wait`/`timeout` as a server grants them: the timeout never holds a request past `maxPoll`. */
15
+ executeOptionsOf: (body: Pick<ExecuteRequest, 'wait' | 'timeout'>, maxPoll: number) => ExecuteOptions
16
+ /**
17
+ * Refuse an execution outside the access's `writes`: the card it acts on (a specification through
18
+ * its parent card), or every parent a create names, must be one `writableIn` admits. A create
19
+ * of a project is `grants.createProjects`' alone. A card or parent this scope cannot see is left to
20
+ * the executor, which answers it as absent.
21
+ *
22
+ * @throws {PlanningForbidden}
23
+ */
24
+ assertExecutionWrites: (facade: PlanningFacade, exec: TransitionExecution, access?: PlanningAccess) => Promise<void>
25
+ /**
26
+ * The access a wire execution needs. `writes` first ({@link ExecutionHelper.assertExecutionWrites});
27
+ * then the grants: `createProjects` for a project create (its primary parent, or the root),
28
+ * `deleteProjects` for the delete of a project card. A card this scope cannot see is left to the
29
+ * executor, which answers it as absent.
30
+ *
31
+ * @throws {PlanningForbidden}
32
+ */
33
+ assertExecutionGranted: (facade: PlanningFacade, exec: TransitionExecution, access?: PlanningAccess) => Promise<void>
34
+ }