@ontrails/core 1.0.0-beta.15 → 1.0.0-beta.16

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 (348) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +61 -16
  3. package/package.json +9 -8
  4. package/src/activation-provenance.ts +111 -0
  5. package/src/activation-source-compatibility.ts +430 -0
  6. package/src/activation-source-projection.ts +221 -0
  7. package/src/activation-source.ts +91 -0
  8. package/src/blob-ref.ts +51 -0
  9. package/src/context.ts +4 -0
  10. package/src/{internal/cross-batch.ts → cross-batch.ts} +3 -11
  11. package/src/detours.ts +8 -0
  12. package/src/draft.ts +4 -0
  13. package/src/error-projection.ts +51 -0
  14. package/src/errors.ts +192 -39
  15. package/src/execute.ts +443 -44
  16. package/src/fire.ts +965 -91
  17. package/src/index.ts +285 -38
  18. package/src/layer-projection.ts +192 -0
  19. package/src/layer.ts +32 -1
  20. package/src/observe.ts +361 -0
  21. package/src/permits.ts +12 -0
  22. package/src/redaction/patterns.ts +6 -3
  23. package/src/resilience.ts +8 -8
  24. package/src/resource-config.ts +477 -44
  25. package/src/resource.ts +21 -1
  26. package/src/result.ts +18 -0
  27. package/src/run.ts +2 -2
  28. package/src/schedule-runtime.ts +689 -0
  29. package/src/schedule.ts +324 -0
  30. package/src/serialization.ts +90 -57
  31. package/src/signal-diagnostics.ts +633 -0
  32. package/src/{internal/signal-ref.ts → signal-ref.ts} +1 -1
  33. package/src/signal.ts +37 -0
  34. package/src/store/accessor-protocol.ts +5 -5
  35. package/src/structured-examples.ts +245 -0
  36. package/src/surface-derivation.ts +91 -0
  37. package/src/surface-filter.ts +7 -13
  38. package/src/topo.ts +386 -6
  39. package/src/tracing.ts +345 -0
  40. package/src/trail.ts +168 -22
  41. package/src/trails/derive-trail.ts +1 -1
  42. package/src/trails/ingest.ts +7 -15
  43. package/src/{internal/trails-db.ts → trails-db.ts} +42 -21
  44. package/src/transport-error-map.ts +146 -28
  45. package/src/types.ts +82 -28
  46. package/src/validate-established-topo.ts +6 -0
  47. package/src/validate-topo.ts +212 -5
  48. package/src/validation.ts +58 -1
  49. package/src/webhook.ts +276 -0
  50. package/src/{internal/zod-wrappers.ts → zod-wrappers.ts} +0 -6
  51. package/.turbo/turbo-build.log +0 -1
  52. package/.turbo/turbo-lint.log +0 -3
  53. package/.turbo/turbo-typecheck.log +0 -1
  54. package/dist/blob-ref.d.ts +0 -20
  55. package/dist/blob-ref.d.ts.map +0 -1
  56. package/dist/blob-ref.js +0 -22
  57. package/dist/blob-ref.js.map +0 -1
  58. package/dist/branded.d.ts +0 -36
  59. package/dist/branded.d.ts.map +0 -1
  60. package/dist/branded.js +0 -89
  61. package/dist/branded.js.map +0 -1
  62. package/dist/collections.d.ts +0 -31
  63. package/dist/collections.d.ts.map +0 -1
  64. package/dist/collections.js +0 -60
  65. package/dist/collections.js.map +0 -1
  66. package/dist/context.d.ts +0 -22
  67. package/dist/context.d.ts.map +0 -1
  68. package/dist/context.js +0 -37
  69. package/dist/context.js.map +0 -1
  70. package/dist/contour.d.ts +0 -81
  71. package/dist/contour.d.ts.map +0 -1
  72. package/dist/contour.js +0 -176
  73. package/dist/contour.js.map +0 -1
  74. package/dist/cross-schema.d.ts +0 -18
  75. package/dist/cross-schema.d.ts.map +0 -1
  76. package/dist/cross-schema.js +0 -29
  77. package/dist/cross-schema.js.map +0 -1
  78. package/dist/derive.d.ts +0 -44
  79. package/dist/derive.d.ts.map +0 -1
  80. package/dist/derive.js +0 -149
  81. package/dist/derive.js.map +0 -1
  82. package/dist/draft.d.ts +0 -28
  83. package/dist/draft.d.ts.map +0 -1
  84. package/dist/draft.js +0 -157
  85. package/dist/draft.js.map +0 -1
  86. package/dist/errors.d.ts +0 -141
  87. package/dist/errors.d.ts.map +0 -1
  88. package/dist/errors.js +0 -185
  89. package/dist/errors.js.map +0 -1
  90. package/dist/execute.d.ts +0 -52
  91. package/dist/execute.d.ts.map +0 -1
  92. package/dist/execute.js +0 -511
  93. package/dist/execute.js.map +0 -1
  94. package/dist/fetch.d.ts +0 -15
  95. package/dist/fetch.d.ts.map +0 -1
  96. package/dist/fetch.js +0 -102
  97. package/dist/fetch.js.map +0 -1
  98. package/dist/fire.d.ts +0 -43
  99. package/dist/fire.d.ts.map +0 -1
  100. package/dist/fire.js +0 -185
  101. package/dist/fire.js.map +0 -1
  102. package/dist/guards.d.ts +0 -17
  103. package/dist/guards.d.ts.map +0 -1
  104. package/dist/guards.js +0 -25
  105. package/dist/guards.js.map +0 -1
  106. package/dist/index.d.ts +0 -59
  107. package/dist/index.d.ts.map +0 -1
  108. package/dist/index.js +0 -61
  109. package/dist/index.js.map +0 -1
  110. package/dist/internal/cross-batch.d.ts +0 -44
  111. package/dist/internal/cross-batch.d.ts.map +0 -1
  112. package/dist/internal/cross-batch.js +0 -58
  113. package/dist/internal/cross-batch.js.map +0 -1
  114. package/dist/internal/fork-ctx.d.ts +0 -41
  115. package/dist/internal/fork-ctx.d.ts.map +0 -1
  116. package/dist/internal/fork-ctx.js +0 -47
  117. package/dist/internal/fork-ctx.js.map +0 -1
  118. package/dist/internal/signal-ref.d.ts +0 -15
  119. package/dist/internal/signal-ref.d.ts.map +0 -1
  120. package/dist/internal/signal-ref.js +0 -41
  121. package/dist/internal/signal-ref.js.map +0 -1
  122. package/dist/internal/topo-saves.d.ts +0 -53
  123. package/dist/internal/topo-saves.d.ts.map +0 -1
  124. package/dist/internal/topo-saves.js +0 -449
  125. package/dist/internal/topo-saves.js.map +0 -1
  126. package/dist/internal/topo-snapshots.d.ts +0 -57
  127. package/dist/internal/topo-snapshots.d.ts.map +0 -1
  128. package/dist/internal/topo-snapshots.js +0 -372
  129. package/dist/internal/topo-snapshots.js.map +0 -1
  130. package/dist/internal/topo-store-read.d.ts +0 -70
  131. package/dist/internal/topo-store-read.d.ts.map +0 -1
  132. package/dist/internal/topo-store-read.js +0 -221
  133. package/dist/internal/topo-store-read.js.map +0 -1
  134. package/dist/internal/topo-store.d.ts +0 -26
  135. package/dist/internal/topo-store.d.ts.map +0 -1
  136. package/dist/internal/topo-store.js +0 -621
  137. package/dist/internal/topo-store.js.map +0 -1
  138. package/dist/internal/tracing.d.ts +0 -98
  139. package/dist/internal/tracing.d.ts.map +0 -1
  140. package/dist/internal/tracing.js +0 -102
  141. package/dist/internal/tracing.js.map +0 -1
  142. package/dist/internal/trails-db.d.ts +0 -16
  143. package/dist/internal/trails-db.d.ts.map +0 -1
  144. package/dist/internal/trails-db.js +0 -118
  145. package/dist/internal/trails-db.js.map +0 -1
  146. package/dist/internal/zod-wrappers.d.ts +0 -40
  147. package/dist/internal/zod-wrappers.d.ts.map +0 -1
  148. package/dist/internal/zod-wrappers.js +0 -59
  149. package/dist/internal/zod-wrappers.js.map +0 -1
  150. package/dist/layer.d.ts +0 -23
  151. package/dist/layer.d.ts.map +0 -1
  152. package/dist/layer.js +0 -21
  153. package/dist/layer.js.map +0 -1
  154. package/dist/path-security.d.ts +0 -28
  155. package/dist/path-security.d.ts.map +0 -1
  156. package/dist/path-security.js +0 -63
  157. package/dist/path-security.js.map +0 -1
  158. package/dist/patterns/bulk.d.ts +0 -15
  159. package/dist/patterns/bulk.d.ts.map +0 -1
  160. package/dist/patterns/bulk.js +0 -14
  161. package/dist/patterns/bulk.js.map +0 -1
  162. package/dist/patterns/change.d.ts +0 -10
  163. package/dist/patterns/change.d.ts.map +0 -1
  164. package/dist/patterns/change.js +0 -10
  165. package/dist/patterns/change.js.map +0 -1
  166. package/dist/patterns/date-range.d.ts +0 -10
  167. package/dist/patterns/date-range.d.ts.map +0 -1
  168. package/dist/patterns/date-range.js +0 -10
  169. package/dist/patterns/date-range.js.map +0 -1
  170. package/dist/patterns/index.d.ts +0 -9
  171. package/dist/patterns/index.d.ts.map +0 -1
  172. package/dist/patterns/index.js +0 -9
  173. package/dist/patterns/index.js.map +0 -1
  174. package/dist/patterns/pagination.d.ts +0 -18
  175. package/dist/patterns/pagination.d.ts.map +0 -1
  176. package/dist/patterns/pagination.js +0 -18
  177. package/dist/patterns/pagination.js.map +0 -1
  178. package/dist/patterns/progress.d.ts +0 -11
  179. package/dist/patterns/progress.d.ts.map +0 -1
  180. package/dist/patterns/progress.js +0 -11
  181. package/dist/patterns/progress.js.map +0 -1
  182. package/dist/patterns/sorting.d.ts +0 -13
  183. package/dist/patterns/sorting.d.ts.map +0 -1
  184. package/dist/patterns/sorting.js +0 -10
  185. package/dist/patterns/sorting.js.map +0 -1
  186. package/dist/patterns/status.d.ts +0 -15
  187. package/dist/patterns/status.d.ts.map +0 -1
  188. package/dist/patterns/status.js +0 -9
  189. package/dist/patterns/status.js.map +0 -1
  190. package/dist/patterns/timestamps.d.ts +0 -10
  191. package/dist/patterns/timestamps.d.ts.map +0 -1
  192. package/dist/patterns/timestamps.js +0 -10
  193. package/dist/patterns/timestamps.js.map +0 -1
  194. package/dist/redaction/index.d.ts +0 -4
  195. package/dist/redaction/index.d.ts.map +0 -1
  196. package/dist/redaction/index.js +0 -3
  197. package/dist/redaction/index.js.map +0 -1
  198. package/dist/redaction/patterns.d.ts +0 -9
  199. package/dist/redaction/patterns.d.ts.map +0 -1
  200. package/dist/redaction/patterns.js +0 -39
  201. package/dist/redaction/patterns.js.map +0 -1
  202. package/dist/redaction/redactor.d.ts +0 -27
  203. package/dist/redaction/redactor.d.ts.map +0 -1
  204. package/dist/redaction/redactor.js +0 -89
  205. package/dist/redaction/redactor.js.map +0 -1
  206. package/dist/resilience.d.ts +0 -34
  207. package/dist/resilience.d.ts.map +0 -1
  208. package/dist/resilience.js +0 -164
  209. package/dist/resilience.js.map +0 -1
  210. package/dist/resource-config.d.ts +0 -22
  211. package/dist/resource-config.d.ts.map +0 -1
  212. package/dist/resource-config.js +0 -210
  213. package/dist/resource-config.js.map +0 -1
  214. package/dist/resource.d.ts +0 -74
  215. package/dist/resource.d.ts.map +0 -1
  216. package/dist/resource.js +0 -61
  217. package/dist/resource.js.map +0 -1
  218. package/dist/result.d.ts +0 -57
  219. package/dist/result.d.ts.map +0 -1
  220. package/dist/result.js +0 -156
  221. package/dist/result.js.map +0 -1
  222. package/dist/run.d.ts +0 -28
  223. package/dist/run.d.ts.map +0 -1
  224. package/dist/run.js +0 -35
  225. package/dist/run.js.map +0 -1
  226. package/dist/serialization.d.ts +0 -27
  227. package/dist/serialization.d.ts.map +0 -1
  228. package/dist/serialization.js +0 -154
  229. package/dist/serialization.js.map +0 -1
  230. package/dist/signal.d.ts +0 -33
  231. package/dist/signal.d.ts.map +0 -1
  232. package/dist/signal.js +0 -17
  233. package/dist/signal.js.map +0 -1
  234. package/dist/store/accessor-protocol.d.ts +0 -51
  235. package/dist/store/accessor-protocol.d.ts.map +0 -1
  236. package/dist/store/accessor-protocol.js +0 -2
  237. package/dist/store/accessor-protocol.js.map +0 -1
  238. package/dist/store/index.d.ts +0 -2
  239. package/dist/store/index.d.ts.map +0 -1
  240. package/dist/store/index.js +0 -2
  241. package/dist/store/index.js.map +0 -1
  242. package/dist/surface-filter.d.ts +0 -13
  243. package/dist/surface-filter.d.ts.map +0 -1
  244. package/dist/surface-filter.js +0 -76
  245. package/dist/surface-filter.js.map +0 -1
  246. package/dist/topo-store.d.ts +0 -62
  247. package/dist/topo-store.d.ts.map +0 -1
  248. package/dist/topo-store.js +0 -319
  249. package/dist/topo-store.js.map +0 -1
  250. package/dist/topo.d.ts +0 -39
  251. package/dist/topo.d.ts.map +0 -1
  252. package/dist/topo.js +0 -241
  253. package/dist/topo.js.map +0 -1
  254. package/dist/trail.d.ts +0 -163
  255. package/dist/trail.d.ts.map +0 -1
  256. package/dist/trail.js +0 -75
  257. package/dist/trail.js.map +0 -1
  258. package/dist/trails/derive-trail.d.ts +0 -66
  259. package/dist/trails/derive-trail.d.ts.map +0 -1
  260. package/dist/trails/derive-trail.js +0 -378
  261. package/dist/trails/derive-trail.js.map +0 -1
  262. package/dist/trails/index.d.ts +0 -5
  263. package/dist/trails/index.d.ts.map +0 -1
  264. package/dist/trails/index.js +0 -3
  265. package/dist/trails/index.js.map +0 -1
  266. package/dist/trails/ingest.d.ts +0 -24
  267. package/dist/trails/ingest.d.ts.map +0 -1
  268. package/dist/trails/ingest.js +0 -63
  269. package/dist/trails/ingest.js.map +0 -1
  270. package/dist/transport-error-map.d.ts +0 -106
  271. package/dist/transport-error-map.d.ts.map +0 -1
  272. package/dist/transport-error-map.js +0 -24
  273. package/dist/transport-error-map.js.map +0 -1
  274. package/dist/type-checks.test-d.d.ts +0 -71
  275. package/dist/type-checks.test-d.d.ts.map +0 -1
  276. package/dist/type-checks.test-d.js +0 -12
  277. package/dist/type-checks.test-d.js.map +0 -1
  278. package/dist/type-utils.d.ts +0 -33
  279. package/dist/type-utils.d.ts.map +0 -1
  280. package/dist/type-utils.js +0 -12
  281. package/dist/type-utils.js.map +0 -1
  282. package/dist/types.d.ts +0 -177
  283. package/dist/types.d.ts.map +0 -1
  284. package/dist/types.js +0 -3
  285. package/dist/types.js.map +0 -1
  286. package/dist/validate-established-topo.d.ts +0 -76
  287. package/dist/validate-established-topo.d.ts.map +0 -1
  288. package/dist/validate-established-topo.js +0 -43
  289. package/dist/validate-established-topo.js.map +0 -1
  290. package/dist/validate-topo.d.ts +0 -24
  291. package/dist/validate-topo.d.ts.map +0 -1
  292. package/dist/validate-topo.js +0 -193
  293. package/dist/validate-topo.js.map +0 -1
  294. package/dist/validation.d.ts +0 -27
  295. package/dist/validation.d.ts.map +0 -1
  296. package/dist/validation.js +0 -165
  297. package/dist/validation.js.map +0 -1
  298. package/dist/workspace.d.ts +0 -25
  299. package/dist/workspace.d.ts.map +0 -1
  300. package/dist/workspace.js +0 -57
  301. package/dist/workspace.js.map +0 -1
  302. package/src/__tests__/blob-ref.test.ts +0 -103
  303. package/src/__tests__/branded.test.ts +0 -148
  304. package/src/__tests__/collections.test.ts +0 -126
  305. package/src/__tests__/context.test.ts +0 -77
  306. package/src/__tests__/contour.test.ts +0 -263
  307. package/src/__tests__/derive-trail.test.ts +0 -668
  308. package/src/__tests__/derive.test.ts +0 -260
  309. package/src/__tests__/errors.test.ts +0 -427
  310. package/src/__tests__/execute.test.ts +0 -1563
  311. package/src/__tests__/fetch.test.ts +0 -217
  312. package/src/__tests__/fire.test.ts +0 -1056
  313. package/src/__tests__/fork-ctx.test.ts +0 -83
  314. package/src/__tests__/guards.test.ts +0 -102
  315. package/src/__tests__/ingest.test.ts +0 -191
  316. package/src/__tests__/layer.test.ts +0 -125
  317. package/src/__tests__/path-security.test.ts +0 -114
  318. package/src/__tests__/patterns.test.ts +0 -273
  319. package/src/__tests__/redaction.test.ts +0 -244
  320. package/src/__tests__/resilience.test.ts +0 -246
  321. package/src/__tests__/resource.test.ts +0 -204
  322. package/src/__tests__/result.test.ts +0 -155
  323. package/src/__tests__/run.test.ts +0 -181
  324. package/src/__tests__/serialization.test.ts +0 -401
  325. package/src/__tests__/service-config.test.ts +0 -224
  326. package/src/__tests__/signal.test.ts +0 -82
  327. package/src/__tests__/surface-filter.test.ts +0 -196
  328. package/src/__tests__/topo-store-read.test.ts +0 -256
  329. package/src/__tests__/topo-store.test.ts +0 -869
  330. package/src/__tests__/topo.test.ts +0 -573
  331. package/src/__tests__/trail-permit.test.ts +0 -60
  332. package/src/__tests__/trail.test.ts +0 -426
  333. package/src/__tests__/trails-db.test.ts +0 -198
  334. package/src/__tests__/transport-error-map.test.ts +0 -82
  335. package/src/__tests__/type-utils.test.ts +0 -118
  336. package/src/__tests__/validate-topo.test.ts +0 -611
  337. package/src/__tests__/validation.test.ts +0 -336
  338. package/src/__tests__/workspace.test.ts +0 -183
  339. package/src/__tests__/zod-wrappers.test.ts +0 -62
  340. package/src/internal/topo-snapshots.ts +0 -517
  341. package/src/internal/topo-store-read.ts +0 -481
  342. package/src/internal/topo-store.ts +0 -1192
  343. package/src/internal/tracing.ts +0 -187
  344. package/src/topo-store.ts +0 -510
  345. package/src/type-checks.test-d.ts +0 -106
  346. package/tsconfig.json +0 -9
  347. package/tsconfig.tests.json +0 -10
  348. package/tsconfig.tsbuildinfo +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"transport-error-map.js","sourceRoot":"","sources":["../src/transport-error-map.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAuB9D,MAAM,CAAC,MAAM,0BAA0B,GACrC,CAAI,QAAmC,EAA2B,EAAE,CACpE,CAAC,KAAK,EAAE,EAAE,CACR,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAE7B,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,cAAc;CACqD,CAAC;AAE3E,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,GAAG,EAAE;QACH,GAAG,EAAE,0BAA0B,CAAC,iBAAiB,CAAC,GAAG,CAAC;QACtD,MAAM,EAAE,iBAAiB,CAAC,GAAG;KAC9B;IACD,IAAI,EAAE;QACJ,GAAG,EAAE,0BAA0B,CAAC,iBAAiB,CAAC,IAAI,CAAC;QACvD,MAAM,EAAE,iBAAiB,CAAC,IAAI;KAC/B;IACD,GAAG,EAAE;QACH,GAAG,EAAE,0BAA0B,CAAC,iBAAiB,CAAC,GAAG,CAAC;QACtD,MAAM,EAAE,iBAAiB,CAAC,GAAG;KAC9B;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,SAAwB,EACxB,KAAkB,EACE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,71 +0,0 @@
1
- /**
2
- * Compile-time type assertions for type-utils.
3
- *
4
- * This file lives in src/ (not __tests__/) so it is included in the
5
- * typecheck pass. It contains no runtime code — only type-level
6
- * assertions that fail the build when type inference regresses.
7
- *
8
- * Assertion types are exported to satisfy `noUnusedLocals` but are not
9
- * re-exported from the package index.
10
- */
11
- import type { Trail } from './trail.js';
12
- import type { CrossInput, TrailInput } from './type-utils.js';
13
- /** A trail with crossInput declared. */
14
- type CrossTrail = Trail<{
15
- name: string;
16
- }, {
17
- id: string;
18
- }, {
19
- forkedFrom: string;
20
- }>;
21
- /** A trail without crossInput. */
22
- type PlainTrail = Trail<{
23
- name: string;
24
- }, {
25
- id: string;
26
- }>;
27
- type WithCrossInput = CrossInput<CrossTrail>;
28
- type AssertMerged = WithCrossInput extends {
29
- name: string;
30
- forkedFrom: string;
31
- } ? true : false;
32
- export type Merged = [AssertMerged] extends [true] ? 'pass' : never;
33
- type WithoutCrossInput = CrossInput<PlainTrail>;
34
- type BaseInput = TrailInput<PlainTrail>;
35
- type AssertFallback1 = WithoutCrossInput extends BaseInput ? true : false;
36
- type AssertFallback2 = BaseInput extends WithoutCrossInput ? true : false;
37
- export type Fallback = [AssertFallback1, AssertFallback2] extends [true, true] ? 'pass' : never;
38
- /**
39
- * When a trail has crossInput, the blaze's first parameter must include
40
- * both the public input fields AND the crossInput fields. Before the fix,
41
- * blaze was typed as Implementation<I, O>, losing the CI fields.
42
- */
43
- type CrossBlazeParam = Parameters<CrossTrail['blaze']>[0];
44
- type AssertBlazeHasCrossFields = CrossBlazeParam extends {
45
- name: string;
46
- forkedFrom: string;
47
- } ? true : false;
48
- export type BlazeWithCross = [AssertBlazeHasCrossFields] extends [true] ? 'pass' : never;
49
- type PlainBlazeParam = Parameters<PlainTrail['blaze']>[0];
50
- type AssertPlainBlazeIsInput = PlainBlazeParam extends {
51
- name: string;
52
- } ? true : false;
53
- type AssertPlainBlazeNoExtra = {
54
- name: string;
55
- } extends PlainBlazeParam ? true : false;
56
- export type BlazeWithoutCross = [
57
- AssertPlainBlazeIsInput,
58
- AssertPlainBlazeNoExtra
59
- ] extends [true, true] ? 'pass' : never;
60
- type AssertDefault = Trail<{
61
- x: number;
62
- }, {
63
- y: number;
64
- }> extends Trail<{
65
- x: number;
66
- }, {
67
- y: number;
68
- }, never> ? true : false;
69
- export type Default = [AssertDefault] extends [true] ? 'pass' : never;
70
- export {};
71
- //# sourceMappingURL=type-checks.test-d.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type-checks.test-d.d.ts","sourceRoot":"","sources":["../src/type-checks.test-d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAM9D,wCAAwC;AACxC,KAAK,UAAU,GAAG,KAAK,CACrB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAChB;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EACd;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CACvB,CAAC;AAEF,kCAAkC;AAClC,KAAK,UAAU,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAM1D,KAAK,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;AAI7C,KAAK,YAAY,GAAG,cAAc,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC3E,IAAI,GACJ,KAAK,CAAC;AACV,MAAM,MAAM,MAAM,GAAG,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;AAMpE,KAAK,iBAAiB,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;AAChD,KAAK,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;AAGxC,KAAK,eAAe,GAAG,iBAAiB,SAAS,SAAS,GAAG,IAAI,GAAG,KAAK,CAAC;AAC1E,KAAK,eAAe,GAAG,SAAS,SAAS,iBAAiB,GAAG,IA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SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Compile-time type assertions for type-utils.
3
- *
4
- * This file lives in src/ (not __tests__/) so it is included in the
5
- * typecheck pass. It contains no runtime code — only type-level
6
- * assertions that fail the build when type inference regresses.
7
- *
8
- * Assertion types are exported to satisfy `noUnusedLocals` but are not
9
- * re-exported from the package index.
10
- */
11
- export {};
12
- //# sourceMappingURL=type-checks.test-d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type-checks.test-d.js","sourceRoot":"","sources":["../src/type-checks.test-d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -1,33 +0,0 @@
1
- /**
2
- * Type utilities for extracting input/output types from trails.
3
- */
4
- import type { Result } from './result.js';
5
- import type { AnyTrail, Trail } from './trail.js';
6
- /** Extract the input type from a Trail. */
7
- export type TrailInput<T extends AnyTrail> = T extends Trail<infer I, any, any> ? I : never;
8
- /** Extract the output type from a Trail. */
9
- export type TrailOutput<T extends AnyTrail> = T extends Trail<any, infer O, any> ? O : never;
10
- /**
11
- * Extract the cross-callable input type from a trail.
12
- *
13
- * When a trail declares `crossInput`, callers via `ctx.cross()` must pass
14
- * both the public input fields and the composition-only fields. This type
15
- * merges both schemas so the compiler enforces the full shape at the call
16
- * site. Falls back to plain `TrailInput<T>` when no `crossInput` exists.
17
- */
18
- export type CrossInput<T extends AnyTrail> = T extends Trail<infer I, any, infer CI> ? [CI] extends [never] ? I : I & CI : never;
19
- /**
20
- * Extracts the full `Result<Output, Error>` type from a trail definition.
21
- *
22
- * @example
23
- * ```typescript
24
- * type SearchResult = TrailResult<typeof searchTrail>;
25
- * // Result<{ results: Item[]; count: number }, Error>
26
- * ```
27
- */
28
- export type TrailResult<T extends AnyTrail> = Result<TrailOutput<T>, Error>;
29
- /** Get the input Zod schema from a trail, preserving the specific schema type. */
30
- export declare const inputOf: <T extends AnyTrail>(trail: T) => T["input"];
31
- /** Get the output Zod schema from a trail, if defined, preserving the specific schema type. */
32
- export declare const outputOf: <T extends AnyTrail>(trail: T) => T["output"];
33
- //# sourceMappingURL=type-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAQlD,2CAA2C;AAC3C,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,QAAQ,IACvC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEjD,4CAA4C;AAC5C,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,QAAQ,IACxC,CAAC,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,QAAQ,IACvC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,GACnC,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,GAClB,CAAC,GACD,CAAC,GAAG,EAAE,GACR,KAAK,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,QAAQ,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAQ5E,kFAAkF;AAClF,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,QAAQ,EAAE,OAAO,CAAC,KAAG,CAAC,CAAC,OAAO,CACnD,CAAC;AAEd,+FAA+F;AAC/F,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,QAAQ,EAAE,OAAO,CAAC,KAAG,CAAC,CAAC,QAAQ,CACpD,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Type utilities for extracting input/output types from trails.
3
- */
4
- /* oxlint-enable no-explicit-any */
5
- // ---------------------------------------------------------------------------
6
- // Runtime schema accessors
7
- // ---------------------------------------------------------------------------
8
- /** Get the input Zod schema from a trail, preserving the specific schema type. */
9
- export const inputOf = (trail) => trail.input;
10
- /** Get the output Zod schema from a trail, if defined, preserving the specific schema type. */
11
- export const outputOf = (trail) => trail.output;
12
- //# sourceMappingURL=type-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type-utils.js","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AA6CH,mCAAmC;AAEnC,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E,kFAAkF;AAClF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAqB,KAAQ,EAAc,EAAE,CAClE,KAAK,CAAC,KAAK,CAAC;AAEd,+FAA+F;AAC/F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAqB,KAAQ,EAAe,EAAE,CACpE,KAAK,CAAC,MAAM,CAAC"}
package/dist/types.d.ts DELETED
@@ -1,177 +0,0 @@
1
- import type { TrailsError } from './errors.js';
2
- import type { Result } from './result.js';
3
- import type { Signal } from './signal.js';
4
- import type { AnyTrail } from './trail.js';
5
- import type { CrossInput, TrailOutput } from './type-utils.js';
6
- /** A recovery path that activates when a trail's blaze fails with a matching error. */
7
- export interface Detour<Input, Output, TErr extends TrailsError = TrailsError> {
8
- readonly on: abstract new (...args: any[]) => TErr;
9
- readonly maxAttempts?: number | undefined;
10
- readonly recover: (attempt: DetourAttempt<Input, TErr>, ctx: TrailContext) => Promise<Result<Output, TrailsError>>;
11
- }
12
- /** Context passed to a detour's recover function on each attempt. */
13
- export interface DetourAttempt<Input, TErr extends TrailsError = TrailsError> {
14
- /** 1-indexed attempt number */
15
- readonly attempt: number;
16
- /** The matched error */
17
- readonly error: TErr;
18
- /** Original trail input */
19
- readonly input: Input;
20
- }
21
- type CrossBatchCall<TTarget extends AnyTrail | string = AnyTrail | string> = TTarget extends AnyTrail ? readonly [trail: TTarget, input: CrossInput<TTarget>] : readonly [id: string, input: unknown];
22
- type CrossBatchResult<TTarget extends AnyTrail | string> = TTarget extends AnyTrail ? Result<TrailOutput<TTarget>, Error> : Result<unknown, Error>;
23
- type CrossBatchResults<TCalls extends readonly CrossBatchCall[]> = {
24
- readonly [K in keyof TCalls]: TCalls[K] extends readonly [
25
- infer TTarget,
26
- unknown
27
- ] ? TTarget extends AnyTrail | string ? CrossBatchResult<TTarget> : never : never;
28
- };
29
- /** Runtime options for batch `ctx.cross([...])` calls. */
30
- export interface CrossBatchOptions {
31
- /**
32
- * Maximum number of branches to execute concurrently.
33
- *
34
- * Omit for unbounded concurrency. `1` is equivalent to sequential execution.
35
- */
36
- readonly concurrency?: number | undefined;
37
- }
38
- /**
39
- * Trail implementation — sync or async.
40
- *
41
- * Authors can return `Result` directly or wrap it in a `Promise`. The framework
42
- * normalizes with `await` at every call site, so both forms work transparently.
43
- */
44
- export type Implementation<I, O> = (input: I, ctx: TrailContext) => Result<O, Error> | Promise<Result<O, Error>>;
45
- /**
46
- * Invoke another trail — used for trail composition.
47
- *
48
- * Two call shapes:
49
- *
50
- * - **By trail object** (typed): `ctx.cross(showGist, { id })` — the compiler
51
- * infers `I` and `O` from the trail's schemas, so the result is fully typed.
52
- * - **By string id** (untyped escape hatch): `ctx.cross('gist.show', { id })`
53
- * — returns `Result<O, Error>` where `O` defaults to `unknown`.
54
- * - **By batch**: `ctx.cross([[showGist, { id }], ['audit.log', payload]])`
55
- * — executes every crossing concurrently and resolves once all results are
56
- * available. Result ordering always matches the input tuple ordering. Pass
57
- * `{ concurrency: N }` as the second argument to limit how many branches
58
- * run at once.
59
- */
60
- export interface CrossFn {
61
- <const TCalls extends readonly CrossBatchCall[]>(calls: TCalls, options?: CrossBatchOptions): Promise<CrossBatchResults<TCalls>>;
62
- <T extends AnyTrail>(trail: T, input: CrossInput<T>): Promise<Result<TrailOutput<T>, Error>>;
63
- <O = unknown>(id: string, input: unknown): Promise<Result<O, Error>>;
64
- }
65
- /**
66
- * Emit a signal — used for signal-driven activation.
67
- *
68
- * Fan-out to consumer trails (those with the signal in their `on:` array) is
69
- * the framework's responsibility. Producers get `Result.ok(undefined)` unless
70
- * the signal id is unknown or the payload fails schema validation. Consumer
71
- * errors are logged but do not propagate back to the producer. Consumers fan
72
- * out in parallel, each with its own derived context. Runtime cycle
73
- * suppression is still signal-id-based against the current fire stack: it
74
- * prevents re-entrant loops but can over-suppress legitimate diamond
75
- * re-fires, with a debug breadcrumb and a warn emitted when suppression happens.
76
- *
77
- * Two call shapes are supported:
78
- *
79
- * - **By id** (base shape): `ctx.fire('order.placed', { ... })`. Matches
80
- * the shape of `ctx.cross`; payload is typed as `unknown` and validated
81
- * against the signal's schema at the fire boundary.
82
- * - **By signal value** (progressive disclosure): `ctx.fire(orderPlaced, payload)`
83
- * where `orderPlaced` is a `Signal<T>`. The compiler enforces that
84
- * `payload` matches the signal's declared schema type at the call site,
85
- * on top of the runtime validation.
86
- */
87
- export interface FireFn {
88
- <T>(signal: Signal<T>, payload: T): Promise<Result<void, Error>>;
89
- (signalId: string, payload: unknown): Promise<Result<void, Error>>;
90
- }
91
- /** Resolve a resource instance from the current trail context. */
92
- export type ResourceLookup = <T = unknown>(resourceOrId: {
93
- readonly id: string;
94
- } | string) => T;
95
- /**
96
- * Wrap the execution of `fn` in a child trace span.
97
- *
98
- * Creates a nested span under the current trail's root trace record, times
99
- * the callback, records success or failure (including error category), and
100
- * writes the completed span to the registered sink. Errors thrown by `fn`
101
- * are recorded on the span and then rethrown — tracing never swallows them.
102
- */
103
- export type TraceFn = <T>(label: string, fn: () => T | Promise<T>) => Promise<T>;
104
- /** Callback for reporting progress from long-running trails */
105
- export type ProgressCallback = (event: ProgressEvent) => void;
106
- /** Structured progress event emitted during trail execution */
107
- export interface ProgressEvent {
108
- readonly type: 'start' | 'progress' | 'complete' | 'error';
109
- readonly current?: number | undefined;
110
- readonly total?: number | undefined;
111
- readonly message?: string | undefined;
112
- readonly ts: string;
113
- }
114
- /** Minimal logger interface — implementations can bridge to any logging library */
115
- export interface Logger {
116
- readonly name?: string | undefined;
117
- trace(message: string, data?: Record<string, unknown>): void;
118
- debug(message: string, data?: Record<string, unknown>): void;
119
- info(message: string, data?: Record<string, unknown>): void;
120
- warn(message: string, data?: Record<string, unknown>): void;
121
- error(message: string, data?: Record<string, unknown>): void;
122
- fatal(message: string, data?: Record<string, unknown>): void;
123
- child(context: Record<string, unknown>): Logger;
124
- }
125
- /** Context extension key for the invoking trailhead name. */
126
- export declare const TRAILHEAD_KEY: "__trails_trailhead";
127
- /** Minimal permit shape available on TrailContext. Permits extends this. */
128
- export interface BasePermit {
129
- readonly id: string;
130
- readonly scopes: readonly string[];
131
- }
132
- /** Runtime context threaded through every trail execution */
133
- export interface TrailContext {
134
- readonly requestId: string;
135
- readonly abortSignal: AbortSignal;
136
- readonly cross?: CrossFn | undefined;
137
- /**
138
- * Emit a signal by id. Fans out to every trail with the signal in its
139
- * `on:` declaration. Bound by the runner that holds the topo (typically
140
- * `run()`); undefined when a context is constructed without topo access.
141
- */
142
- readonly fire?: FireFn | undefined;
143
- readonly permit?: BasePermit;
144
- readonly workspaceRoot?: string | undefined;
145
- readonly logger?: Logger | undefined;
146
- readonly progress?: ProgressCallback | undefined;
147
- readonly cwd?: string | undefined;
148
- readonly env?: Record<string, string | undefined> | undefined;
149
- readonly extensions?: Readonly<Record<string, unknown>> | undefined;
150
- readonly resource?: ResourceLookup | undefined;
151
- /**
152
- * Wrap a callback in a child trace span.
153
- *
154
- * Always present on contexts produced by `executeTrail` or
155
- * `createTrailContext`. Optional on the interface so manually constructed
156
- * contexts (tests, ad-hoc compositions) don't have to supply one — call
157
- * sites tolerate `undefined` by falling back to a no-op passthrough.
158
- */
159
- readonly trace?: TraceFn | undefined;
160
- }
161
- /**
162
- * Permit requirement declared on a trail spec.
163
- *
164
- * A scopes object means the trail requires a permit with those scopes.
165
- * `'public'` means the trail has explicitly opted out of auth.
166
- * Omitting the field entirely means the trail hasn't declared an auth posture.
167
- */
168
- export type PermitRequirement = {
169
- readonly scopes: readonly string[];
170
- } | 'public';
171
- /** Input shape used to seed a runtime TrailContext before resolution. */
172
- export type TrailContextInit = Omit<TrailContext, 'resource' | 'trace'> & {
173
- readonly resource?: ResourceLookup | undefined;
174
- readonly trace?: TraceFn | undefined;
175
- };
176
- export {};
177
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAM/D,uFAAuF;AACvF,MAAM,WAAW,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,SAAS,WAAW,GAAG,WAAW;IAE3E,QAAQ,CAAC,EAAE,EAAE,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,CAChB,OAAO,EAAE,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,EACnC,GAAG,EAAE,YAAY,KACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;CAC3C;AAED,qEAAqE;AACrE,MAAM,WAAW,aAAa,C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IAC/C;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACtC,QAAQ,CAAC;AAEb,yEAAyE;AACzE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC,CAAC"}
package/dist/types.js DELETED
@@ -1,3 +0,0 @@
1
- /** Context extension key for the invoking trailhead name. */
2
- export const TRAILHEAD_KEY = '__trails_trailhead';
3
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAyKA,6DAA6D;AAC7D,MAAM,CAAC,MAAM,aAAa,GAAG,oBAA6B,CAAC"}
@@ -1,76 +0,0 @@
1
- import { ValidationError } from './errors.js';
2
- import { Result } from './result.js';
3
- import type { Topo } from './topo.js';
4
- /**
5
- * Validate that a topo is ready for established outputs.
6
- *
7
- * Established surfaces still require the authored graph to be structurally
8
- * valid, and they must also reject any remaining draft state.
9
- */
10
- export declare const validateEstablishedTopo: (topo: Topo) => {
11
- readonly error: ValidationError;
12
- isOk(): this is {
13
- readonly value: never;
14
- isOk(): this is /*elided*/ any;
15
- isErr(): this is /*elided*/ any;
16
- map<U>(fn: (value: never) => U): Result<U, ValidationError>;
17
- flatMap<U, F = ValidationError>(fn: (value: never) => Result<U, F>): Result<U, ValidationError | F>;
18
- mapErr<F>(_fn: (error: ValidationError) => F): Result<never, F>;
19
- match<U>(handlers: {
20
- ok: (value: never) => U;
21
- err: (error: ValidationError) => U;
22
- }): U;
23
- unwrap(): never;
24
- unwrapOr(_fallback: never): never;
25
- };
26
- isErr(): this is /*elided*/ any;
27
- map<U>(_fn: (value: never) => U): Result<U, ValidationError>;
28
- flatMap<U, F = ValidationError>(_fn: (value: never) => Result<U, F>): Result<U, ValidationError | F>;
29
- mapErr<F>(fn: (error: ValidationError) => F): Result<never, F>;
30
- match<U>(handlers: {
31
- ok: (value: never) => U;
32
- err: (error: ValidationError) => U;
33
- }): U;
34
- unwrap(): never;
35
- unwrapOr<T>(fallback: T): T;
36
- } | {
37
- readonly value: void;
38
- isOk(): this is /*elided*/ any;
39
- isErr(): this is {
40
- readonly error: never;
41
- isOk(): this is {
42
- readonly value: never;
43
- isOk(): this is /*elided*/ any;
44
- isErr(): this is /*elided*/ any;
45
- map<U>(fn: (value: never) => U): Result<U, never>;
46
- flatMap<U, F = never>(fn: (value: never) => Result<U, F>): Result<U, F>;
47
- mapErr<F>(_fn: (error: never) => F): Result<never, F>;
48
- match<U>(handlers: {
49
- ok: (value: never) => U;
50
- err: (error: never) => U;
51
- }): U;
52
- unwrap(): never;
53
- unwrapOr(_fallback: never): never;
54
- };
55
- isErr(): this is /*elided*/ any;
56
- map<U>(_fn: (value: never) => U): Result<U, never>;
57
- flatMap<U, F = never>(_fn: (value: never) => Result<U, F>): Result<U, F>;
58
- mapErr<F>(fn: (error: never) => F): Result<never, F>;
59
- match<U>(handlers: {
60
- ok: (value: never) => U;
61
- err: (error: never) => U;
62
- }): U;
63
- unwrap(): never;
64
- unwrapOr<T>(fallback: T): T;
65
- };
66
- map<U>(fn: (value: void) => U): Result<U, never>;
67
- flatMap<U, F = never>(fn: (value: void) => Result<U, F>): Result<U, F>;
68
- mapErr<F>(_fn: (error: never) => F): Result<void, F>;
69
- match<U>(handlers: {
70
- ok: (value: void) => U;
71
- err: (error: never) => U;
72
- }): U;
73
- unwrap(): void;
74
- unwrapOr(_fallback: void): void;
75
- };
76
- //# sourceMappingURL=validate-established-topo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-established-topo.d.ts","sourceRoot":"","sources":["../src/validate-established-topo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA0CtC;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYjD,CAAC"}
@@ -1,43 +0,0 @@
1
- import { ValidationError } from './errors.js';
2
- import { Result } from './result.js';
3
- import { validateDraftFreeTopo } from './draft.js';
4
- import { validateTopo } from './validate-topo.js';
5
- const PROJECTION_BLOCKING_RULES = new Set([
6
- 'cross-cycle',
7
- 'cross-exists',
8
- 'no-self-cross',
9
- 'resource-exists',
10
- 'signal-origin-exists',
11
- ]);
12
- const keepProjectionBlockingIssues = (result) => {
13
- if (result.isOk()) {
14
- return result;
15
- }
16
- const issues = result.error.context?.issues;
17
- const remainingIssues = issues?.filter((issue) => PROJECTION_BLOCKING_RULES.has(issue.rule));
18
- if (remainingIssues === undefined || remainingIssues.length === 0) {
19
- return Result.ok();
20
- }
21
- return Result.err(new ValidationError(`Topo validation failed with ${remainingIssues.length} issue(s)`, {
22
- cause: result.error,
23
- context: { issues: remainingIssues },
24
- }));
25
- };
26
- /**
27
- * Validate that a topo is ready for established outputs.
28
- *
29
- * Established surfaces still require the authored graph to be structurally
30
- * valid, and they must also reject any remaining draft state.
31
- */
32
- export const validateEstablishedTopo = (topo) => {
33
- const structural = keepProjectionBlockingIssues(validateTopo(topo));
34
- if (structural.isErr()) {
35
- return structural;
36
- }
37
- const established = validateDraftFreeTopo(topo);
38
- if (established.isErr()) {
39
- return established;
40
- }
41
- return Result.ok();
42
- };
43
- //# sourceMappingURL=validate-established-topo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-established-topo.js","sourceRoot":"","sources":["../src/validate-established-topo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACxC,aAAa;IACb,cAAc;IACd,eAAe;IACf,iBAAiB;IACjB,sBAAsB;CACvB,CAAC,CAAC;AAEH,MAAM,4BAA4B,GAAG,CACnC,MAAuC,EACvC,EAAE;IACF,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QAClB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,MAAM,GACV,MAAM,CAAC,KAAK,CAAC,OACd,EAAE,MAAM,CAAC;IACV,MAAM,eAAe,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAC/C,yBAAyB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAC1C,CAAC;IAEF,IAAI,eAAe,KAAK,SAAS,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClE,OAAO,MAAM,CAAC,EAAE,EAAE,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC,GAAG,CACf,IAAI,eAAe,CACjB,+BAA+B,eAAe,CAAC,MAAM,WAAW,EAChE;QACE,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE;KACrC,CACF,CACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAU,EAAE,EAAE;IACpD,MAAM,UAAU,GAAG,4BAA4B,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACpE,IAAI,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC;QACvB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,WAAW,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC;QACxB,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC,EAAE,EAAE,CAAC;AACrB,CAAC,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Structural validation for a Topo graph.
3
- *
4
- * Checks trail crossing references, example input validity, event origin
5
- * references, and output schema completeness. Returns a Result with all
6
- * issues collected into a single ValidationError.
7
- */
8
- import { ValidationError } from './errors.js';
9
- import { Result } from './result.js';
10
- import type { Topo } from './topo.js';
11
- export interface TopoIssue {
12
- readonly trailId: string;
13
- readonly rule: string;
14
- readonly message: string;
15
- }
16
- /**
17
- * Validate the structural integrity of a Topo graph.
18
- *
19
- * Checks crossing references, example inputs, event origins, and output
20
- * schema presence. Returns `Result.ok()` when no issues are found, or
21
- * `Result.err(ValidationError)` with all issues in the error context.
22
- */
23
- export declare const validateTopo: (topo: Topo) => Result<void, ValidationError>;
24
- //# sourceMappingURL=validate-topo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-topo.d.ts","sourceRoot":"","sources":["../src/validate-topo.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQtC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AA8MD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,KAAG,MAAM,CAAC,IAAI,EAAE,eAAe,CAqBrE,CAAC"}