@toa.io/extensions.exposition 1.0.0-alpha.282 → 1.0.0-alpha.284

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 (667) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/components/exposition.octets/manifest.toa.yaml +11 -0
  3. package/components/exposition.octets/types/index.d.ts +3 -0
  4. package/components/exposition.octets/types/toa.d.ts +41 -0
  5. package/components/identity.bans/operations/transit.js +1 -1
  6. package/components/identity.bans/tsconfig.json +1 -1
  7. package/components/identity.bans/tsconfig.tsbuildinfo +1 -1
  8. package/components/identity.bans/types/index.d.ts +3 -0
  9. package/components/identity.bans/types/toa.d.ts +34 -0
  10. package/components/identity.basic/manifest.toa.yaml +13 -2
  11. package/components/identity.basic/operations/add.js +1 -1
  12. package/components/identity.basic/operations/authenticate.js +1 -1
  13. package/components/identity.basic/operations/check.js +1 -1
  14. package/components/identity.basic/operations/delete.js +1 -1
  15. package/components/identity.basic/operations/incept.js +18 -2
  16. package/components/identity.basic/operations/info.js +1 -1
  17. package/components/identity.basic/operations/lib/credentials.js +1 -1
  18. package/components/identity.basic/operations/transit.js +3 -2
  19. package/components/identity.basic/source/add.ts +3 -3
  20. package/components/identity.basic/source/authenticate.ts +2 -2
  21. package/components/identity.basic/source/check.ts +1 -1
  22. package/components/identity.basic/source/delete.ts +2 -2
  23. package/components/identity.basic/source/incept.ts +31 -3
  24. package/components/identity.basic/source/info.ts +1 -1
  25. package/components/identity.basic/source/transit.ts +6 -4
  26. package/components/identity.basic/tsconfig.json +1 -1
  27. package/components/identity.basic/tsconfig.tsbuildinfo +1 -1
  28. package/components/identity.basic/types/index.d.ts +22 -0
  29. package/components/identity.basic/types/toa.d.ts +121 -0
  30. package/components/identity.clients/manifest.toa.yaml +243 -0
  31. package/components/identity.clients/operations/describe.js +44 -0
  32. package/components/identity.clients/operations/lib/Context.js +2 -0
  33. package/components/identity.clients/operations/lib/Entity.js +2 -0
  34. package/components/identity.clients/operations/lib/canonical.js +24 -0
  35. package/components/identity.clients/operations/lib/cimd.js +86 -0
  36. package/components/identity.clients/operations/lib/errors.js +5 -0
  37. package/components/identity.clients/operations/lib/index.js +7 -0
  38. package/components/identity.clients/operations/lib/redirect.js +32 -0
  39. package/components/identity.clients/operations/register.js +84 -0
  40. package/components/identity.clients/source/describe.ts +65 -0
  41. package/components/identity.clients/source/lib/Context.ts +38 -0
  42. package/components/identity.clients/source/lib/Entity.ts +31 -0
  43. package/components/identity.clients/source/lib/canonical.test.ts +43 -0
  44. package/components/identity.clients/source/lib/canonical.ts +27 -0
  45. package/components/identity.clients/source/lib/cimd.test.ts +120 -0
  46. package/components/identity.clients/source/lib/cimd.ts +107 -0
  47. package/components/identity.clients/source/lib/errors.ts +4 -0
  48. package/components/identity.clients/source/lib/index.ts +6 -0
  49. package/components/identity.clients/source/lib/redirect.test.ts +41 -0
  50. package/components/identity.clients/source/lib/redirect.ts +35 -0
  51. package/components/identity.clients/source/register.ts +125 -0
  52. package/components/identity.clients/tsconfig.json +10 -0
  53. package/components/identity.clients/tsconfig.tsbuildinfo +1 -0
  54. package/components/identity.clients/types/index.d.ts +3 -0
  55. package/components/identity.clients/types/toa.d.ts +109 -0
  56. package/components/identity.credentials/operations/list.js +1 -1
  57. package/components/identity.credentials/source/list.ts +2 -1
  58. package/components/identity.credentials/tsconfig.json +4 -2
  59. package/components/identity.credentials/tsconfig.tsbuildinfo +1 -1
  60. package/components/identity.credentials/types/index.d.ts +3 -0
  61. package/components/identity.credentials/types/toa.d.ts +30 -0
  62. package/components/identity.federation/manifest.toa.yaml +37 -1
  63. package/components/identity.federation/operations/authenticate.js +7 -3
  64. package/components/identity.federation/operations/create.js +1 -1
  65. package/components/identity.federation/operations/decode.js +1 -1
  66. package/components/identity.federation/operations/delete.js +1 -1
  67. package/components/identity.federation/operations/incept.js +6 -2
  68. package/components/identity.federation/operations/lib/Configuration.js +1 -1
  69. package/components/identity.federation/operations/lib/Ctx.js +1 -1
  70. package/components/identity.federation/operations/lib/Payload.js +1 -1
  71. package/components/identity.federation/operations/lib/decode.js +23 -9
  72. package/components/identity.federation/operations/lib/discovery.js +1 -1
  73. package/components/identity.federation/operations/lib/errors.js +5 -1
  74. package/components/identity.federation/operations/lib/exchange.js +12 -7
  75. package/components/identity.federation/operations/lib/index.js +2 -1
  76. package/components/identity.federation/operations/lib/jose.js +1 -1
  77. package/components/identity.federation/operations/lib/principal.js +14 -0
  78. package/components/identity.federation/operations/lib/resolve.js +1 -1
  79. package/components/identity.federation/operations/list.js +1 -1
  80. package/components/identity.federation/operations/types/Scheme.js +1 -1
  81. package/components/identity.federation/operations/types/configuration.js +1 -1
  82. package/components/identity.federation/operations/types/context.js +1 -1
  83. package/components/identity.federation/operations/types/entity.js +1 -1
  84. package/components/identity.federation/operations/types/index.js +1 -1
  85. package/components/identity.federation/source/authenticate.ts +9 -3
  86. package/components/identity.federation/source/incept.ts +7 -1
  87. package/components/identity.federation/source/lib/Ctx.ts +2 -2
  88. package/components/identity.federation/source/lib/decode.ts +25 -9
  89. package/components/identity.federation/source/lib/errors.ts +5 -0
  90. package/components/identity.federation/source/lib/exchange.ts +11 -7
  91. package/components/identity.federation/source/lib/index.ts +1 -0
  92. package/components/identity.federation/source/lib/principal.ts +17 -0
  93. package/components/identity.federation/source/types/configuration.ts +1 -1
  94. package/components/identity.federation/source/types/context.ts +6 -2
  95. package/components/identity.federation/tsconfig.json +4 -2
  96. package/components/identity.federation/tsconfig.tsbuildinfo +1 -1
  97. package/components/identity.federation/types/index.d.ts +3 -0
  98. package/components/identity.federation/types/toa.d.ts +127 -0
  99. package/components/identity.grants/manifest.toa.yaml +245 -0
  100. package/components/identity.grants/operations/authorize.js +54 -0
  101. package/components/identity.grants/operations/exchange.js +89 -0
  102. package/components/identity.grants/operations/lib/code.js +30 -0
  103. package/components/identity.grants/operations/lib/identify.js +15 -0
  104. package/components/identity.grants/operations/lib/index.js +3 -0
  105. package/components/identity.grants/operations/list.js +18 -0
  106. package/components/identity.grants/operations/revoke.js +25 -0
  107. package/components/identity.grants/source/authorize.ts +90 -0
  108. package/components/identity.grants/source/exchange.ts +130 -0
  109. package/components/identity.grants/source/lib/code.ts +39 -0
  110. package/components/identity.grants/source/lib/identify.ts +16 -0
  111. package/components/identity.grants/source/lib/index.ts +3 -0
  112. package/components/identity.grants/source/list.ts +28 -0
  113. package/components/identity.grants/source/revoke.ts +38 -0
  114. package/components/identity.grants/tsconfig.json +10 -0
  115. package/components/identity.grants/tsconfig.tsbuildinfo +1 -0
  116. package/components/identity.grants/types/index.d.ts +60 -0
  117. package/components/identity.grants/types/toa.d.ts +108 -0
  118. package/components/identity.keys/manifest.toa.yaml +1 -0
  119. package/components/identity.keys/operations/create.js +1 -1
  120. package/components/identity.keys/operations/disable.js +1 -1
  121. package/components/identity.keys/operations/revoke.js +1 -1
  122. package/components/identity.keys/source/create.ts +1 -1
  123. package/components/identity.keys/source/revoke.ts +1 -1
  124. package/components/identity.keys/tsconfig.json +1 -1
  125. package/components/identity.keys/tsconfig.tsbuildinfo +1 -1
  126. package/components/identity.keys/types/index.d.ts +3 -0
  127. package/components/identity.keys/types/toa.d.ts +47 -0
  128. package/components/identity.otp/operations/authenticate.js +1 -1
  129. package/components/identity.otp/operations/issue.js +1 -1
  130. package/components/identity.otp/operations/lib/Context.js +1 -1
  131. package/components/identity.otp/operations/lib/Entity.js +1 -1
  132. package/components/identity.otp/operations/lib/index.js +1 -1
  133. package/components/identity.otp/source/lib/Context.ts +4 -2
  134. package/components/identity.otp/tsconfig.json +1 -1
  135. package/components/identity.otp/tsconfig.tsbuildinfo +1 -1
  136. package/components/identity.otp/types/index.d.ts +3 -0
  137. package/components/identity.otp/types/toa.d.ts +56 -0
  138. package/components/identity.passkeys/manifest.toa.yaml +3 -0
  139. package/components/identity.passkeys/operations/authenticate.js +1 -1
  140. package/components/identity.passkeys/operations/challenge.js +1 -1
  141. package/components/identity.passkeys/operations/create.js +1 -1
  142. package/components/identity.passkeys/operations/delete.js +1 -1
  143. package/components/identity.passkeys/operations/lib/const.js +1 -1
  144. package/components/identity.passkeys/operations/list.js +1 -1
  145. package/components/identity.passkeys/operations/types/Configuration.js +1 -1
  146. package/components/identity.passkeys/operations/types/Context.js +1 -1
  147. package/components/identity.passkeys/operations/types/Passkey.js +1 -1
  148. package/components/identity.passkeys/operations/types/index.js +1 -1
  149. package/components/identity.passkeys/operations/use.js +1 -1
  150. package/components/identity.passkeys/source/authenticate.ts +1 -1
  151. package/components/identity.passkeys/source/challenge.ts +1 -1
  152. package/components/identity.passkeys/source/create.ts +1 -1
  153. package/components/identity.passkeys/source/types/Context.ts +2 -1
  154. package/components/identity.passkeys/source/use.ts +1 -1
  155. package/components/identity.passkeys/tsconfig.json +1 -1
  156. package/components/identity.passkeys/tsconfig.tsbuildinfo +1 -1
  157. package/components/identity.passkeys/types/index.d.ts +3 -0
  158. package/components/identity.passkeys/types/toa.d.ts +120 -0
  159. package/components/identity.roles/operations/grant.js +1 -1
  160. package/components/identity.roles/operations/lib/Entity.js +1 -1
  161. package/components/identity.roles/operations/list.js +1 -1
  162. package/components/identity.roles/operations/principal.js +29 -5
  163. package/components/identity.roles/source/principal.ts +33 -5
  164. package/components/identity.roles/tsconfig.json +1 -1
  165. package/components/identity.roles/tsconfig.tsbuildinfo +1 -1
  166. package/components/identity.roles/types/index.d.ts +3 -0
  167. package/components/identity.roles/types/toa.d.ts +43 -0
  168. package/components/identity.tokens/manifest.toa.yaml +34 -3
  169. package/components/identity.tokens/operations/authenticate.js +9 -1
  170. package/components/identity.tokens/operations/decrypt.js +3 -3
  171. package/components/identity.tokens/operations/encrypt.js +1 -1
  172. package/components/identity.tokens/operations/issue.js +3 -2
  173. package/components/identity.tokens/operations/lib/form.js +24 -0
  174. package/components/identity.tokens/operations/lib/index.js +2 -2
  175. package/components/identity.tokens/operations/lib/jose.js +1 -1
  176. package/components/identity.tokens/operations/lib/key.js +1 -1
  177. package/components/identity.tokens/operations/lib/pad.js +1 -1
  178. package/components/identity.tokens/operations/revoke.js +1 -1
  179. package/components/identity.tokens/source/authenticate.test.ts +8 -5
  180. package/components/identity.tokens/source/authenticate.ts +12 -1
  181. package/components/identity.tokens/source/decrypt.test.ts +1 -1
  182. package/components/identity.tokens/source/decrypt.ts +4 -3
  183. package/components/identity.tokens/source/encrypt.test.ts +1 -1
  184. package/components/identity.tokens/source/encrypt.ts +2 -1
  185. package/components/identity.tokens/source/issue.test.ts +71 -0
  186. package/components/identity.tokens/source/issue.ts +4 -2
  187. package/components/identity.tokens/source/lib/form.test.ts +25 -0
  188. package/components/identity.tokens/source/lib/form.ts +31 -0
  189. package/components/identity.tokens/source/lib/index.ts +2 -1
  190. package/components/identity.tokens/tsconfig.json +1 -1
  191. package/components/identity.tokens/tsconfig.tsbuildinfo +1 -1
  192. package/components/identity.tokens/types/index.d.ts +61 -0
  193. package/components/identity.tokens/types/toa.d.ts +113 -0
  194. package/documentation/access.md +13 -0
  195. package/documentation/cache.md +10 -1
  196. package/documentation/components.md +3 -0
  197. package/documentation/consent.md +101 -0
  198. package/documentation/identity.md +3 -1
  199. package/documentation/introspection.md +13 -5
  200. package/documentation/io.md +42 -2
  201. package/documentation/map.md +8 -0
  202. package/documentation/mcp.md +180 -0
  203. package/documentation/oauth.md +180 -0
  204. package/documentation/protocol.md +4 -0
  205. package/documentation/rpc.md +140 -0
  206. package/documentation/tree.md +3 -0
  207. package/features/auth.bearer.feature +120 -0
  208. package/features/cache.feature +46 -0
  209. package/features/identity.basic.feature +44 -0
  210. package/features/identity.federation.feature +2 -5
  211. package/features/introspection.feature +333 -0
  212. package/features/mcp.feature +687 -0
  213. package/features/oauth.clients.feature +195 -0
  214. package/features/oauth.discovery.feature +164 -0
  215. package/features/oauth.grants.feature +299 -0
  216. package/features/octets.cloudinary.feature +1 -0
  217. package/features/rpc.feature +429 -0
  218. package/features/steps/Cloudinary.ts +13 -0
  219. package/features/steps/Components.ts +0 -4
  220. package/features/steps/Gateway.ts +23 -2
  221. package/features/steps/Parameters.ts +22 -7
  222. package/features/steps/Realtime.ts +3 -0
  223. package/features/steps/components/echo/manifest.toa.yaml +3 -0
  224. package/features/steps/components/octets.tester/manifest.toa.yaml +2 -0
  225. package/features/steps/components/octets.tester/operations/redirect.js +6 -1
  226. package/features/steps/components/pots/manifest.toa.yaml +2 -0
  227. package/features/steps/components/users/manifest.toa.yaml +1 -0
  228. package/package.json +8 -6
  229. package/readme.md +6 -0
  230. package/schemas/annotation.cos.yaml +63 -0
  231. package/schemas/call.cos.yaml +18 -0
  232. package/source/Annotation.ts +54 -0
  233. package/source/Directive.test.ts +15 -15
  234. package/source/Directive.ts +77 -9
  235. package/source/Endpoint.test.ts +67 -0
  236. package/source/Endpoint.ts +31 -11
  237. package/source/Factory.ts +6 -2
  238. package/source/Gateway.ts +73 -11
  239. package/source/HTTP/Context.ts +7 -0
  240. package/source/HTTP/Server.ts +15 -5
  241. package/source/HTTP/exceptions.ts +2 -2
  242. package/source/HTTP/formats/form.ts +21 -0
  243. package/source/HTTP/formats/index.ts +17 -2
  244. package/source/HTTP/messages.test.ts +25 -1
  245. package/source/HTTP/messages.ts +20 -4
  246. package/source/Interception.ts +8 -2
  247. package/source/Introspection.ts +102 -0
  248. package/source/MCP/Server.ts +275 -0
  249. package/source/MCP/discover.ts +52 -0
  250. package/source/MCP/errors.ts +81 -0
  251. package/source/MCP/index.ts +1 -0
  252. package/source/MCP/schema.test.ts +85 -0
  253. package/source/MCP/schema.ts +87 -0
  254. package/source/MCP/tools.ts +156 -0
  255. package/source/MCP/types.ts +81 -0
  256. package/source/Query.ts +48 -8
  257. package/source/RPC/Context.ts +78 -0
  258. package/source/RPC/Dispatcher.ts +130 -0
  259. package/source/RPC/errors.test.ts +52 -0
  260. package/source/RPC/errors.ts +83 -0
  261. package/source/RPC/index.ts +1 -0
  262. package/source/RPC/names.test.ts +122 -0
  263. package/source/RPC/names.ts +182 -0
  264. package/source/RPC/types.ts +34 -0
  265. package/source/RTD/Directives.ts +52 -2
  266. package/source/RTD/Endpoint.ts +2 -1
  267. package/source/RTD/Method.ts +14 -11
  268. package/source/RTD/Node.ts +38 -7
  269. package/source/RTD/Route.ts +30 -3
  270. package/source/RTD/Tree.ts +37 -1
  271. package/source/RTD/expiration.test.ts +1 -1
  272. package/source/RTD/walk.test.ts +110 -0
  273. package/source/const.ts +15 -0
  274. package/source/deployment.ts +11 -1
  275. package/source/directives/auth/Anonymous.test.ts +38 -0
  276. package/source/directives/auth/Anonymous.ts +12 -0
  277. package/source/directives/auth/Anyone.ts +4 -0
  278. package/source/directives/auth/Authorization.ts +108 -22
  279. package/source/directives/auth/Delegate.test.ts +36 -0
  280. package/source/directives/auth/Delegate.ts +14 -0
  281. package/source/directives/auth/Echo.ts +5 -0
  282. package/source/directives/auth/Incept.ts +16 -10
  283. package/source/directives/auth/Role.ts +13 -0
  284. package/source/directives/auth/Rule.ts +29 -0
  285. package/source/directives/auth/Scheme.ts +5 -0
  286. package/source/directives/auth/schemes.test.ts +8 -4
  287. package/source/directives/auth/schemes.ts +22 -9
  288. package/source/directives/auth/types.ts +26 -2
  289. package/source/directives/cache/Cache.ts +14 -5
  290. package/source/directives/cache/Control.ts +0 -3
  291. package/source/directives/dev/Development.ts +1 -1
  292. package/source/directives/flow/Fetch.ts +1 -1
  293. package/source/directives/flow/Flow.ts +1 -1
  294. package/source/directives/index.ts +5 -2
  295. package/source/directives/io/Directive.ts +1 -1
  296. package/source/directives/io/IO.ts +34 -3
  297. package/source/directives/io/Input.ts +3 -2
  298. package/source/directives/io/Output.ts +10 -4
  299. package/source/directives/io/Status.test.ts +84 -0
  300. package/source/directives/io/Status.ts +46 -0
  301. package/source/directives/io/Throttle.ts +1 -1
  302. package/source/directives/io/lib/throttle/Quotas.ts +2 -2
  303. package/source/directives/map/Headers.ts +11 -0
  304. package/source/directives/map/Map.ts +10 -1
  305. package/source/directives/map/Mapping.ts +23 -0
  306. package/source/directives/map/Segments.ts +12 -0
  307. package/source/directives/mcp/MCP.ts +33 -0
  308. package/source/directives/mcp/Tool.test.ts +66 -0
  309. package/source/directives/mcp/Tool.ts +28 -0
  310. package/source/directives/mcp/index.ts +6 -0
  311. package/source/directives/oauth/Discovery.ts +70 -0
  312. package/source/directives/oauth/documents.ts +113 -0
  313. package/source/directives/oauth/index.ts +3 -0
  314. package/source/directives/octets/Delete.ts +1 -1
  315. package/source/directives/octets/Get.ts +1 -1
  316. package/source/directives/octets/Octets.ts +1 -1
  317. package/source/directives/octets/Workflow.ts +1 -1
  318. package/source/directives/octets/workflows/Execution.ts +1 -1
  319. package/source/directives/require/Directive.ts +1 -1
  320. package/source/directives/require/Headers.ts +1 -1
  321. package/source/directives/require/Require.ts +2 -2
  322. package/source/index.ts +6 -0
  323. package/source/octets.d.ts +17 -0
  324. package/source/schemas.ts +2 -0
  325. package/source/userland.ts +47 -0
  326. package/transpiled/Annotation.d.ts +41 -0
  327. package/transpiled/Directive.d.ts +18 -1
  328. package/transpiled/Directive.js +50 -6
  329. package/transpiled/Directive.js.map +1 -1
  330. package/transpiled/Endpoint.d.ts +9 -0
  331. package/transpiled/Endpoint.js +27 -11
  332. package/transpiled/Endpoint.js.map +1 -1
  333. package/transpiled/Factory.js +6 -2
  334. package/transpiled/Factory.js.map +1 -1
  335. package/transpiled/Gateway.d.ts +19 -2
  336. package/transpiled/Gateway.js +51 -9
  337. package/transpiled/Gateway.js.map +1 -1
  338. package/transpiled/HTTP/Context.d.ts +6 -0
  339. package/transpiled/HTTP/Context.js +6 -0
  340. package/transpiled/HTTP/Context.js.map +1 -1
  341. package/transpiled/HTTP/Server.d.ts +8 -1
  342. package/transpiled/HTTP/Server.js +4 -3
  343. package/transpiled/HTTP/Server.js.map +1 -1
  344. package/transpiled/HTTP/exceptions.d.ts +1 -1
  345. package/transpiled/HTTP/exceptions.js +2 -2
  346. package/transpiled/HTTP/exceptions.js.map +1 -1
  347. package/transpiled/HTTP/formats/form.d.ts +9 -0
  348. package/transpiled/HTTP/formats/form.js +18 -0
  349. package/transpiled/HTTP/formats/form.js.map +1 -0
  350. package/transpiled/HTTP/formats/index.d.ts +10 -2
  351. package/transpiled/HTTP/formats/index.js +10 -0
  352. package/transpiled/HTTP/formats/index.js.map +1 -1
  353. package/transpiled/HTTP/messages.d.ts +12 -0
  354. package/transpiled/HTTP/messages.js +12 -4
  355. package/transpiled/HTTP/messages.js.map +1 -1
  356. package/transpiled/Interception.d.ts +4 -1
  357. package/transpiled/Interception.js +4 -2
  358. package/transpiled/Interception.js.map +1 -1
  359. package/transpiled/Introspection.d.ts +40 -0
  360. package/transpiled/Introspection.js +50 -1
  361. package/transpiled/Introspection.js.map +1 -1
  362. package/transpiled/MCP/Server.d.ts +41 -0
  363. package/transpiled/MCP/Server.js +180 -0
  364. package/transpiled/MCP/Server.js.map +1 -0
  365. package/transpiled/MCP/discover.d.ts +13 -0
  366. package/transpiled/MCP/discover.js +29 -0
  367. package/transpiled/MCP/discover.js.map +1 -0
  368. package/transpiled/MCP/errors.d.ts +24 -0
  369. package/transpiled/MCP/errors.js +67 -0
  370. package/transpiled/MCP/errors.js.map +1 -0
  371. package/transpiled/MCP/index.d.ts +1 -0
  372. package/transpiled/MCP/index.js +2 -0
  373. package/transpiled/MCP/index.js.map +1 -0
  374. package/transpiled/MCP/schema.d.ts +18 -0
  375. package/transpiled/MCP/schema.js +64 -0
  376. package/transpiled/MCP/schema.js.map +1 -0
  377. package/transpiled/MCP/tools.d.ts +31 -0
  378. package/transpiled/MCP/tools.js +121 -0
  379. package/transpiled/MCP/tools.js.map +1 -0
  380. package/transpiled/MCP/types.d.ts +64 -0
  381. package/transpiled/MCP/types.js +13 -0
  382. package/transpiled/MCP/types.js.map +1 -0
  383. package/transpiled/Query.d.ts +7 -0
  384. package/transpiled/Query.js +38 -7
  385. package/transpiled/Query.js.map +1 -1
  386. package/transpiled/RPC/Context.d.ts +11 -0
  387. package/transpiled/RPC/Context.js +63 -0
  388. package/transpiled/RPC/Context.js.map +1 -0
  389. package/transpiled/RPC/Dispatcher.d.ts +19 -0
  390. package/transpiled/RPC/Dispatcher.js +100 -0
  391. package/transpiled/RPC/Dispatcher.js.map +1 -0
  392. package/transpiled/RPC/errors.d.ts +18 -0
  393. package/transpiled/RPC/errors.js +67 -0
  394. package/transpiled/RPC/errors.js.map +1 -0
  395. package/transpiled/RPC/index.d.ts +1 -0
  396. package/transpiled/RPC/index.js +2 -0
  397. package/transpiled/RPC/index.js.map +1 -0
  398. package/transpiled/RPC/names.d.ts +30 -0
  399. package/transpiled/RPC/names.js +121 -0
  400. package/transpiled/RPC/names.js.map +1 -0
  401. package/transpiled/RPC/types.d.ts +27 -0
  402. package/transpiled/RPC/types.js +8 -0
  403. package/transpiled/RPC/types.js.map +1 -0
  404. package/transpiled/RTD/Directives.d.ts +41 -2
  405. package/transpiled/RTD/Endpoint.d.ts +2 -1
  406. package/transpiled/RTD/Method.d.ts +8 -3
  407. package/transpiled/RTD/Method.js +12 -10
  408. package/transpiled/RTD/Method.js.map +1 -1
  409. package/transpiled/RTD/Node.d.ts +20 -2
  410. package/transpiled/RTD/Node.js +22 -4
  411. package/transpiled/RTD/Node.js.map +1 -1
  412. package/transpiled/RTD/Route.d.ts +2 -1
  413. package/transpiled/RTD/Route.js +27 -2
  414. package/transpiled/RTD/Route.js.map +1 -1
  415. package/transpiled/RTD/Tree.d.ts +3 -1
  416. package/transpiled/RTD/Tree.js +26 -0
  417. package/transpiled/RTD/Tree.js.map +1 -1
  418. package/transpiled/const.d.ts +12 -0
  419. package/transpiled/const.js +12 -0
  420. package/transpiled/const.js.map +1 -1
  421. package/transpiled/deployment.js +6 -0
  422. package/transpiled/deployment.js.map +1 -1
  423. package/transpiled/directives/auth/Anonymous.d.ts +6 -0
  424. package/transpiled/directives/auth/Anonymous.js +10 -0
  425. package/transpiled/directives/auth/Anonymous.js.map +1 -1
  426. package/transpiled/directives/auth/Anyone.d.ts +1 -0
  427. package/transpiled/directives/auth/Anyone.js +3 -0
  428. package/transpiled/directives/auth/Anyone.js.map +1 -1
  429. package/transpiled/directives/auth/Authorization.d.ts +28 -2
  430. package/transpiled/directives/auth/Authorization.js +87 -19
  431. package/transpiled/directives/auth/Authorization.js.map +1 -1
  432. package/transpiled/directives/auth/Delegate.d.ts +5 -0
  433. package/transpiled/directives/auth/Delegate.js +10 -0
  434. package/transpiled/directives/auth/Delegate.js.map +1 -1
  435. package/transpiled/directives/auth/Echo.d.ts +2 -0
  436. package/transpiled/directives/auth/Echo.js +4 -0
  437. package/transpiled/directives/auth/Echo.js.map +1 -1
  438. package/transpiled/directives/auth/Incept.d.ts +1 -1
  439. package/transpiled/directives/auth/Incept.js +13 -8
  440. package/transpiled/directives/auth/Incept.js.map +1 -1
  441. package/transpiled/directives/auth/Role.d.ts +2 -0
  442. package/transpiled/directives/auth/Role.js +9 -0
  443. package/transpiled/directives/auth/Role.js.map +1 -1
  444. package/transpiled/directives/auth/Rule.d.ts +5 -0
  445. package/transpiled/directives/auth/Rule.js +20 -0
  446. package/transpiled/directives/auth/Rule.js.map +1 -1
  447. package/transpiled/directives/auth/Scheme.d.ts +2 -0
  448. package/transpiled/directives/auth/Scheme.js +4 -0
  449. package/transpiled/directives/auth/Scheme.js.map +1 -1
  450. package/transpiled/directives/auth/schemes.d.ts +16 -4
  451. package/transpiled/directives/auth/schemes.js +20 -8
  452. package/transpiled/directives/auth/schemes.js.map +1 -1
  453. package/transpiled/directives/auth/types.d.ts +20 -2
  454. package/transpiled/directives/cache/Cache.d.ts +1 -1
  455. package/transpiled/directives/cache/Cache.js +10 -3
  456. package/transpiled/directives/cache/Cache.js.map +1 -1
  457. package/transpiled/directives/cache/Control.js +0 -2
  458. package/transpiled/directives/cache/Control.js.map +1 -1
  459. package/transpiled/directives/dev/Development.d.ts +1 -1
  460. package/transpiled/directives/dev/Development.js +1 -1
  461. package/transpiled/directives/dev/Development.js.map +1 -1
  462. package/transpiled/directives/flow/Flow.d.ts +1 -1
  463. package/transpiled/directives/flow/Flow.js +1 -1
  464. package/transpiled/directives/flow/Flow.js.map +1 -1
  465. package/transpiled/directives/index.js +4 -2
  466. package/transpiled/directives/index.js.map +1 -1
  467. package/transpiled/directives/io/Directive.d.ts +1 -1
  468. package/transpiled/directives/io/IO.d.ts +7 -1
  469. package/transpiled/directives/io/IO.js +25 -3
  470. package/transpiled/directives/io/IO.js.map +1 -1
  471. package/transpiled/directives/io/Input.d.ts +3 -2
  472. package/transpiled/directives/io/Input.js +2 -1
  473. package/transpiled/directives/io/Input.js.map +1 -1
  474. package/transpiled/directives/io/Output.d.ts +5 -3
  475. package/transpiled/directives/io/Output.js +8 -3
  476. package/transpiled/directives/io/Output.js.map +1 -1
  477. package/transpiled/directives/io/Status.d.ts +19 -0
  478. package/transpiled/directives/io/Status.js +34 -0
  479. package/transpiled/directives/io/Status.js.map +1 -0
  480. package/transpiled/directives/io/Throttle.d.ts +1 -1
  481. package/transpiled/directives/io/Throttle.js +1 -1
  482. package/transpiled/directives/io/Throttle.js.map +1 -1
  483. package/transpiled/directives/io/lib/throttle/Quotas.d.ts +1 -1
  484. package/transpiled/directives/io/lib/throttle/Quotas.js +2 -2
  485. package/transpiled/directives/io/lib/throttle/Quotas.js.map +1 -1
  486. package/transpiled/directives/map/Headers.d.ts +2 -0
  487. package/transpiled/directives/map/Headers.js +8 -0
  488. package/transpiled/directives/map/Headers.js.map +1 -1
  489. package/transpiled/directives/map/Map.d.ts +3 -1
  490. package/transpiled/directives/map/Map.js +7 -1
  491. package/transpiled/directives/map/Map.js.map +1 -1
  492. package/transpiled/directives/map/Mapping.d.ts +13 -0
  493. package/transpiled/directives/map/Mapping.js +20 -0
  494. package/transpiled/directives/map/Mapping.js.map +1 -1
  495. package/transpiled/directives/map/Segments.d.ts +3 -0
  496. package/transpiled/directives/map/Segments.js +9 -0
  497. package/transpiled/directives/map/Segments.js.map +1 -1
  498. package/transpiled/directives/mcp/MCP.d.ts +15 -0
  499. package/transpiled/directives/mcp/MCP.js +23 -0
  500. package/transpiled/directives/mcp/MCP.js.map +1 -0
  501. package/transpiled/directives/mcp/Tool.d.ts +13 -0
  502. package/transpiled/directives/mcp/Tool.js +23 -0
  503. package/transpiled/directives/mcp/Tool.js.map +1 -0
  504. package/transpiled/directives/mcp/index.d.ts +4 -0
  505. package/transpiled/directives/mcp/index.js +4 -0
  506. package/transpiled/directives/mcp/index.js.map +1 -0
  507. package/transpiled/directives/oauth/Discovery.d.ts +23 -0
  508. package/transpiled/directives/oauth/Discovery.js +55 -0
  509. package/transpiled/directives/oauth/Discovery.js.map +1 -0
  510. package/transpiled/directives/oauth/documents.d.ts +9 -0
  511. package/transpiled/directives/oauth/documents.js +82 -0
  512. package/transpiled/directives/oauth/documents.js.map +1 -0
  513. package/transpiled/directives/oauth/index.d.ts +2 -0
  514. package/transpiled/directives/oauth/index.js +3 -0
  515. package/transpiled/directives/oauth/index.js.map +1 -0
  516. package/transpiled/directives/octets/Octets.d.ts +1 -1
  517. package/transpiled/directives/octets/Octets.js +1 -1
  518. package/transpiled/directives/octets/Octets.js.map +1 -1
  519. package/transpiled/directives/require/Directive.d.ts +1 -1
  520. package/transpiled/directives/require/Headers.d.ts +1 -1
  521. package/transpiled/directives/require/Headers.js +1 -1
  522. package/transpiled/directives/require/Headers.js.map +1 -1
  523. package/transpiled/directives/require/Require.d.ts +1 -1
  524. package/transpiled/directives/require/Require.js +2 -2
  525. package/transpiled/directives/require/Require.js.map +1 -1
  526. package/transpiled/index.d.ts +2 -0
  527. package/transpiled/schemas.d.ts +2 -0
  528. package/transpiled/schemas.js +1 -0
  529. package/transpiled/schemas.js.map +1 -1
  530. package/transpiled/userland.d.ts +39 -0
  531. package/transpiled/userland.js +7 -0
  532. package/transpiled/userland.js.map +1 -0
  533. package/tsconfig.tsbuildinfo +1 -1
  534. package/components/identity.bans/operations/transit.d.ts +0 -14
  535. package/components/identity.bans/operations/transit.js.map +0 -1
  536. package/components/identity.basic/operations/add.d.ts +0 -3
  537. package/components/identity.basic/operations/add.js.map +0 -1
  538. package/components/identity.basic/operations/authenticate.d.ts +0 -13
  539. package/components/identity.basic/operations/authenticate.js.map +0 -1
  540. package/components/identity.basic/operations/check.d.ts +0 -7
  541. package/components/identity.basic/operations/check.js.map +0 -1
  542. package/components/identity.basic/operations/delete.d.ts +0 -7
  543. package/components/identity.basic/operations/delete.js.map +0 -1
  544. package/components/identity.basic/operations/incept.d.ts +0 -12
  545. package/components/identity.basic/operations/incept.js.map +0 -1
  546. package/components/identity.basic/operations/info.d.ts +0 -10
  547. package/components/identity.basic/operations/info.js.map +0 -1
  548. package/components/identity.basic/operations/lib/credentials.d.ts +0 -5
  549. package/components/identity.basic/operations/lib/credentials.js.map +0 -1
  550. package/components/identity.basic/operations/transit.d.ts +0 -14
  551. package/components/identity.basic/operations/transit.js.map +0 -1
  552. package/components/identity.basic/operations/types.d.ts +0 -61
  553. package/components/identity.basic/operations/types.js +0 -2
  554. package/components/identity.basic/operations/types.js.map +0 -1
  555. package/components/identity.basic/source/types.ts +0 -69
  556. package/components/identity.credentials/operations/list.d.ts +0 -51
  557. package/components/identity.credentials/operations/list.js.map +0 -1
  558. package/components/identity.federation/operations/authenticate.d.ts +0 -16
  559. package/components/identity.federation/operations/authenticate.js.map +0 -1
  560. package/components/identity.federation/operations/create.d.ts +0 -8
  561. package/components/identity.federation/operations/create.js.map +0 -1
  562. package/components/identity.federation/operations/decode.d.ts +0 -3
  563. package/components/identity.federation/operations/decode.js.map +0 -1
  564. package/components/identity.federation/operations/delete.d.ts +0 -8
  565. package/components/identity.federation/operations/delete.js.map +0 -1
  566. package/components/identity.federation/operations/incept.d.ts +0 -11
  567. package/components/identity.federation/operations/incept.js.map +0 -1
  568. package/components/identity.federation/operations/lib/Configuration.d.ts +0 -39
  569. package/components/identity.federation/operations/lib/Configuration.js.map +0 -1
  570. package/components/identity.federation/operations/lib/Ctx.d.ts +0 -8
  571. package/components/identity.federation/operations/lib/Ctx.js.map +0 -1
  572. package/components/identity.federation/operations/lib/Payload.d.ts +0 -5
  573. package/components/identity.federation/operations/lib/Payload.js.map +0 -1
  574. package/components/identity.federation/operations/lib/decode.d.ts +0 -3
  575. package/components/identity.federation/operations/lib/decode.js.map +0 -1
  576. package/components/identity.federation/operations/lib/discovery.d.ts +0 -5
  577. package/components/identity.federation/operations/lib/discovery.js.map +0 -1
  578. package/components/identity.federation/operations/lib/errors.d.ts +0 -70
  579. package/components/identity.federation/operations/lib/errors.js.map +0 -1
  580. package/components/identity.federation/operations/lib/exchange.d.ts +0 -3
  581. package/components/identity.federation/operations/lib/exchange.js.map +0 -1
  582. package/components/identity.federation/operations/lib/index.d.ts +0 -4
  583. package/components/identity.federation/operations/lib/index.js.map +0 -1
  584. package/components/identity.federation/operations/lib/jose.d.ts +0 -1
  585. package/components/identity.federation/operations/lib/jose.js.map +0 -1
  586. package/components/identity.federation/operations/lib/resolve.d.ts +0 -3
  587. package/components/identity.federation/operations/lib/resolve.js.map +0 -1
  588. package/components/identity.federation/operations/list.d.ts +0 -7
  589. package/components/identity.federation/operations/list.js.map +0 -1
  590. package/components/identity.federation/operations/types/Scheme.d.ts +0 -1
  591. package/components/identity.federation/operations/types/Scheme.js.map +0 -1
  592. package/components/identity.federation/operations/types/configuration.d.ts +0 -22
  593. package/components/identity.federation/operations/types/configuration.js.map +0 -1
  594. package/components/identity.federation/operations/types/context.d.ts +0 -35
  595. package/components/identity.federation/operations/types/context.js.map +0 -1
  596. package/components/identity.federation/operations/types/entity.d.ts +0 -9
  597. package/components/identity.federation/operations/types/entity.js.map +0 -1
  598. package/components/identity.federation/operations/types/index.d.ts +0 -4
  599. package/components/identity.federation/operations/types/index.js.map +0 -1
  600. package/components/identity.keys/operations/create.d.ts +0 -22
  601. package/components/identity.keys/operations/create.js.map +0 -1
  602. package/components/identity.keys/operations/disable.d.ts +0 -5
  603. package/components/identity.keys/operations/disable.js.map +0 -1
  604. package/components/identity.keys/operations/revoke.d.ts +0 -15
  605. package/components/identity.keys/operations/revoke.js.map +0 -1
  606. package/components/identity.otp/operations/authenticate.d.ts +0 -12
  607. package/components/identity.otp/operations/authenticate.js.map +0 -1
  608. package/components/identity.otp/operations/issue.d.ts +0 -12
  609. package/components/identity.otp/operations/issue.js.map +0 -1
  610. package/components/identity.otp/operations/lib/Context.d.ts +0 -14
  611. package/components/identity.otp/operations/lib/Context.js.map +0 -1
  612. package/components/identity.otp/operations/lib/Entity.d.ts +0 -6
  613. package/components/identity.otp/operations/lib/Entity.js.map +0 -1
  614. package/components/identity.otp/operations/lib/index.d.ts +0 -1
  615. package/components/identity.otp/operations/lib/index.js.map +0 -1
  616. package/components/identity.passkeys/operations/authenticate.d.ts +0 -16
  617. package/components/identity.passkeys/operations/authenticate.js.map +0 -1
  618. package/components/identity.passkeys/operations/challenge.d.ts +0 -35
  619. package/components/identity.passkeys/operations/challenge.js.map +0 -1
  620. package/components/identity.passkeys/operations/create.d.ts +0 -19
  621. package/components/identity.passkeys/operations/create.js.map +0 -1
  622. package/components/identity.passkeys/operations/delete.d.ts +0 -8
  623. package/components/identity.passkeys/operations/delete.js.map +0 -1
  624. package/components/identity.passkeys/operations/lib/const.d.ts +0 -1
  625. package/components/identity.passkeys/operations/lib/const.js.map +0 -1
  626. package/components/identity.passkeys/operations/list.d.ts +0 -7
  627. package/components/identity.passkeys/operations/list.js.map +0 -1
  628. package/components/identity.passkeys/operations/types/Configuration.d.ts +0 -6
  629. package/components/identity.passkeys/operations/types/Configuration.js.map +0 -1
  630. package/components/identity.passkeys/operations/types/Context.d.ts +0 -15
  631. package/components/identity.passkeys/operations/types/Context.js.map +0 -1
  632. package/components/identity.passkeys/operations/types/Passkey.d.ts +0 -12
  633. package/components/identity.passkeys/operations/types/Passkey.js.map +0 -1
  634. package/components/identity.passkeys/operations/types/index.d.ts +0 -2
  635. package/components/identity.passkeys/operations/types/index.js.map +0 -1
  636. package/components/identity.passkeys/operations/use.d.ts +0 -16
  637. package/components/identity.passkeys/operations/use.js.map +0 -1
  638. package/components/identity.roles/operations/grant.d.ts +0 -10
  639. package/components/identity.roles/operations/grant.js.map +0 -1
  640. package/components/identity.roles/operations/lib/Entity.d.ts +0 -5
  641. package/components/identity.roles/operations/lib/Entity.js.map +0 -1
  642. package/components/identity.roles/operations/list.d.ts +0 -2
  643. package/components/identity.roles/operations/list.js.map +0 -1
  644. package/components/identity.roles/operations/principal.d.ts +0 -13
  645. package/components/identity.roles/operations/principal.js.map +0 -1
  646. package/components/identity.tokens/operations/authenticate.d.ts +0 -9
  647. package/components/identity.tokens/operations/authenticate.js.map +0 -1
  648. package/components/identity.tokens/operations/decrypt.d.ts +0 -15
  649. package/components/identity.tokens/operations/decrypt.js.map +0 -1
  650. package/components/identity.tokens/operations/encrypt.d.ts +0 -8
  651. package/components/identity.tokens/operations/encrypt.js.map +0 -1
  652. package/components/identity.tokens/operations/issue.d.ts +0 -24
  653. package/components/identity.tokens/operations/issue.js.map +0 -1
  654. package/components/identity.tokens/operations/lib/index.d.ts +0 -3
  655. package/components/identity.tokens/operations/lib/index.js.map +0 -1
  656. package/components/identity.tokens/operations/lib/jose.d.ts +0 -1
  657. package/components/identity.tokens/operations/lib/jose.js.map +0 -1
  658. package/components/identity.tokens/operations/lib/key.d.ts +0 -1
  659. package/components/identity.tokens/operations/lib/key.js.map +0 -1
  660. package/components/identity.tokens/operations/lib/pad.d.ts +0 -1
  661. package/components/identity.tokens/operations/lib/pad.js.map +0 -1
  662. package/components/identity.tokens/operations/lib/types.d.ts +0 -88
  663. package/components/identity.tokens/operations/lib/types.js +0 -2
  664. package/components/identity.tokens/operations/lib/types.js.map +0 -1
  665. package/components/identity.tokens/operations/revoke.d.ts +0 -2
  666. package/components/identity.tokens/operations/revoke.js.map +0 -1
  667. package/components/identity.tokens/source/lib/types.ts +0 -102
@@ -0,0 +1,67 @@
1
+ import * as http from '../HTTP/index.js';
2
+ import { JSONRPC } from './types.js';
3
+ /* The five JSON-RPC 2.0 fixes, which mean the same to every client. */
4
+ export const PARSE = -32700;
5
+ export const INVALID_REQUEST = -32600;
6
+ export const METHOD_NOT_FOUND = -32601;
7
+ export const INVALID_PARAMS = -32602;
8
+ export const INTERNAL = -32603;
9
+ /*
10
+ * MCP's own. It reserves -32020 to -32099 for the specification and tells an implementation
11
+ * to use nothing of -32000 to -32019 at all — which is where this gateway's JSON-RPC codes
12
+ * sit, so none of them is answered here.
13
+ */
14
+ export const HEADER_MISMATCH = -32020;
15
+ export const MISSING_CAPABILITY = -32021;
16
+ export const UNSUPPORTED_VERSION = -32022;
17
+ export function failure(code, message, data) {
18
+ const value = { code, message };
19
+ if (data !== undefined)
20
+ value.data = data;
21
+ return value;
22
+ }
23
+ export function response(id, error) {
24
+ return { jsonrpc: JSONRPC, id, error };
25
+ }
26
+ /**
27
+ * What an exception says as a JSON-RPC error.
28
+ *
29
+ * The readable text is `body`, never `message`: `http.Exception` calls `super()` with no
30
+ * argument, so every one of them carries an empty `message`.
31
+ */
32
+ export function of(exception) {
33
+ if (exception instanceof http.NotFound || exception instanceof http.MethodNotAllowed)
34
+ return failure(METHOD_NOT_FOUND, text(exception, 'Method not found'));
35
+ if (exception instanceof http.BadRequest)
36
+ return failure(INVALID_PARAMS, text(exception, 'Invalid params'));
37
+ return failure(INTERNAL, 'Internal error');
38
+ }
39
+ /**
40
+ * What the call was refused with, which a model reads and may correct itself by: what the
41
+ * operation said, where it said anything, and otherwise what the status means here.
42
+ */
43
+ export function refusal(exception) {
44
+ const body = exception.body;
45
+ if (typeof body !== 'object' || body === null || typeof body.code !== 'string')
46
+ return text(exception, REFUSALS[exception.status] ?? 'Refused');
47
+ const message = body.message;
48
+ return typeof message === 'string' && message !== '' ? message : body.code;
49
+ }
50
+ /**
51
+ * A refusal a model can act on, where the reply carried no words of its own. `auth` does
52
+ * not say which of its directives refused, and `auth:id` is what most of them are: a call
53
+ * naming a record that is not the caller's is the likeliest thing to have gone wrong.
54
+ */
55
+ const REFUSALS = {
56
+ 400: 'The arguments were refused',
57
+ 403: "Not authorized. If an argument names an identity or a record, it may not be the caller's own",
58
+ 404: 'There is nothing at that address',
59
+ 409: 'The record changed while the call was made',
60
+ 429: 'Too many calls'
61
+ };
62
+ function text(exception, fallback) {
63
+ return typeof exception.body === 'string' && exception.body !== ''
64
+ ? exception.body
65
+ : fallback;
66
+ }
67
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../source/MCP/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,OAAO,EAA+B,MAAM,YAAY,CAAA;AAEjE,uEAAuE;AACvE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAK,CAAA;AAC3B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,CAAA;AACrC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAA;AACtC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,CAAA;AACpC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAA;AAE9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,CAAA;AACrC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,CAAA;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAK,CAAA;AAEzC,MAAM,UAAU,OAAO,CAAE,IAAY,EAAE,OAAe,EAAE,IAAc;IACpE,MAAM,KAAK,GAAY,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;IAExC,IAAI,IAAI,KAAK,SAAS;QACpB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAA;IAEnB,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,UAAU,QAAQ,CAAE,EAA0B,EAAE,KAAc;IAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAA;AACxC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,EAAE,CAAE,SAAkB;IACpC,IAAI,SAAS,YAAY,IAAI,CAAC,QAAQ,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
1
+ export { Server } from './Server.js';
@@ -0,0 +1,2 @@
1
+ export { Server } from './Server.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/MCP/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,18 @@
1
+ import type { Introspection } from '../Introspection.js';
2
+ import type { Annotations } from './types.js';
3
+ /**
4
+ * What a tool takes, which is what the procedure takes: a route variable by the name the
5
+ * template gives it, the querystring under a name of its own, and what is left is the body.
6
+ *
7
+ * A `map:headers` property is not here: a call carries no headers of its own, so there is
8
+ * nowhere for a model to put one.
9
+ */
10
+ export declare function input(introspection: Introspection, variables: string[]): object;
11
+ /**
12
+ * What a tool answers with, where that is worth stating. An operation's `output` is optional
13
+ * and normalizes to `{}`, which describes nothing — and a schema the revision would have the
14
+ * reply validated against is worse said emptily than left unsaid.
15
+ */
16
+ export declare function output(introspection: Introspection): object | undefined;
17
+ /** What the verb says of the call, which the revision has a client treat as a hint. */
18
+ export declare function annotations(verb: string): Annotations | undefined;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * What a tool takes, which is what the procedure takes: a route variable by the name the
3
+ * template gives it, the querystring under a name of its own, and what is left is the body.
4
+ *
5
+ * A `map:headers` property is not here: a call carries no headers of its own, so there is
6
+ * nowhere for a model to put one.
7
+ */
8
+ export function input(introspection, variables) {
9
+ const properties = {};
10
+ const required = [];
11
+ /*
12
+ * By the name the template gives it, which is what the tool's own name states and what
13
+ * resolving it consumes. A `map:segments` renaming is the gateway's, as invisible here as
14
+ * it is to whoever writes the path; and a variable the operation does not declare has no
15
+ * schema of its own, being a segment.
16
+ */
17
+ for (const variable of variables) {
18
+ properties[variable] = introspection.route?.[variable] ?? { type: 'string' };
19
+ required.push(variable);
20
+ }
21
+ // it is a querystring on the wire, which is nothing a model knows or needs to; what it
22
+ // is to a caller is the part of a call that picks what the call is about
23
+ if (introspection.query !== undefined)
24
+ properties.query = {
25
+ type: 'object',
26
+ description: 'Which records the call works on: what to match, in what order, ' +
27
+ 'and how many at once.',
28
+ properties: introspection.query
29
+ };
30
+ const body = introspection.input;
31
+ if (body?.properties !== undefined) {
32
+ Object.assign(properties, body.properties);
33
+ required.push(...body.required ?? []);
34
+ }
35
+ const schema = { type: 'object', properties };
36
+ if (required.length > 0)
37
+ schema.required = required;
38
+ // what a name does not state is not a parameter, and a model should not invent one
39
+ schema.additionalProperties = false;
40
+ return schema;
41
+ }
42
+ /**
43
+ * What a tool answers with, where that is worth stating. An operation's `output` is optional
44
+ * and normalizes to `{}`, which describes nothing — and a schema the revision would have the
45
+ * reply validated against is worse said emptily than left unsaid.
46
+ */
47
+ export function output(introspection) {
48
+ const schema = introspection.output;
49
+ if (schema === undefined || schema === null)
50
+ return undefined;
51
+ return Object.keys(schema).length === 0 ? undefined : schema;
52
+ }
53
+ /** What the verb says of the call, which the revision has a client treat as a hint. */
54
+ export function annotations(verb) {
55
+ const value = {};
56
+ if (verb === 'GET' || verb === 'HEAD')
57
+ value.readOnlyHint = true;
58
+ if (verb === 'DELETE')
59
+ value.destructiveHint = true;
60
+ if (verb === 'PUT' || verb === 'DELETE')
61
+ value.idempotentHint = true;
62
+ return Object.keys(value).length === 0 ? undefined : value;
63
+ }
64
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../source/MCP/schema.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAE,aAA4B,EAAE,SAAmB;IACtE,MAAM,UAAU,GAA4B,EAAE,CAAA;IAC9C,MAAM,QAAQ,GAAa,EAAE,CAAA;IAE7B;;;;;OAKG;IACH,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,IAAI,EA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AgB,EAAE,CAAA;IAE7B,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,MAAM;QACnC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA;IAE3B,IAAI,IAAI,KAAK,QAAQ;QACnB,KAAK,CAAC,eAAe,GAAG,IAAI,CAAA;IAE9B,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,QAAQ;QACrC,KAAK,CAAC,cAAc,GAAG,IAAI,CAAA;IAE7B,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAA;AAC5D,CAAC"}
@@ -0,0 +1,31 @@
1
+ import * as http from '../HTTP/index.js';
2
+ import type { Tree } from '../RTD/index.js';
3
+ import type { Params, Result, Tool } from './types.js';
4
+ /**
5
+ * Every method this caller may reach that is published as a tool, named as the procedure
6
+ * it is.
7
+ *
8
+ * A method is a tool where it says so with `mcp:tool`, and a default denies: a tree holds
9
+ * what an application serves, and most of it is machinery a model has no business reading.
10
+ * What a caller may then do with one is what `auth` says. The tree is walked once and each
11
+ * method describes itself, which is where that is decided and where `io` and `map` say what
12
+ * may be sent.
13
+ *
14
+ * Sorted, because the revision asks for an order a client can cache on.
15
+ */
16
+ export declare function list(tree: Tree, context: http.Context): Promise<Tool[]>;
17
+ /**
18
+ * The call the tool is. Its arguments are the procedure's parameters, taken apart the way a
19
+ * request carries them, and what answers is the same `route` an ordinary request goes to.
20
+ *
21
+ * A name that is not a published tool is answered as no tool at all, whether or not a route
22
+ * would have taken it: what an application did not publish is not reachable here by guessing
23
+ * its name. What the caller may then do with one that is published is still `auth`'s to say.
24
+ */
25
+ export declare function call(scope: Scope, named: string, args: Params): Promise<Result>;
26
+ /** Everything a call needs that is not the call: the request it is of, and what answers it. */
27
+ export interface Scope {
28
+ context: http.Context;
29
+ route: http.Processor;
30
+ tree: Tree;
31
+ }
@@ -0,0 +1,121 @@
1
+ import * as http from '../HTTP/index.js';
2
+ import { fork } from '../RPC/Context.js';
3
+ import { address, name, split } from '../RPC/names.js';
4
+ import { METHOD_NOT_FOUND, failure, refusal, response } from './errors.js';
5
+ import { annotations, input, output } from './schema.js';
6
+ import { FAMILY, MCP } from '../directives/mcp/index.js';
7
+ /**
8
+ * Every method this caller may reach that is published as a tool, named as the procedure
9
+ * it is.
10
+ *
11
+ * A method is a tool where it says so with `mcp:tool`, and a default denies: a tree holds
12
+ * what an application serves, and most of it is machinery a model has no business reading.
13
+ * What a caller may then do with one is what `auth` says. The tree is walked once and each
14
+ * method describes itself, which is where that is decided and where `io` and `map` say what
15
+ * may be sent.
16
+ *
17
+ * Sorted, because the revision asks for an order a client can cache on.
18
+ */
19
+ export async function list(tree, context) {
20
+ const tools = [];
21
+ /*
22
+ * Each method is described as the procedure it would be, not as the request asking. What
23
+ * refuses a credentialed request at an `anonymous` route does not refuse the call a tool
24
+ * makes, and a list that says otherwise disagrees with what `tools/call` then does.
25
+ */
26
+ const describing = Object.create(context, { procedural: { value: true, enumerable: true } });
27
+ for (const { segments, verb, method } of tree.walk()) {
28
+ if (MCP.published(method.directives.declared(FAMILY)) === null)
29
+ continue;
30
+ const named = name(segments, verb);
31
+ // a route a name cannot spell is a route nothing addresses, here or at `/.rpc`
32
+ if (named === null)
33
+ continue;
34
+ const variables = parameters(segments);
35
+ const introspection = await method.explain(describing, variables);
36
+ if (introspection === null)
37
+ continue;
38
+ const described = introspection.description;
39
+ const schema = output(introspection);
40
+ const hints = annotations(verb);
41
+ // in the order the revision documents one, which is the order it is read in
42
+ const tool = {
43
+ name: named,
44
+ ...described === undefined ? {} : { description: described },
45
+ inputSchema: input(introspection, variables.map((variable) => variable.name)),
46
+ ...schema === undefined ? {} : { outputSchema: schema },
47
+ ...hints === undefined ? {} : { annotations: hints }
48
+ };
49
+ tools.push(tool);
50
+ }
51
+ return tools.sort((one, other) => one.name < other.name ? -1 : 1);
52
+ }
53
+ /**
54
+ * The call the tool is. Its arguments are the procedure's parameters, taken apart the way a
55
+ * request carries them, and what answers is the same `route` an ordinary request goes to.
56
+ *
57
+ * A name that is not a published tool is answered as no tool at all, whether or not a route
58
+ * would have taken it: what an application did not publish is not reachable here by guessing
59
+ * its name. What the caller may then do with one that is published is still `auth`'s to say.
60
+ */
61
+ export async function call(scope, named, args) {
62
+ if (!published(scope.tree, named))
63
+ throw new http.NotFound(response(null, failure(METHOD_NOT_FOUND, `'${named}' is not a tool this server publishes`)));
64
+ const { path, verb, variables } = address(named, args);
65
+ const { query, input: body } = split(args, variables);
66
+ const clone = fork(scope.context, path, verb, query, body);
67
+ try {
68
+ const message = await scope.route(clone);
69
+ // what `io:output` restricts, over this call's reply rather than the envelope
70
+ await http.shape(clone, message);
71
+ return result(message.body);
72
+ }
73
+ catch (exception) {
74
+ /*
75
+ * What the route made of this call is a value a model reads and may correct itself by:
76
+ * an operation that refused, an argument `io:input` would not take, a record that is
77
+ * not there, an identity `auth` would not let it act on. A credential is none of those
78
+ * — that is the client's to fix and not the model's, so it is answered as it is — and
79
+ * neither is a fault of this server, which is a protocol error and stays one.
80
+ */
81
+ if (exception instanceof http.ClientError && !(exception instanceof http.Unauthorized))
82
+ return { content: [{ type: 'text', text: refusal(exception) }], isError: true };
83
+ throw exception;
84
+ }
85
+ }
86
+ /**
87
+ * Whether the tree publishes this name as a tool. What `auth` makes of the caller is not
88
+ * asked here — the declaration is the route's and does not vary by who is calling, and the
89
+ * call that follows is authorized as any request to that route is.
90
+ */
91
+ function published(tree, named) {
92
+ for (const { segments, verb, method } of tree.walk())
93
+ if (name(segments, verb) === named)
94
+ return MCP.published(method.directives.declared(FAMILY)) !== null;
95
+ return false;
96
+ }
97
+ function result(body) {
98
+ if (body === undefined || body === null)
99
+ return { content: [] };
100
+ return {
101
+ content: [{ type: 'text', text: JSON.stringify(body) }],
102
+ structuredContent: body
103
+ };
104
+ }
105
+ /**
106
+ * What a route template takes, by name. Describing has no values for them — a template is
107
+ * not a path — and nothing that describes a method reads one.
108
+ */
109
+ function parameters(segments) {
110
+ const params = [];
111
+ for (const segment of segments) {
112
+ if (segment.fragment !== null)
113
+ continue;
114
+ if (segment.wildcard === true)
115
+ params.push({ name: '**', value: '' });
116
+ else if (segment.placeholder !== null)
117
+ params.push({ name: segment.placeholder, value: '' });
118
+ }
119
+ return params;
120
+ }
121
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../source/MCP/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,GAAG,EAA4B,MAAM,4BAA4B,CAAA;AAKlF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAE,IAAU,EAAE,OAAqB;IAC3D,MAAM,KAAK,GAAW,EAAE,CAAA;IAExB;;;;OAIG;IACH,MAAM,UAAU,GAAiB,MAAM,CAAC,MAAM,CAAC,OAAO,EACpD,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;IAEpD,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACrD,IAAI,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAc,MAAM,CAAC,CAAC,KAAK,IAAI;YACzE,SAAQ;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= "2026-07-28";
3
+ /** The newest revision reached by an `initialize` handshake, which is what clients still send. */
4
+ export declare const LEGACY = "2025-11-25";
5
+ export declare const VERSIONS: string[];
6
+ /** The version every JSON-RPC message states, which is not the protocol's. */
7
+ export declare const JSONRPC = "2.0";
8
+ /** The prefix the revision reserves for itself in `_meta`. */
9
+ export declare const RESERVED = "io.modelcontextprotocol/";
10
+ export declare const PROTOCOL_VERSION: string;
11
+ export declare const CLIENT_CAPABILITIES: string;
12
+ export declare const SERVER_INFO: string;
13
+ export type Params = Record<string, unknown>;
14
+ export interface Message {
15
+ jsonrpc: string;
16
+ method: string;
17
+ params?: Params;
18
+ /** Absent makes this a notification, which is answered by not answering. */
19
+ id?: string | number;
20
+ }
21
+ export interface Failure {
22
+ code: number;
23
+ message: string;
24
+ data?: unknown;
25
+ }
26
+ export interface Response {
27
+ jsonrpc: string;
28
+ id: string | number | null;
29
+ result?: unknown;
30
+ error?: Failure;
31
+ }
32
+ /**
33
+ * How long a complete result may be held, and by whom. `private` is a result that is the
34
+ * caller's alone — a list `auth` filtered for their identity is not another caller's list.
35
+ */
36
+ export interface Cache {
37
+ ttlMs: number;
38
+ cacheScope: 'public' | 'private';
39
+ }
40
+ /** What a tool answers with: what a model reads, and the reply itself. */
41
+ export interface Result {
42
+ content: Content[];
43
+ structuredContent?: unknown;
44
+ /** The operation refused, which is something a model can read and correct. */
45
+ isError?: boolean;
46
+ }
47
+ export interface Content {
48
+ type: 'text';
49
+ text: string;
50
+ }
51
+ export interface Tool {
52
+ name: string;
53
+ /** what the operation states it is; absent where it states nothing */
54
+ description?: string;
55
+ inputSchema: object;
56
+ outputSchema?: object;
57
+ annotations?: Annotations;
58
+ }
59
+ /** What the verb says about the call, which the revision asks a client to treat as a hint. */
60
+ export interface Annotations {
61
+ readOnlyHint?: boolean;
62
+ destructiveHint?: boolean;
63
+ idempotentHint?: boolean;
64
+ }
@@ -0,0 +1,13 @@
1
+ /** The revision this endpoint serves, where a request carries its own metadata. */
2
+ export const MODERN = '2026-07-28';
3
+ /** The newest revision reached by an `initialize` handshake, which is what clients still send. */
4
+ export const LEGACY = '2025-11-25';
5
+ export const VERSIONS = [MODERN, LEGACY];
6
+ /** The version every JSON-RPC message states, which is not the protocol's. */
7
+ export const JSONRPC = '2.0';
8
+ /** The prefix the revision reserves for itself in `_meta`. */
9
+ export const RESERVED = 'io.modelcontextprotocol/';
10
+ export const PROTOCOL_VERSION = RESERVED + 'protocolVersion';
11
+ export const CLIENT_CAPABILITIES = RESERVED + 'clientCapabilities';
12
+ export const SERVER_INFO = RESERVED + 'serverInfo';
13
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../source/MCP/types.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAA;AAElC,kGAAkG;AAClG,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAA;AAElC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAExC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAA;AAE5B,8DAA8D;AAC9D,MAAM,CAAC,MAAM,QAAQ,GAAG,0BAA0B,CAAA;AAElD,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,GAAG,iBAAiB,CAAA;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,GAAG,oBAAoB,CAAA;AAClE,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,GAAG,YAAY,CAAA"}
@@ -12,6 +12,13 @@ export declare class Query {
12
12
  private readonly searchable;
13
13
  constructor(query: syntax.Query);
14
14
  fit(query: http.Query, parameters: Parameter[]): QueryString;
15
+ /**
16
+ * What the querystring carries: the parameters this method declares, taken out of the
17
+ * input because they are not the body's, and what a queryable method accepts besides.
18
+ *
19
+ * Only what it actually accepts — a criteria the declaration closes is refused, and so is
20
+ * a search where none was asked for.
21
+ */
15
22
  explain(introspection: Introspection): Record<string, Schema> | null;
16
23
  private split;
17
24
  private fitCriteria;
@@ -3,6 +3,7 @@ import { quote } from '@toa.io/generic';
3
3
  import * as http from './HTTP/index.js';
4
4
  import * as schemas from './schemas.js';
5
5
  import { queryable } from './Mapping.js';
6
+ import { take } from './Introspection.js';
6
7
  export class Query {
7
8
  parameterized;
8
9
  query;
@@ -49,18 +50,34 @@ export class Query {
49
50
  parameters: qs.parameters
50
51
  };
51
52
  }
53
+ /**
54
+ * What the querystring carries: the parameters this method declares, taken out of the
55
+ * input because they are not the body's, and what a queryable method accepts besides.
56
+ *
57
+ * Only what it actually accepts — a criteria the declaration closes is refused, and so is
58
+ * a search where none was asked for.
59
+ */
52
60
  explain(introspection) {
53
- if (this.query?.parameters === undefined || introspection.input?.type !== 'object')
54
- return null;
55
61
  let query = null;
56
- for (const parameter of this.query.parameters) {
57
- const schema = introspection.input.properties[parameter];
58
- if (schema !== undefined) {
62
+ if (this.query?.parameters !== undefined)
63
+ for (const parameter of this.query.parameters) {
64
+ const schema = take(introspection, parameter);
65
+ // eslint-disable-next-line max-depth
66
+ if (schema === undefined)
67
+ continue;
59
68
  query ??= {};
60
69
  query[parameter] = schema;
61
70
  }
62
- delete introspection.input.properties[parameter];
63
- }
71
+ if (!this.queryable)
72
+ return query;
73
+ query ??= {};
74
+ if (!this.closed)
75
+ query.criteria = keyword('string', 'What to match, in RSQL: `state==hot`, `rank=gt=5;name==*tea*`.');
76
+ query.sort = keyword('string', 'What to order by: `rank:desc`, or `rank` for ascending.');
77
+ query.limit = bounded('How many at once.', this.query.limit);
78
+ query.omit = bounded('How many to skip.', this.query.omit);
79
+ if (this.searchable)
80
+ query.search = keyword('string', 'What to search the text index for.');
64
81
  return query;
65
82
  }
66
83
  split(query) {
@@ -141,4 +158,18 @@ function fit(string, range, name) {
141
158
  return number;
142
159
  }
143
160
  const WHATEVER = ';';
161
+ function keyword(type, description) {
162
+ return { type, description };
163
+ }
164
+ function bounded(description, bounds) {
165
+ const schema = {
166
+ type: 'integer',
167
+ description,
168
+ minimum: bounds.range[0],
169
+ maximum: bounds.range[1]
170
+ };
171
+ if (bounds.value !== undefined)
172
+ schema.default = bounds.value;
173
+ return schema;
174
+ }
144
175
  //# sourceMappingURL=Query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Query.js","sourceRoot":"","sources":["../source/Query.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AAEvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKxC,MAAM,OAAO,KAAK;IACA,aAAa,CAAS;IAErB,KAAK,CAAc;IACnB,MAAM,GAAY,KAAK,CAAA;IACvB,OAAO,GAAc,GAAG,CAAA;IACxB,SAAS,CAAS;IAClB,UAAU,CAAS;IAEpC,YAAoB,KAAmB;QACrC,IAAI,CAAC,aAAa,GAAG,KAAK,EAAE,UAAU,KAAK,SAAS,CAAA;QACpD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;QACjC,IAAI,CAAC,UAAU,GAAG,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;QAExC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,KAAK,CAAC,IAAI,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAA;YAC7C,KAAK,CAAC,KAAK,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA;YAE9C,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;gBACjC,qCAAqC;gBACrC,IAAI,KAAK,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AAG,GAAG,CAAA;AAOpB,SAAS,OAAO,CAAE,IAAY,EAAE,WAAmB;IACjD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAuB,CAAA;AACnD,CAAC;AAED,SAAS,OAAO,CAAE,WAAmB,EAAE,MAAoB;IACzD,MAAM,MAAM,GAA4B;QACtC,IAAI,EAAE,SAAS;QACf,WAAW;QACX,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;KACzB,CAAA;IAED,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;QAC5B,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAA;IAE/B,OAAO,MAA2B,CAAA;AACpC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import * as http from '../HTTP/index.js';
2
+ import type { Params } from './types.js';
3
+ /**
4
+ * One call, as a request the rest of the gateway can serve.
5
+ *
6
+ * The clone is the transport context except for what the call decides, so nothing
7
+ * downstream — the router, the directives, the endpoint, the mapping — knows it is one.
8
+ * It is derived from the context rather than built beside it, so everything not named
9
+ * here, `identity` included, is read through.
10
+ */
11
+ export declare function fork(context: http.Context, path: string, verb: string, query: Params | undefined, input: unknown): http.Context;
@@ -0,0 +1,63 @@
1
+ import * as http from '../HTTP/index.js';
2
+ import { Timing } from '../HTTP/Timing.js';
3
+ /**
4
+ * One call, as a request the rest of the gateway can serve.
5
+ *
6
+ * The clone is the transport context except for what the call decides, so nothing
7
+ * downstream — the router, the directives, the endpoint, the mapping — knows it is one.
8
+ * It is derived from the context rather than built beside it, so everything not named
9
+ * here, `identity` included, is read through.
10
+ */
11
+ // eslint-disable-next-line max-params
12
+ export function fork(context, path, verb, query, input) {
13
+ const url = new URL(path, context.url);
14
+ if (query !== undefined)
15
+ for (const [name, value] of Object.entries(query))
16
+ url.searchParams.set(name, String(value));
17
+ const headers = { ...context.request.headers };
18
+ // a conditional is the envelope's, and a call would answer 304 to a question nobody asked
19
+ delete headers['if-match'];
20
+ delete headers['if-none-match'];
21
+ const request = Object.create(context.request, {
22
+ method: { value: verb, enumerable: true },
23
+ headers: { value: headers, enumerable: true }
24
+ });
25
+ // its own, so an `io:output` restriction shapes this call's reply and no other
26
+ const pipelines = { body: [], response: [] };
27
+ return Object.create(context, {
28
+ /*
29
+ * A credential refuses an `anonymous` route because it would make the reply
30
+ * uncacheable. What a procedure answers is not a reply: it is a value in an envelope
31
+ * this gateway answers `no-store`, and the procedure's own headers are discarded.
32
+ */
33
+ procedural: { value: true, enumerable: true },
34
+ url: { value: url, enumerable: true },
35
+ request: { value: request, enumerable: true },
36
+ pipelines: { value: pipelines, enumerable: true },
37
+ /*
38
+ * Its own, so that what the stages of a call take is measured per call and stays there.
39
+ * `server-timing` is a header, and a request carrying thirty-two calls would otherwise
40
+ * write ninety-six values into one — where a trace says the same thing, per call.
41
+ */
42
+ timing: { value: new Timing(), enumerable: true },
43
+ body: {
44
+ value: async () => {
45
+ let value = input;
46
+ for (const transform of pipelines.body)
47
+ value = await transform(value);
48
+ return value;
49
+ }
50
+ },
51
+ /*
52
+ * The raw request is the envelope, and it has been read. `map:buffer` is the one
53
+ * directive that asks for it, and answering with a spent stream would hand the
54
+ * operation an empty string; refusing says what is actually the matter.
55
+ */
56
+ buffer: {
57
+ value: () => {
58
+ throw new http.BadRequest('`map:buffer` reads the request, which a call is not');
59
+ }
60
+ }
61
+ });
62
+ }
63
+ //# sourceMappingURL=Context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../source/RPC/Context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAG1C;;;;;;;GAOG;AACH,sCAAsC;AACtC,MAAM,UAAU,IAAI,CAAE,OAAqB,EAAE,IAAY,EAAE,IAAY,EACrE,KAAyB,EAAE,KAAc;IACzC,MAAM,G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AE,UAAU,EAAE,IAAI,EAAE;QACjD,IAAI,EAAE;YACJ,KAAK,EAAE,KAAK,IAAI,EAAE;gBAChB,IAAI,KAAK,GAAG,KAAK,CAAA;gBAEjB,KAAK,MAAM,SAAS,IAAI,SAAS,CAAC,IAAI;oBACpC,KAAK,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,CAAA;gBAEhC,OAAO,KAAK,CAAA;YACd,CAAC;SACF;QACD;;;;WAIG;QACH,MAAM,EAAE;YACN,KAAK,EAAE,GAAG,EAAE;gBACV,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,qDAAqD,CAAC,CAAA;YAClF,CAAC;SACF;KACF,CAAiB,CAAA;AACpB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import * as http from '../HTTP/index.js';
2
+ import type { RPC } from '../Annotation.js';
3
+ /**
4
+ * JSON-RPC, as the calls a request carries.
5
+ *
6
+ * It clones the context per call and hands each clone back to the gateway: it holds no
7
+ * tree, no index and no knowledge of routing. Whether a name resolves, what it resolves
8
+ * to, and what the directives of that route do are answered by the same `route` an
9
+ * ordinary request goes through.
10
+ */
11
+ export declare class Dispatcher {
12
+ private readonly batch;
13
+ constructor(options: RPC);
14
+ dispatch(context: http.Context, route: http.Processor): Promise<http.OutgoingMessage>;
15
+ private answer;
16
+ private call;
17
+ /** A body the decoder refuses is a parse error; a media type it does not know is not. */
18
+ private read;
19
+ }