@toa.io/extensions.exposition 1.0.0-alpha.3 → 1.0.0-alpha.31

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 (431) hide show
  1. package/components/context.toa.yaml +2 -2
  2. package/components/identity.bans/manifest.toa.yaml +15 -6
  3. package/components/identity.bans/operations/transit.d.ts +14 -0
  4. package/components/identity.bans/operations/transit.js +11 -0
  5. package/components/identity.bans/operations/transit.js.map +1 -0
  6. package/components/identity.bans/operations/tsconfig.tsbuildinfo +1 -0
  7. package/components/identity.bans/source/transit.ts +21 -0
  8. package/components/identity.bans/tsconfig.json +9 -0
  9. package/components/identity.basic/manifest.toa.yaml +21 -8
  10. package/components/identity.basic/operations/authenticate.d.ts +5 -1
  11. package/components/identity.basic/operations/authenticate.js +5 -2
  12. package/components/identity.basic/operations/authenticate.js.map +1 -1
  13. package/components/identity.basic/operations/incept.d.ts +12 -0
  14. package/components/identity.basic/operations/incept.js +20 -0
  15. package/components/identity.basic/operations/incept.js.map +1 -0
  16. package/components/identity.basic/operations/transit.d.ts +3 -3
  17. package/components/identity.basic/operations/transit.js +5 -3
  18. package/components/identity.basic/operations/transit.js.map +1 -1
  19. package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
  20. package/components/identity.basic/operations/types.d.ts +2 -0
  21. package/components/identity.basic/source/authenticate.ts +16 -5
  22. package/components/identity.basic/source/incept.ts +32 -0
  23. package/components/identity.basic/source/transit.ts +7 -5
  24. package/components/identity.basic/source/types.ts +2 -0
  25. package/components/identity.federation/manifest.toa.yaml +28 -17
  26. package/components/identity.federation/operations/authenticate.d.ts +2 -2
  27. package/components/identity.federation/operations/authenticate.js +6 -5
  28. package/components/identity.federation/operations/authenticate.js.map +1 -1
  29. package/components/identity.federation/operations/incept.d.ts +11 -0
  30. package/components/identity.federation/operations/{create.js → incept.js} +6 -7
  31. package/components/identity.federation/operations/incept.js.map +1 -0
  32. package/components/identity.federation/operations/lib/jwt.d.ts +4 -5
  33. package/components/identity.federation/operations/lib/jwt.js +3 -3
  34. package/components/identity.federation/operations/lib/jwt.js.map +1 -1
  35. package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
  36. package/components/identity.federation/operations/types/configuration.d.ts +15 -0
  37. package/components/identity.federation/operations/types/configuration.js +3 -0
  38. package/components/identity.federation/operations/types/configuration.js.map +1 -0
  39. package/components/identity.federation/operations/{types.d.ts → types/context.d.ts} +8 -3
  40. package/components/identity.federation/operations/types/context.js +3 -0
  41. package/components/identity.federation/operations/types/context.js.map +1 -0
  42. package/components/identity.federation/operations/types/entity.d.ts +6 -0
  43. package/components/identity.federation/operations/{types.js → types/entity.js} +1 -1
  44. package/components/identity.federation/operations/types/entity.js.map +1 -0
  45. package/components/identity.federation/operations/types/index.d.ts +3 -0
  46. package/components/identity.federation/operations/types/index.js +20 -0
  47. package/components/identity.federation/operations/types/index.js.map +1 -0
  48. package/components/identity.federation/source/authenticate.ts +10 -9
  49. package/components/identity.federation/source/{create.ts → incept.ts} +10 -9
  50. package/components/identity.federation/source/lib/jwt.test.ts +2 -2
  51. package/components/identity.federation/source/lib/jwt.ts +7 -8
  52. package/components/identity.federation/source/types/configuration.ts +16 -0
  53. package/components/identity.federation/source/{types.ts → types/context.ts} +9 -4
  54. package/components/identity.federation/source/types/entity.ts +6 -0
  55. package/components/identity.federation/source/types/index.ts +3 -0
  56. package/components/identity.federation/tsconfig.json +2 -2
  57. package/components/identity.roles/manifest.toa.yaml +18 -5
  58. package/components/identity.roles/operations/grant.d.ts +10 -0
  59. package/components/identity.roles/operations/grant.js +21 -0
  60. package/components/identity.roles/operations/grant.js.map +1 -0
  61. package/components/identity.roles/operations/lib/Entity.d.ts +5 -0
  62. package/components/identity.roles/operations/lib/Entity.js +3 -0
  63. package/components/identity.roles/operations/lib/Entity.js.map +1 -0
  64. package/components/identity.roles/operations/list.d.ts +1 -4
  65. package/components/identity.roles/operations/list.js.map +1 -1
  66. package/components/identity.roles/operations/principal.d.ts +4 -6
  67. package/components/identity.roles/operations/principal.js +6 -1
  68. package/components/identity.roles/operations/principal.js.map +1 -1
  69. package/components/identity.roles/operations/tsconfig.tsbuildinfo +1 -1
  70. package/components/identity.roles/source/grant.ts +32 -0
  71. package/components/identity.roles/source/lib/Entity.ts +5 -0
  72. package/components/identity.roles/source/list.ts +2 -4
  73. package/components/identity.roles/source/principal.ts +10 -8
  74. package/components/identity.tokens/manifest.toa.yaml +19 -4
  75. package/components/identity.tokens/operations/authenticate.d.ts +2 -2
  76. package/components/identity.tokens/operations/authenticate.js +10 -4
  77. package/components/identity.tokens/operations/authenticate.js.map +1 -1
  78. package/components/identity.tokens/operations/decrypt.js +1 -0
  79. package/components/identity.tokens/operations/decrypt.js.map +1 -1
  80. package/components/identity.tokens/operations/encrypt.js +5 -1
  81. package/components/identity.tokens/operations/encrypt.js.map +1 -1
  82. package/components/identity.tokens/operations/tsconfig.tsbuildinfo +1 -1
  83. package/components/identity.tokens/operations/types.d.ts +8 -2
  84. package/components/identity.tokens/receivers/identity.bans.created.js +3 -0
  85. package/components/identity.tokens/source/authenticate.test.ts +11 -4
  86. package/components/identity.tokens/source/authenticate.ts +12 -5
  87. package/components/identity.tokens/source/decrypt.test.ts +5 -3
  88. package/components/identity.tokens/source/decrypt.ts +9 -8
  89. package/components/identity.tokens/source/encrypt.test.ts +26 -2
  90. package/components/identity.tokens/source/encrypt.ts +5 -1
  91. package/components/identity.tokens/source/types.ts +9 -2
  92. package/components/octets.storage/manifest.toa.yaml +0 -6
  93. package/components/octets.storage/operations/store.js +1 -1
  94. package/documentation/access.md +27 -16
  95. package/documentation/authorities.md +53 -0
  96. package/documentation/cache.md +8 -1
  97. package/documentation/components.md +52 -27
  98. package/documentation/identity.md +17 -22
  99. package/documentation/io.md +56 -0
  100. package/documentation/protocol.md +3 -0
  101. package/documentation/query.md +57 -8
  102. package/documentation/require.md +15 -0
  103. package/documentation/tree.md +22 -4
  104. package/documentation/vary.md +14 -14
  105. package/entity.json +0 -0
  106. package/features/access.feature +83 -56
  107. package/features/annotation.feature +2 -0
  108. package/features/authorities.basic.feature +141 -0
  109. package/features/authorities.feature +32 -0
  110. package/features/authorities.federation.feature +99 -0
  111. package/features/authorities.tokens.feature +118 -0
  112. package/features/body.feature +5 -1
  113. package/features/cache.feature +78 -5
  114. package/features/cors.feature +6 -2
  115. package/features/debug.feature +34 -0
  116. package/features/directives.feature +5 -0
  117. package/features/dynamic.feature +18 -7
  118. package/features/errors.feature +19 -5
  119. package/features/etag.feature +103 -0
  120. package/features/identity.bans.feature +137 -0
  121. package/features/identity.basic.feature +137 -14
  122. package/features/identity.feature +7 -2
  123. package/features/identity.federation.feature +61 -8
  124. package/features/identity.roles.feature +220 -4
  125. package/features/identity.tokens.feature +114 -4
  126. package/features/io.feature +205 -0
  127. package/features/octets.entries.feature +11 -1
  128. package/features/octets.feature +60 -64
  129. package/features/octets.meta.feature +7 -3
  130. package/features/octets.workflows.feature +14 -0
  131. package/features/probes.feature +14 -0
  132. package/features/{queries.feature → query.feature} +50 -3
  133. package/features/require.feature +67 -0
  134. package/features/response.feature +12 -3
  135. package/features/routes.feature +25 -12
  136. package/features/steps/Database.ts +17 -10
  137. package/features/steps/Gateway.ts +24 -4
  138. package/features/steps/IdP.ts +28 -23
  139. package/features/steps/components/echo/manifest.toa.yaml +5 -0
  140. package/features/steps/components/echo/operations/identity.js +7 -0
  141. package/features/steps/components/greeter/manifest.toa.yaml +1 -0
  142. package/features/steps/components/octets.tester/manifest.toa.yaml +1 -0
  143. package/features/steps/components/pots/manifest.toa.yaml +12 -3
  144. package/features/steps/components/sequences/manifest.toa.yaml +1 -0
  145. package/features/steps/components/users.properties/manifest.toa.yaml +2 -1
  146. package/features/streams.feature +1 -0
  147. package/features/timing.feature +69 -0
  148. package/features/vary.feature +105 -3
  149. package/package.json +12 -14
  150. package/readme.md +19 -13
  151. package/schemas/annotation.cos.yaml +2 -1
  152. package/schemas/io/input.cos.yaml +3 -0
  153. package/schemas/io/message.cos.yaml +5 -0
  154. package/schemas/io/output.cos.yaml +5 -0
  155. package/schemas/querystring.cos.yaml +1 -0
  156. package/source/Annotation.ts +3 -2
  157. package/source/Context.ts +6 -4
  158. package/source/Directive.test.ts +7 -7
  159. package/source/Directive.ts +19 -46
  160. package/source/Endpoint.ts +55 -6
  161. package/source/Factory.ts +17 -9
  162. package/source/Gateway.ts +38 -53
  163. package/source/HTTP/Context.ts +89 -0
  164. package/source/HTTP/Server.ts +99 -121
  165. package/source/HTTP/Timing.ts +40 -0
  166. package/source/HTTP/exceptions.ts +7 -1
  167. package/source/HTTP/index.ts +1 -0
  168. package/source/HTTP/messages.test.ts +27 -8
  169. package/source/HTTP/messages.ts +32 -48
  170. package/source/Mapping.ts +12 -8
  171. package/source/Query.test.ts +1 -1
  172. package/source/Query.ts +35 -24
  173. package/source/RTD/Context.ts +7 -10
  174. package/source/RTD/Directives.ts +28 -4
  175. package/source/RTD/Endpoint.ts +6 -4
  176. package/source/RTD/Match.ts +2 -7
  177. package/source/RTD/Method.ts +7 -13
  178. package/source/RTD/Node.ts +13 -14
  179. package/source/RTD/Tree.ts +17 -16
  180. package/source/RTD/factory.ts +3 -6
  181. package/source/Tenant.ts +0 -8
  182. package/source/deployment.ts +33 -17
  183. package/source/directives/auth/Anonymous.ts +3 -2
  184. package/source/directives/auth/Authorization.ts +34 -21
  185. package/source/directives/auth/Delegate.ts +35 -0
  186. package/source/directives/auth/Incept.ts +13 -7
  187. package/source/directives/auth/Role.test.ts +53 -6
  188. package/source/directives/auth/Role.ts +27 -17
  189. package/source/directives/auth/Scheme.ts +2 -2
  190. package/source/directives/auth/types.ts +1 -1
  191. package/source/directives/cache/Cache.ts +5 -5
  192. package/source/directives/cache/Control.ts +48 -22
  193. package/source/directives/cache/types.ts +1 -1
  194. package/source/directives/cors/CORS.ts +18 -10
  195. package/source/directives/dev/Development.ts +4 -4
  196. package/source/directives/index.ts +6 -4
  197. package/source/directives/io/Directive.ts +11 -0
  198. package/source/directives/io/IO.ts +43 -0
  199. package/source/directives/io/Input.ts +50 -0
  200. package/source/directives/io/Message.ts +1 -0
  201. package/source/directives/io/Output.ts +69 -0
  202. package/source/directives/io/index.ts +3 -0
  203. package/source/directives/io/schemas.ts +12 -0
  204. package/source/directives/octets/Context.ts +5 -4
  205. package/source/directives/octets/Delete.ts +23 -11
  206. package/source/directives/octets/Directive.ts +10 -0
  207. package/source/directives/octets/Fetch.ts +33 -17
  208. package/source/directives/octets/List.ts +18 -8
  209. package/source/directives/octets/Octets.ts +9 -9
  210. package/source/directives/octets/Store.ts +29 -19
  211. package/source/directives/octets/Workflow.ts +12 -5
  212. package/source/directives/octets/types.ts +0 -7
  213. package/source/directives/octets/workflows/Workflow.ts +2 -2
  214. package/source/directives/require/Directive.ts +5 -0
  215. package/source/directives/require/Headers.ts +20 -0
  216. package/source/directives/require/Require.ts +28 -0
  217. package/source/directives/require/index.ts +3 -0
  218. package/source/directives/vary/Directive.ts +2 -1
  219. package/source/directives/vary/Embed.ts +14 -8
  220. package/source/directives/vary/Vary.ts +8 -6
  221. package/source/directives/vary/embeddings/Authority.ts +8 -0
  222. package/source/directives/vary/embeddings/Embedding.ts +2 -1
  223. package/source/directives/vary/embeddings/Header.ts +9 -7
  224. package/source/directives/vary/embeddings/Language.ts +2 -2
  225. package/source/directives/vary/embeddings/Parameter.ts +14 -0
  226. package/source/directives/vary/embeddings/index.ts +6 -4
  227. package/source/exceptions.ts +22 -11
  228. package/source/io.ts +2 -2
  229. package/source/root.ts +5 -0
  230. package/source/schemas.ts +1 -1
  231. package/transpiled/Annotation.d.ts +3 -2
  232. package/transpiled/Context.d.ts +6 -4
  233. package/transpiled/Directive.d.ts +8 -21
  234. package/transpiled/Directive.js +11 -14
  235. package/transpiled/Directive.js.map +1 -1
  236. package/transpiled/Endpoint.d.ts +7 -5
  237. package/transpiled/Endpoint.js +60 -2
  238. package/transpiled/Endpoint.js.map +1 -1
  239. package/transpiled/Factory.js +11 -4
  240. package/transpiled/Factory.js.map +1 -1
  241. package/transpiled/Gateway.d.ts +4 -8
  242. package/transpiled/Gateway.js +25 -35
  243. package/transpiled/Gateway.js.map +1 -1
  244. package/transpiled/HTTP/Context.d.ts +31 -0
  245. package/transpiled/HTTP/Context.js +60 -0
  246. package/transpiled/HTTP/Context.js.map +1 -0
  247. package/transpiled/HTTP/Server.d.ts +21 -9
  248. package/transpiled/HTTP/Server.js +98 -100
  249. package/transpiled/HTTP/Server.js.map +1 -1
  250. package/transpiled/HTTP/Timing.d.ts +10 -0
  251. package/transpiled/HTTP/Timing.js +29 -0
  252. package/transpiled/HTTP/Timing.js.map +1 -0
  253. package/transpiled/HTTP/exceptions.d.ts +4 -1
  254. package/transpiled/HTTP/exceptions.js +7 -1
  255. package/transpiled/HTTP/exceptions.js.map +1 -1
  256. package/transpiled/HTTP/index.d.ts +1 -0
  257. package/transpiled/HTTP/index.js +1 -0
  258. package/transpiled/HTTP/index.js.map +1 -1
  259. package/transpiled/HTTP/messages.d.ts +7 -21
  260. package/transpiled/HTTP/messages.js +24 -26
  261. package/transpiled/HTTP/messages.js.map +1 -1
  262. package/transpiled/Mapping.js +11 -8
  263. package/transpiled/Mapping.js.map +1 -1
  264. package/transpiled/Query.d.ts +1 -0
  265. package/transpiled/Query.js +21 -20
  266. package/transpiled/Query.js.map +1 -1
  267. package/transpiled/RTD/Context.d.ts +7 -6
  268. package/transpiled/RTD/Directives.d.ts +19 -4
  269. package/transpiled/RTD/Endpoint.d.ts +6 -4
  270. package/transpiled/RTD/Match.d.ts +2 -4
  271. package/transpiled/RTD/Method.d.ts +7 -7
  272. package/transpiled/RTD/Method.js.map +1 -1
  273. package/transpiled/RTD/Node.d.ts +4 -6
  274. package/transpiled/RTD/Node.js +2 -1
  275. package/transpiled/RTD/Node.js.map +1 -1
  276. package/transpiled/RTD/Tree.d.ts +6 -6
  277. package/transpiled/RTD/Tree.js +4 -1
  278. package/transpiled/RTD/Tree.js.map +1 -1
  279. package/transpiled/RTD/factory.d.ts +2 -4
  280. package/transpiled/RTD/factory.js +1 -1
  281. package/transpiled/RTD/factory.js.map +1 -1
  282. package/transpiled/Tenant.d.ts +0 -1
  283. package/transpiled/Tenant.js +0 -6
  284. package/transpiled/Tenant.js.map +1 -1
  285. package/transpiled/deployment.d.ts +1 -1
  286. package/transpiled/deployment.js +28 -15
  287. package/transpiled/deployment.js.map +1 -1
  288. package/transpiled/directives/auth/Anonymous.js +3 -4
  289. package/transpiled/directives/auth/Anonymous.js.map +1 -1
  290. package/transpiled/directives/auth/Authorization.d.ts +2 -3
  291. package/transpiled/directives/auth/Authorization.js +18 -11
  292. package/transpiled/directives/auth/Authorization.js.map +1 -1
  293. package/transpiled/directives/auth/Delegate.d.ts +8 -0
  294. package/transpiled/directives/auth/Delegate.js +29 -0
  295. package/transpiled/directives/auth/Delegate.js.map +1 -0
  296. package/transpiled/directives/auth/Incept.d.ts +1 -1
  297. package/transpiled/directives/auth/Incept.js +13 -7
  298. package/transpiled/directives/auth/Incept.js.map +1 -1
  299. package/transpiled/directives/auth/Role.d.ts +4 -1
  300. package/transpiled/directives/auth/Role.js +25 -17
  301. package/transpiled/directives/auth/Role.js.map +1 -1
  302. package/transpiled/directives/auth/Scheme.js +2 -2
  303. package/transpiled/directives/auth/Scheme.js.map +1 -1
  304. package/transpiled/directives/cache/Cache.d.ts +3 -3
  305. package/transpiled/directives/cache/Cache.js +3 -3
  306. package/transpiled/directives/cache/Cache.js.map +1 -1
  307. package/transpiled/directives/cache/Control.d.ts +5 -4
  308. package/transpiled/directives/cache/Control.js +32 -15
  309. package/transpiled/directives/cache/Control.js.map +1 -1
  310. package/transpiled/directives/cache/types.d.ts +1 -1
  311. package/transpiled/directives/cors/CORS.d.ts +2 -3
  312. package/transpiled/directives/cors/CORS.js +17 -10
  313. package/transpiled/directives/cors/CORS.js.map +1 -1
  314. package/transpiled/directives/dev/Development.d.ts +3 -3
  315. package/transpiled/directives/dev/Development.js +1 -1
  316. package/transpiled/directives/dev/Development.js.map +1 -1
  317. package/transpiled/directives/index.d.ts +2 -2
  318. package/transpiled/directives/index.js +5 -3
  319. package/transpiled/directives/index.js.map +1 -1
  320. package/transpiled/directives/io/Directive.d.ts +8 -0
  321. package/transpiled/directives/io/Directive.js +3 -0
  322. package/transpiled/directives/io/Directive.js.map +1 -0
  323. package/transpiled/directives/io/IO.d.ts +9 -0
  324. package/transpiled/directives/io/IO.js +33 -0
  325. package/transpiled/directives/io/IO.js.map +1 -0
  326. package/transpiled/directives/io/Input.d.ts +11 -0
  327. package/transpiled/directives/{octets/Permute.js → io/Input.js} +33 -21
  328. package/transpiled/directives/io/Input.js.map +1 -0
  329. package/transpiled/directives/io/Message.d.ts +1 -0
  330. package/transpiled/directives/io/Message.js +3 -0
  331. package/transpiled/directives/io/Message.js.map +1 -0
  332. package/transpiled/directives/io/Output.d.ts +13 -0
  333. package/transpiled/directives/io/Output.js +76 -0
  334. package/transpiled/directives/io/Output.js.map +1 -0
  335. package/transpiled/directives/io/index.d.ts +2 -0
  336. package/transpiled/directives/io/index.js +6 -0
  337. package/transpiled/directives/io/index.js.map +1 -0
  338. package/transpiled/directives/io/schemas.d.ts +7 -0
  339. package/transpiled/directives/io/schemas.js +14 -0
  340. package/transpiled/directives/io/schemas.js.map +1 -0
  341. package/transpiled/directives/octets/Context.d.ts +4 -4
  342. package/transpiled/directives/octets/Context.js +4 -2
  343. package/transpiled/directives/octets/Context.js.map +1 -1
  344. package/transpiled/directives/octets/Delete.d.ts +4 -3
  345. package/transpiled/directives/octets/Delete.js +22 -10
  346. package/transpiled/directives/octets/Delete.js.map +1 -1
  347. package/transpiled/directives/octets/Directive.d.ts +8 -0
  348. package/transpiled/directives/octets/Directive.js +8 -0
  349. package/transpiled/directives/octets/Directive.js.map +1 -0
  350. package/transpiled/directives/octets/Fetch.d.ts +4 -3
  351. package/transpiled/directives/octets/Fetch.js +31 -15
  352. package/transpiled/directives/octets/Fetch.js.map +1 -1
  353. package/transpiled/directives/octets/List.d.ts +4 -3
  354. package/transpiled/directives/octets/List.js +16 -7
  355. package/transpiled/directives/octets/List.js.map +1 -1
  356. package/transpiled/directives/octets/Octets.d.ts +4 -4
  357. package/transpiled/directives/octets/Octets.js +5 -5
  358. package/transpiled/directives/octets/Octets.js.map +1 -1
  359. package/transpiled/directives/octets/Store.d.ts +4 -3
  360. package/transpiled/directives/octets/Store.js +20 -13
  361. package/transpiled/directives/octets/Store.js.map +1 -1
  362. package/transpiled/directives/octets/Workflow.d.ts +4 -3
  363. package/transpiled/directives/octets/Workflow.js +11 -4
  364. package/transpiled/directives/octets/Workflow.js.map +1 -1
  365. package/transpiled/directives/octets/types.d.ts +0 -5
  366. package/transpiled/directives/octets/workflows/Workflow.d.ts +1 -1
  367. package/transpiled/directives/octets/workflows/Workflow.js +2 -2
  368. package/transpiled/directives/octets/workflows/Workflow.js.map +1 -1
  369. package/transpiled/directives/require/Directive.d.ts +4 -0
  370. package/transpiled/directives/require/Directive.js +3 -0
  371. package/transpiled/directives/require/Directive.js.map +1 -0
  372. package/transpiled/directives/require/Headers.d.ts +7 -0
  373. package/transpiled/directives/require/Headers.js +19 -0
  374. package/transpiled/directives/require/Headers.js.map +1 -0
  375. package/transpiled/directives/require/Require.d.ts +9 -0
  376. package/transpiled/directives/require/Require.js +27 -0
  377. package/transpiled/directives/require/Require.js.map +1 -0
  378. package/transpiled/directives/require/index.d.ts +2 -0
  379. package/transpiled/directives/require/index.js +6 -0
  380. package/transpiled/directives/require/index.js.map +1 -0
  381. package/transpiled/directives/vary/Directive.d.ts +2 -1
  382. package/transpiled/directives/vary/Embed.d.ts +2 -1
  383. package/transpiled/directives/vary/Embed.js +8 -6
  384. package/transpiled/directives/vary/Embed.js.map +1 -1
  385. package/transpiled/directives/vary/Vary.d.ts +3 -3
  386. package/transpiled/directives/vary/Vary.js +4 -4
  387. package/transpiled/directives/vary/Vary.js.map +1 -1
  388. package/transpiled/directives/vary/embeddings/Authority.d.ts +5 -0
  389. package/transpiled/directives/vary/embeddings/Authority.js +10 -0
  390. package/transpiled/directives/vary/embeddings/Authority.js.map +1 -0
  391. package/transpiled/directives/vary/embeddings/Embedding.d.ts +2 -1
  392. package/transpiled/directives/vary/embeddings/Header.js +9 -7
  393. package/transpiled/directives/vary/embeddings/Header.js.map +1 -1
  394. package/transpiled/directives/vary/embeddings/Language.js +2 -2
  395. package/transpiled/directives/vary/embeddings/Language.js.map +1 -1
  396. package/transpiled/directives/vary/embeddings/Parameter.d.ts +7 -0
  397. package/transpiled/directives/vary/embeddings/Parameter.js +14 -0
  398. package/transpiled/directives/vary/embeddings/Parameter.js.map +1 -0
  399. package/transpiled/directives/vary/embeddings/index.d.ts +2 -2
  400. package/transpiled/directives/vary/embeddings/index.js +8 -4
  401. package/transpiled/directives/vary/embeddings/index.js.map +1 -1
  402. package/transpiled/exceptions.d.ts +3 -2
  403. package/transpiled/exceptions.js +13 -7
  404. package/transpiled/exceptions.js.map +1 -1
  405. package/transpiled/io.d.ts +2 -2
  406. package/transpiled/root.js +5 -0
  407. package/transpiled/root.js.map +1 -1
  408. package/transpiled/schemas.d.ts +1 -1
  409. package/transpiled/schemas.js +2 -2
  410. package/transpiled/schemas.js.map +1 -1
  411. package/transpiled/tsconfig.tsbuildinfo +1 -1
  412. package/components/identity.basic/operations/create.d.ts +0 -10
  413. package/components/identity.basic/operations/create.js +0 -10
  414. package/components/identity.basic/operations/create.js.map +0 -1
  415. package/components/identity.basic/source/create.ts +0 -18
  416. package/components/identity.federation/operations/create.d.ts +0 -10
  417. package/components/identity.federation/operations/create.js.map +0 -1
  418. package/components/identity.federation/operations/schemas.d.ts +0 -59
  419. package/components/identity.federation/operations/schemas.js +0 -9
  420. package/components/identity.federation/operations/schemas.js.map +0 -1
  421. package/components/identity.federation/operations/types.js.map +0 -1
  422. package/components/identity.federation/source/schemas.ts +0 -61
  423. package/components/octets.storage/operations/permute.js +0 -7
  424. package/source/HTTP/Server.fixtures.ts +0 -40
  425. package/source/HTTP/Server.test.ts +0 -126
  426. package/source/directives/octets/Permute.ts +0 -37
  427. package/transpiled/HTTP/Server.fixtures.d.ts +0 -10
  428. package/transpiled/HTTP/Server.fixtures.js +0 -31
  429. package/transpiled/HTTP/Server.fixtures.js.map +0 -1
  430. package/transpiled/directives/octets/Permute.d.ts +0 -10
  431. package/transpiled/directives/octets/Permute.js.map +0 -1
@@ -29,13 +29,17 @@ const schemas = __importStar(require("./schemas"));
29
29
  class Query {
30
30
  query;
31
31
  closed = false;
32
+ prepend = ';';
32
33
  constructor(query) {
33
34
  if (query.criteria !== undefined) {
34
- const open = query.criteria[query.criteria.length - 1] === ';';
35
- if (open)
35
+ if (query.criteria.endsWith(';'))
36
36
  query.criteria = query.criteria.slice(0, -1);
37
37
  else
38
38
  this.closed = true;
39
+ if (query.criteria.startsWith(',') || query.criteria.startsWith(';')) {
40
+ this.prepend = query.criteria[0];
41
+ query.criteria = query.criteria.slice(1);
42
+ }
39
43
  }
40
44
  this.query = query;
41
45
  }
@@ -49,35 +53,31 @@ class Query {
49
53
  return query;
50
54
  }
51
55
  fitCriteria(query, parameters) {
52
- const criteria = [];
53
- if (this.query.criteria !== undefined)
54
- criteria.push(this.query.criteria);
56
+ const groups = [];
55
57
  const idx = parameters.findIndex((parameter) => parameter.name === 'id');
56
58
  if (idx !== -1) {
57
59
  query.id = parameters[idx].value;
58
60
  parameters.splice(idx, 1);
59
61
  }
60
62
  if (parameters.length > 0) {
61
- const chunks = parameters
63
+ const criteria = parameters
62
64
  .map(({ name, value }) => `${name}==${value}`)
63
65
  .join(';');
64
- criteria.push(chunks);
66
+ groups.push({ criteria, operator: this.prepend });
65
67
  }
68
+ if (this.query.criteria !== undefined)
69
+ groups.push({ criteria: this.query.criteria, operator: ';' });
66
70
  if (query.criteria !== undefined)
67
71
  if (this.closed)
68
- throw new http.BadRequest('Query criteria is closed.');
72
+ throw new http.BadRequest('Query criteria is closed');
69
73
  else
70
- criteria.push(query.criteria);
71
- switch (criteria.length) {
72
- case 0:
73
- break;
74
- case 1:
75
- query.criteria = criteria[0];
76
- break;
77
- default:
78
- query.criteria = '(' + criteria.join(');(') + ')';
79
- break;
80
- }
74
+ groups.push({ criteria: query.criteria, operator: WHATEVER });
75
+ if (groups.length > 0)
76
+ query.criteria = groups.reduce((acc, { criteria, operator }, i) => {
77
+ return i === groups.length - 1
78
+ ? `${acc}(${criteria})`
79
+ : `${acc}(${criteria})${operator}`;
80
+ }, '');
81
81
  }
82
82
  fitRanges(qs) {
83
83
  const query = qs;
@@ -101,7 +101,8 @@ function fit(string, range, name) {
101
101
  const number = parseInt(string);
102
102
  if (number < range[0] || number > range[1])
103
103
  throw new http.BadRequest(`Query ${name} must be between ` +
104
- `${range[0]} and ${range[1]} inclusive.`);
104
+ `${range[0]} and ${range[1]} inclusive`);
105
105
  return number;
106
106
  }
107
+ const WHATEVER = ';';
107
108
  //# sourceMappingURL=Query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Query.js","sourceRoot":"","sources":["../source/Query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA8B;AAE9B,mDAAoC;AAIpC,MAAa,KAAK;IACC,KAAK,CAAc;IACnB,MAAM,GAAY,KAAK,CAAA;IAExC,YAAoB,KAAmB;QACrC,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAA;YAE9D,IAAI,IAAI;gBAAE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;;gBACjD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QACzB,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAEM,GAAG,CAAE,KAAiB,EAAE,UAAuB;QACpD,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC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AAK,CAAA;QAEtC,IAAI,EAAE,CAAC,IAAI,KAAK,SAAS;YACvB,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAC5D,CAAC;IAEO,OAAO,CAAE,EAAc;QAC7B,MAAM,KAAK,GAAG,EAAgB,CAAA;QAE9B,IAAI,EAAE,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS;YACxD,OAAM;QAER,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;QAEtD,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;CACF;AA5FD,sBA4FC;AAED,SAAS,GAAG,CAAE,MAAc,EAAE,KAAuB,EAAE,IAAY;IACjE,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA;IAE/B,IAAI,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;QACxC,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,IAAI,mBAAmB;YACxD,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAA;IAE5C,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,QAAQ,GAAG,GAAG,CAAA"}
@@ -1,11 +1,12 @@
1
- import { type Directives, type DirectivesFactory } from './Directives';
2
- import { type Endpoint, type EndpointsFactory } from './Endpoint';
3
- export interface Context<TEndpoint extends Endpoint = any, TDirectives extends Directives<TDirectives> = any, TExtension = any> {
1
+ import { type DirectiveFactory } from './Directives';
2
+ import { type EndpointsFactory } from './Endpoint';
3
+ import type { Directive } from './syntax';
4
+ export interface Context<TExtension = any> {
4
5
  readonly protected: boolean;
5
- readonly endpoints: EndpointsFactory<TEndpoint>;
6
+ readonly endpoints: EndpointsFactory;
6
7
  readonly directives: {
7
- readonly factory: DirectivesFactory;
8
- stack: TDirectives[];
8
+ readonly factory: DirectiveFactory;
9
+ stack: Directive[];
9
10
  };
10
11
  readonly extension?: TExtension;
11
12
  }
@@ -1,7 +1,22 @@
1
+ import type { Parameter } from './Match';
1
2
  import type * as syntax from './syntax';
2
- export interface Directives<TDirective = any> {
3
- merge: (directive: TDirective) => void;
3
+ import type { Context, OutgoingMessage } from '../HTTP';
4
+ import type { Output } from '../io';
5
+ export interface Directives {
6
+ preflight: (context: Context, parameters: Parameter[]) => Promise<Output>;
7
+ settle: (context: Context, response: OutgoingMessage) => Promise<void>;
4
8
  }
5
- export interface DirectivesFactory<T = any> {
6
- create: (directives: syntax.Directive[]) => T;
9
+ export interface DirectiveFactory {
10
+ create: (directives: syntax.Directive[]) => Directives;
11
+ }
12
+ export interface DirectiveSet {
13
+ family: DirectiveFamily;
14
+ directives: any[];
15
+ }
16
+ export interface DirectiveFamily<TDirective = any, TExtension = any> {
17
+ readonly name: string;
18
+ readonly mandatory: boolean;
19
+ create: (name: string, ...rest: any[]) => TDirective;
20
+ preflight?: (directives: TDirective[], request: Context & TExtension, parameters: Parameter[]) => Output | Promise<Output>;
21
+ settle?: (directives: TDirective[], request: Context & TExtension, response: OutgoingMessage) => void | Promise<void>;
7
22
  }
@@ -1,9 +1,11 @@
1
1
  import { type Context } from './Context';
2
+ import type * as http from '../HTTP';
2
3
  import type * as syntax from './syntax';
3
- export interface Endpoint<T extends Endpoint = any> {
4
- call: T['call'];
4
+ import type * as RTD from './index';
5
+ export interface Endpoint {
6
+ call: (context: http.Context, parameters: RTD.Parameter[]) => Promise<http.OutgoingMessage>;
5
7
  close: () => Promise<void>;
6
8
  }
7
- export interface EndpointsFactory<T extends Endpoint<T> = any> {
8
- create: (method: syntax.Method, context: Context) => T;
9
+ export interface EndpointsFactory {
10
+ create: (method: syntax.Method, context: Context) => Endpoint;
9
11
  }
@@ -1,8 +1,6 @@
1
1
  import { type Node } from './Node';
2
- import { type Directives } from './Directives';
3
- import { type Endpoint } from './Endpoint';
4
- export interface Match<TEndpoint extends Endpoint<TEndpoint> = any, TDirectives extends Directives<TDirectives> = any> {
5
- node: Node<TEndpoint, TDirectives>;
2
+ export interface Match {
3
+ node: Node;
6
4
  parameters: Parameter[];
7
5
  }
8
6
  export interface Parameter {
@@ -1,9 +1,9 @@
1
- import { type Directives } from './Directives';
2
- import { type Endpoint } from './Endpoint';
3
- export declare class Method<TEndpoint extends Endpoint<TEndpoint> = any, TDirectives extends Directives<TDirectives> = any> {
4
- readonly endpoint: TEndpoint | null;
5
- readonly directives: TDirectives;
6
- constructor(endpoint: TEndpoint | null, directives: TDirectives);
1
+ import type { Endpoint } from './Endpoint';
2
+ import type { Directives } from './Directives';
3
+ export declare class Method {
4
+ readonly endpoint: Endpoint | null;
5
+ readonly directives: Directives;
6
+ constructor(endpoint: Endpoint | null, directives: Directives);
7
7
  close(): Promise<void>;
8
8
  }
9
- export type Methods<TEndpoint extends Endpoint<TEndpoint> = any, TDirectives extends Directives<TDirectives> = any> = Record<string, Method<TEndpoint, TDirectives>>;
9
+ export type Methods = Record<string, Method>;
@@ -1 +1 @@
1
- {"version":3,"file":"Method.js","sourceRoot":"","sources":["../../source/RTD/Method.ts"],"names":[],"mappings":";;;AAGA,MAAa,MAAM;IAID,QAAQ,CAAkB;IAC1B,UAAU,CAAa;IAEvC,YAAoB,QAA0B,EAAE,UAAuB;QACrE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAA;IAC9B,CAAC;CACF;AAfD,wBAeC"}
1
+ {"version":3,"file":"Method.js","sourceRoot":"","sources":["../../source/RTD/Method.ts"],"names":[],"mappings":";;;AAGA,MAAa,MAAM;IACD,QAAQ,CAAiB;IACzB,UAAU,CAAY;IAEtC,YAAoB,QAAyB,EAAE,UAAsB;QACnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAA;IAC9B,CAAC;CACF;AAZD,wBAYC"}
@@ -1,16 +1,14 @@
1
1
  import { type Route } from './Route';
2
2
  import { type Methods } from './Method';
3
3
  import { type Match, type Parameter } from './Match';
4
- import { type Directives } from './Directives';
5
- import { type Endpoint } from './Endpoint';
6
- export declare class Node<TEndpoint extends Endpoint<TEndpoint> = any, TDirectives extends Directives<TDirectives> = any> {
4
+ export declare class Node {
7
5
  intermediate: boolean;
8
- methods: Methods<TEndpoint, TDirectives>;
6
+ methods: Methods;
9
7
  private readonly protected;
10
8
  private routes;
11
- constructor(routes: Route[], methods: Methods<TEndpoint, TDirectives>, properties: Properties);
9
+ constructor(routes: Route[], methods: Methods, properties: Properties);
12
10
  match(fragments: string[], parameters?: Parameter[]): Match | null;
13
- merge(node: Node<TEndpoint, TDirectives>): void;
11
+ merge(node: Node): void;
14
12
  private replace;
15
13
  private append;
16
14
  private mergeRoute;
@@ -34,7 +34,8 @@ class Node {
34
34
  this.routes = node.routes;
35
35
  this.methods = node.methods;
36
36
  for (const method of methods)
37
- void method.close(); // race condition is really unlikely
37
+ void method.close();
38
+ // race condition is really unlikely
38
39
  }
39
40
  append(node) {
40
41
  for (const route of node.routes)
@@ -1 +1 @@
1
- {"version":3,"file":"Node.js","sourceRoot":"","sources":["../../source/RTD/Node.ts"],"names":[],"mappings":";;;AAMA,MAAa,IAAI;IAIR,YAAY,CAAS;IACrB,OAAO,CAAiC;IAC9B,SAAS,CAAS;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AAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;YACvD,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO;gBACtB,OAAO,CAAC,IAAI,CAAC,sCAAsC,IAAI,oBAAoB,CAAC,CAAA;;gBAE5E,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAA;IACjC,CAAC;IAEO,UAAU,CAAE,SAAgB;QAClC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM;YAC7B,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5B,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;gBAEtB,OAAM;YACR,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC7B,CAAC;IAEO,IAAI;QACV,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,CAAA;IACvD,CAAC;CACF;AA3ED,oBA2EC"}
@@ -1,14 +1,14 @@
1
- import { type Match } from './Match';
2
- import { type Directives, type DirectivesFactory } from './Directives';
3
- import { type Endpoint, type EndpointsFactory } from './Endpoint';
1
+ import type { Match } from './Match';
2
+ import type { DirectiveFactory } from './Directives';
3
+ import type { EndpointsFactory } from './Endpoint';
4
4
  import type * as syntax from './syntax';
5
- export declare class Tree<TEndpoint extends Endpoint<TEndpoint> = any, TDirectives extends Directives<TDirectives> = any> {
5
+ export declare class Tree {
6
6
  private readonly root;
7
7
  private readonly trunk;
8
8
  private readonly endpoints;
9
9
  private readonly directives;
10
- constructor(node: syntax.Node, endpoints: EndpointsFactory, directives: DirectivesFactory);
11
- match(path: string): Match<TEndpoint, TDirectives> | null;
10
+ constructor(node: syntax.Node, endpoints: EndpointsFactory, directives: DirectiveFactory);
11
+ match(path: string): Match | null;
12
12
  merge(node: syntax.Node, extension: any): void;
13
13
  private createNode;
14
14
  }
@@ -16,7 +16,10 @@ class Tree {
16
16
  }
17
17
  match(path) {
18
18
  if (path === '/')
19
- return { node: this.trunk, parameters: [] };
19
+ return {
20
+ node: this.trunk,
21
+ parameters: []
22
+ };
20
23
  const fragments = (0, segment_1.fragment)(path);
21
24
  return this.trunk.match(fragments);
22
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../source/RTD/Tree.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AACtC,uCAAoC;AAOpC,MAAa,IAAI;IAIE,IAAI,CAAa;IACjB,KAAK,CAA8B;IACnC,SAAS,CAA6B;IACtC,UAAU,CAAmB;IAE9C,YACC,IAAiB,EAAE,SAA2B,EAAE,UAA6B;QAC5E,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;QAC7C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAEM,KAAK,CAAE,IAAY;QACxB,IAAI,IAAI,KAAK,GAAG;YACd,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAA;QAE7C,MAAM,SAAS,GAAG,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAA;QAEhC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACpC,CAAC;IAEM,KAAK,CAAE,IAAiB,EAAE,SAAc;QAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QAE3D,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC1B,CAAC;IAEO,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AAC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QAE3D,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC1B,CAAC;IAEO,UAAU,CACjB,IAAiB,EAAE,OAAgB,EAAE,SAAe;QACnD,MAAM,OAAO,GAAY;YACvB,SAAS,EAAE,OAAO;YAClB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE;gBACV,OAAO,EAAE,IAAI,CAAC,UAAU;gBACxB,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,IAAI,EAAE;aACnC;YACD,SAAS;SACV,CAAA;QAED,OAAO,IAAA,oBAAU,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;CACF;AA9CD,oBA8CC;AAED,MAAM,SAAS,GAAG,IAAI,CAAA"}
@@ -1,6 +1,4 @@
1
1
  import { Node } from './Node';
2
- import { type Context } from './Context';
3
- import { type Endpoint } from './Endpoint';
4
- import { type Directives } from './Directives';
2
+ import type { Context } from './Context';
5
3
  import type * as syntax from './syntax';
6
- export declare function createNode<TEndpoint extends Endpoint, TDirectives extends Directives>(node: syntax.Node, context: Context): Node<TEndpoint, TDirectives>;
4
+ export declare function createNode(node: syntax.Node, context: Context): Node;
@@ -26,7 +26,7 @@ function createRoute(route, context) {
26
26
  return new Route_1.Route(segments, node);
27
27
  }
28
28
  function createMethod(method, context) {
29
- const stack = context.directives.stack.concat(method.directives.reverse());
29
+ const stack = method.directives.concat(context.directives.stack);
30
30
  const directives = context.directives.factory.create(stack);
31
31
  const endpoint = method.mapping?.endpoint === undefined
32
32
  ? null
@@ -1 +1 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../source/RTD/factory.ts"],"names":[],"mappings":";;;AAAA,iCAA8C;AAC9C,mCAA+B;AAE/B,uCAAmC;AACnC,qCAA+C;AAK/C,SAAgB,UAAU,CACzB,IAAiB,EAAE,OAAgB;IAClC,IAAI,IAAI,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AAC,SAAS,EAAE,CAAA;IAEjF,OAAO,IAAI,WAAI,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;AAC9C,CAAC;AAfD,gCAeC;AAED,SAAS,WAAW,CAAE,KAAmB,EAAE,OAAgB;IACzD,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IAC9C,MAAM,QAAQ,GAAG,IAAA,iBAAO,EAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACpC,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAE5C,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG,KAAK,CAAA,CAAC,UAAU;IAE3C,OAAO,IAAI,aAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;AAClC,CAAC;AAED,SAAS,YAAY,CAAE,MAAqB,EAAE,OAAgB;IAC5D,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAChE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAE3D,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,EAAE,QAAQ,KAAK,SAAS;QACrD,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAE7C,OAAO,IAAI,eAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;AACzC,CAAC"}
@@ -6,7 +6,6 @@ export declare class Tenant extends Connector {
6
6
  private readonly branch;
7
7
  constructor(broadcast: Broadcast, locator: Locator, node: RTD.Node);
8
8
  open(): Promise<void>;
9
- dispose(): Promise<void>;
10
9
  private expose;
11
10
  }
12
11
  type Broadcast = bindings.Broadcast<Label>;
@@ -19,12 +19,6 @@ class Tenant extends core_1.Connector {
19
19
  async open() {
20
20
  await this.expose();
21
21
  await this.broadcast.receive('ping', this.expose.bind(this));
22
- console.info('Exposition Tenant for ' +
23
- `'${this.branch.namespace}.${this.branch.component}' has started.`);
24
- }
25
- async dispose() {
26
- console.info('Exposition Tenant for ' +
27
- `'${this.branch.namespace}.${this.branch.component}' has been stopped.`);
28
22
  }
29
23
  async expose() {
30
24
  await this.broadcast.transmit('expose', this.branch);
@@ -1 +1 @@
1
- {"version":3,"file":"Tenant.js","sourceRoot":"","sources":["../source/Tenant.ts"],"names":[],"mappings":";;;AAAA,uCAAqE;AAKrE,MAAa,MAAO,SAAQ,gBAAS;IAClB,SAAS,CAAW;IACpB,MAAM,CAAQ;IAE/B,YAAoB,SAAoB,EAAE,OAAgB,EAAE,IAAc;QACxE,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAE1B,IAAI,CAAC,MAAM,GAAG;YACZ,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,SAAS,EAAE,OAAO,CAAC,IAAI;YACvB,QAAQ,EAAE,OAAO,CAAC,SAAS,KAAK,UAAU;YAC1C,IAAI;SACL,CAAA;QAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACzB,CAAC;IAEe,KAAK,CAAC,IAAI;QACxB,MAAM,IAAI,CAAC,MAAM,EAAE,CAAA;QACnB,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QAE5D,OAAO,CAAC,IAAI,CAAC,wBAAwB;YACnC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,gBAAgB,CAAC,CAAA;IACvE,CAAC;IAEe,KAAK,CAAC,OAAO;QAC3B,OAAO,CAAC,IAAI,CAAC,wBAAwB;YACnC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,qBAAqB,CAAC,CAAA;IAC5E,CAAC;IAEO,KAAK,CAAC,MAAM;QAClB,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACtD,CAAC;CACF;AAnCD,wBAmCC"}
1
+ {"version":3,"file":"Tenant.js","sourceRoot":"","sources":["../source/Tenant.ts"],"names":[],"mappings":";;;AAAA,uCAAqE;AAKrE,MAAa,MAAO,SAAQ,gBAAS;IAClB,SAAS,CAAW;IACpB,MAAM,CAAQ;IAE/B,YAAoB,SAAoB,EAAE,OAAgB,EAAE,IAAc;QACxE,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAE1B,IAAI,CAAC,MAAM,GAAG;YACZ,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,SAAS,EAAE,OAAO,CAAC,IAAI;YACvB,QAAQ,EAAE,OAAO,CAAC,SAAS,KAAK,UAAU;YAC1C,IAAI;SACL,CAAA;QAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACzB,CAAC;IAEe,KAAK,CAAC,IAAI;QACxB,MAAM,IAAI,CAAC,MAAM,EAAE,CAAA;QACnB,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9D,CAAC;IAEO,KAAK,CAAC,MAAM;QAClB,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACtD,CAAC;CACF;AA3BD,wBA2BC"}
@@ -1,3 +1,3 @@
1
1
  import { type Dependency } from '@toa.io/operations';
2
2
  import { type Annotation } from './Annotation';
3
- export declare function deployment(_: unknown, annotation: Annotation | undefined): Dependency;
3
+ export declare function deployment(_: unknown, annotation?: Annotation): Dependency;
@@ -22,30 +22,37 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.deployment = void 0;
30
+ const node_assert_1 = __importDefault(require("node:assert"));
27
31
  const generic_1 = require("@toa.io/generic");
28
32
  const schemas = __importStar(require("./schemas"));
29
33
  const Directive_1 = require("./Directive");
30
34
  const Composition_1 = require("./Composition");
31
35
  const syntax_1 = require("./RTD/syntax");
36
+ const Server_1 = require("./HTTP/Server");
32
37
  function deployment(_, annotation) {
38
+ node_assert_1.default.ok(annotation !== undefined, 'Exposition context annotation is required');
39
+ schemas.annotation.validate(annotation);
33
40
  const labels = (0, Composition_1.components)().labels;
34
41
  const service = {
35
42
  group: 'exposition',
36
43
  name: 'gateway',
37
- port: 8000,
44
+ port: Server_1.PORT,
38
45
  // eslint-disable-next-line @typescript-eslint/no-var-requires
39
46
  version: require('../package.json').version,
40
47
  variables: [],
41
- components: labels
48
+ components: labels,
49
+ ingress: { hosts: [] },
50
+ probe: {
51
+ path: '/.ready',
52
+ port: Server_1.PORT,
53
+ delay: Server_1.DELAY
54
+ }
42
55
  };
43
- if (annotation?.host !== undefined)
44
- service.ingress = {
45
- host: annotation.host,
46
- class: annotation.class,
47
- annotations: annotation.annotations
48
- };
49
56
  if (annotation?.['/'] !== undefined) {
50
57
  const tree = (0, syntax_1.parse)(annotation['/'], Directive_1.shortcuts);
51
58
  service.variables.push({
@@ -53,13 +60,19 @@ function deployment(_, annotation) {
53
60
  value: (0, generic_1.encode)(tree)
54
61
  });
55
62
  }
56
- if (annotation?.debug === true)
57
- service.variables.push({
58
- name: 'TOA_EXPOSITION_DEBUG',
59
- value: '1'
60
- });
61
- if (annotation !== undefined)
62
- schemas.annotaion.validate(annotation);
63
+ const { debug, trace, authorities } = annotation;
64
+ service.ingress.hosts = Object.values(authorities);
65
+ service.ingress.class = annotation.class;
66
+ service.ingress.annotations = annotation.annotations;
67
+ const properties = { authorities };
68
+ if (debug === true)
69
+ properties.debug = true;
70
+ if (trace === true)
71
+ properties.trace = true;
72
+ service.variables.push({
73
+ name: 'TOA_EXPOSITION_PROPERTIES',
74
+ value: (0, generic_1.encode)(properties)
75
+ });
63
76
  return { services: [service] };
64
77
  }
65
78
  exports.deployment = deployment;
@@ -1 +1 @@
1
- {"version":3,"file":"deployment.js","sourceRoot":"","sources":["../source/deployment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6CAAwC;AAExC,mDAAoC;AACpC,2CAAuC;AACvC,+CAA0C;AAC1C,yCAAoC;AAEpC,SAAgB,UAAU,CAAE,CAAU,EAAE,UAAkC;IACxE,MAAM,MAAM,GAAG,IAAA,wBAAU,GAAE,CAAC,MAAM,CAAA;IAElC,MAAM,OAAO,GAAY;QACvB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,IAAI;QACV,8DAA8D;QAC9D,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO;QAC3C,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,MAAM;KACnB,CAAA;IAED,IAAI,UAAU,EAAE,IAAI,KAAK,SAAS;QAChC,OAAO,CAAC,OAAO,GAAG;YAChB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,WAAW,EAAE,UAAU,CAAC,WAAW;SACpC,CAAA;IAEH,IAAI,UAAU,EAAE,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,UAAU,CAAC,GAAG,CAAC,EAAE,qBAAS,CAAC,CAAA;QAE9C,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;YACrB,IAAI,EAA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KACF,CAAA;IAED,IAAI,UAAU,EAAE,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,UAAU,CAAC,GAAG,CAAC,EAAE,qBAAS,CAAC,CAAA;QAE9C,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;YACrB,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,IAAA,gBAAM,EAAC,IAAI,CAAC;SACpB,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,UAAU,CAAA;IAEhD,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IAClD,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAA;IACxC,OAAO,CAAC,OAAO,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAA;IAEpD,MAAM,UAAU,GAAe,EAAE,WAAW,EAAE,CAAA;IAE9C,IAAI,KAAK,KAAK,IAAI;QAChB,UAAU,CAAC,KAAK,GAAG,IAAI,CAAA;IAEzB,IAAI,KAAK,KAAK,IAAI;QAChB,UAAU,CAAC,KAAK,GAAG,IAAI,CAAA;IAEzB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;QACrB,IAAI,EAAE,2BAA2B;QACjC,KAAK,EAAE,IAAA,gBAAM,EAAC,UAAU,CAAC;KAC1B,CAAC,CAAA;IAEF,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAA;AAChC,CAAC;AAnDD,gCAmDC"}
@@ -7,10 +7,9 @@ class Anonymous {
7
7
  this.allow = allow;
8
8
  }
9
9
  authorize(_, input) {
10
- if ('authorization' in input.headers)
11
- return false;
12
- else
13
- return this.allow;
10
+ return 'authorization' in input.request.headers
11
+ ? false
12
+ : this.allow;
14
13
  }
15
14
  }
16
15
  exports.Anonymous = Anonymous;
@@ -1 +1 @@
1
- {"version":3,"file":"Anonymous.js","sourceRoot":"","sources":["../../../source/directives/auth/Anonymous.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IACH,KAAK,CAAS;IAE/B,YAAoB,KAAc;QAChC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAEM,SAAS,CAAE,CAAM,EAAE,KAAY;QACpC,IAAI,eAAe,IAAI,KAAK,CAAC,OAAO;YAAE,OAAO,KAAK,CAAA;;YAC7C,OAAO,IAAI,CAAC,KAAK,CAAA;IACxB,CAAC;CACF;AAXD,8BAWC"}
1
+ {"version":3,"file":"Anonymous.js","sourceRoot":"","sources":["../../../source/directives/auth/Anonymous.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IACH,KAAK,CAAS;IAE/B,YAAoB,KAAc;QAChC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAEM,SAAS,CAAE,CAAM,EAAE,KAAY;QACpC,OAAO,eAAe,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO;YAC7C,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;IAChB,CAAC;CACF;AAZD,8BAYC"}
@@ -1,10 +1,9 @@
1
1
  import * as http from '../../HTTP';
2
2
  import type { Output } from '../../io';
3
3
  import type { Remotes } from '../../Remotes';
4
- import type { Family } from '../../Directive';
5
- import type { Parameter } from '../../RTD';
4
+ import type { Parameter, DirectiveFamily } from '../../RTD';
6
5
  import type { Directive, Extension, Input } from './types';
7
- export declare class Authorization implements Family<Directive, Extension> {
6
+ export declare class Authorization implements DirectiveFamily<Directive, Extension> {
8
7
  readonly depends: string[];
9
8
  readonly name: string;
10
9
  readonly mandatory: boolean;
@@ -36,8 +36,9 @@ const Role_1 = require("./Role");
36
36
  const Rule_1 = require("./Rule");
37
37
  const Incept_1 = require("./Incept");
38
38
  const Echo_1 = require("./Echo");
39
- const split_1 = require("./split");
40
39
  const Scheme_1 = require("./Scheme");
40
+ const Delegate_1 = require("./Delegate");
41
+ const split_1 = require("./split");
41
42
  const schemes_1 = require("./schemes");
42
43
  class Authorization {
43
44
  depends = ['Vary'];
@@ -48,14 +49,14 @@ class Authorization {
48
49
  tokens = null;
49
50
  bans = null;
50
51
  create(name, value, remotes) {
51
- node_assert_1.default.ok(name in CLASSES, `Directive '${name}' is not provided by the '${this.name}' family.`);
52
- const Class = CLASSES[name];
52
+ node_assert_1.default.ok(name in constructors, `Directive 'auth:${name}' is not implemented.`);
53
+ const Class = constructors[name];
53
54
  for (const name of REMOTES)
54
55
  this.discovery[name] ??= remotes.discover('identity', name);
55
56
  return (0, matchacho_1.match)(Class, Role_1.Role, () => new Role_1.Role(value, this.discovery.roles), Rule_1.Rule, () => new Rule_1.Rule(value, this.create.bind(this)), Incept_1.Incept, () => new Incept_1.Incept(value, this.discovery), () => new Class(value));
56
57
  }
57
58
  async preflight(directives, input, parameters) {
58
- const identity = await this.resolve(input.headers.authorization);
59
+ const identity = await this.resolve(input.authority, input.request.headers.authorization);
59
60
  input.identity = identity;
60
61
  for (const directive of directives) {
61
62
  const allow = await directive.authorize(identity, input, parameters);
@@ -79,13 +80,15 @@ class Authorization {
79
80
  if (identity.roles === undefined)
80
81
  await Role_1.Role.set(identity, this.discovery.roles);
81
82
  this.tokens ??= await this.discovery.tokens;
82
- const token = await this.tokens.invoke('encrypt', { input: { identity } });
83
+ const token = await this.tokens.invoke('encrypt', {
84
+ input: { authority: request.authority, identity }
85
+ });
83
86
  const authorization = `Token ${token}`;
84
- if (response.headers === undefined)
85
- response.headers = new Headers();
87
+ response.headers ??= new Headers();
86
88
  response.headers.set('authorization', authorization);
89
+ response.headers.append('cache-control', 'no-store');
87
90
  }
88
- async resolve(authorization) {
91
+ async resolve(authority, authorization) {
89
92
  if (authorization === undefined)
90
93
  return null;
91
94
  const [scheme, credentials] = (0, split_1.split)(authorization);
@@ -94,7 +97,10 @@ class Authorization {
94
97
  throw new http.Unauthorized(`Unknown authentication scheme '${scheme}'.`);
95
98
  this.schemes[scheme] ??= await this.discovery[provider];
96
99
  const result = await this.schemes[scheme].invoke('authenticate', {
97
- input: credentials
100
+ input: {
101
+ authority,
102
+ credentials
103
+ }
98
104
  });
99
105
  if (result instanceof Error)
100
106
  return null;
@@ -112,14 +118,15 @@ class Authorization {
112
118
  }
113
119
  }
114
120
  exports.Authorization = Authorization;
115
- const CLASSES = {
121
+ const constructors = {
116
122
  anonymous: Anonymous_1.Anonymous,
117
123
  id: Id_1.Id,
118
124
  role: Role_1.Role,
119
125
  rule: Rule_1.Rule,
120
126
  incept: Incept_1.Incept,
121
127
  scheme: Scheme_1.Scheme,
122
- echo: Echo_1.Echo
128
+ echo: Echo_1.Echo,
129
+ delegate: Delegate_1.Delegate
123
130
  };
124
131
  const REMOTES = ['basic', 'federation', 'tokens', 'roles', 'bans'];
125
132
  //# sourceMappingURL=Authorization.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Authorization.js","sourceRoot":"","sources":["../../../source/directives/auth/Authorization.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgC;AAChC,yCAAiC;AACjC,iDAAkC;AAClC,2CAAuC;AACvC,6BAAyB;AACzB,iCAA6B;AAC7B,iCAA6B;AAC7B,qCAAiC;AACjC,iCAA6B;AAC7B,mCAA+B;AAC/B,qCAAiC;AACjC,uCAA8C;AAkB9C,MAAa,aAAa;IACR,OAAO,GAAa,CAAC,MAAM,CAAC,CAAA;IAC5B,IAAI,GAAW,MAAM,CAAA;IACrB,SAAS,GAAY,IAAI,CAAA;IAExB,OAAO,GAAG,EAAwB,CAAA;IAClC,SAAS,GAAG,EAA0B,CAAA;IAC/C,MAAM,GAAqB,IAAI,CAAA;IAC/B,IAAI,GAAqB,IAAI,CAAA;IAE9B,MAAM,CAAE,IAAY,EAAE,KAAU,EAAE,OAAgB;QACvD,qBAAM,CAAC,EAAE,CAAC,IAAI,IAAI,OAAO,EACvB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CAAC,CAAC,MAAM,CAAuB,cAAc,EAAE;YACrF,KAAK,EAAE;gBACL,SAAS;gBACT,WAAW;aACZ;SACF,CAAC,CAAA;QAEF,IAAI,MAAM,YAAY,KAAK;YAAE,OAAO,IAAI,CAAA;QAExC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;QAEhC,IAAI,MAAM,KAAK,iBAAO,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAAE,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,CAAA;QAEtF,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAA;QACxB,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAEjC,OAAO,QAAQ,CAAA;IACjB,CAAC;IAEO,KAAK,CAAC,MAAM,CAAE,QAAkB;QACtC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAA;QAEvC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAM,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;QAElF,OAAO,GAAG,CAAC,MAAM,CAAA;IACnB,CAAC;CACF;AAlHD,sCAkHC;AAED,MAAM,YAAY,GAAkE;IAClF,SAAS,EAAE,qBAAS;IACpB,EAAE,EAAE,OAAE;IACN,IAAI,EAAE,WAAI;IACV,IAAI,EAAE,WAAI;IACV,MAAM,EAAE,eAAM;IACd,MAAM,EAAE,eAAM;IACd,IAAI,EAAE,WAAI;IACV,QAAQ,EAAE,mBAAQ;CACnB,CAAA;AAED,MAAM,OAAO,GAAa,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { type Directive, type Identity } from './types';
2
+ import type { Input } from '../../io';
3
+ export declare class Delegate implements Directive {
4
+ private readonly property;
5
+ constructor(property: string);
6
+ authorize(identity: Identity | null, context: Input): boolean;
7
+ private embed;
8
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Delegate = void 0;
4
+ const HTTP_1 = require("../../HTTP");
5
+ class Delegate {
6
+ property;
7
+ constructor(property) {
8
+ this.property = property;
9
+ }
10
+ authorize(identity, context) {
11
+ if (identity === null)
12
+ return false;
13
+ context.pipelines.body.push((body) => this.embed(body, identity));
14
+ return true;
15
+ }
16
+ embed(body, identity) {
17
+ if (body === undefined)
18
+ body = {};
19
+ check(body);
20
+ body[this.property] = identity;
21
+ return body;
22
+ }
23
+ }
24
+ exports.Delegate = Delegate;
25
+ function check(body) {
26
+ if (typeof body !== 'object' || body === null)
27
+ throw new HTTP_1.BadRequest('Invalid request body');
28
+ }
29
+ //# sourceMappingURL=Delegate.js.map