@toa.io/definitions 1.0.0-alpha.288

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 (378) hide show
  1. package/digest/extensions.cadence.json +1 -0
  2. package/digest/extensions.configuration.json +1 -0
  3. package/digest/extensions.exposition.json +1 -0
  4. package/digest/extensions.introspection.json +1 -0
  5. package/digest/extensions.realtime.json +1 -0
  6. package/package.json +42 -0
  7. package/readme.md +75 -0
  8. package/schemas/extensions.cadence/annotation.cos.yaml +9 -0
  9. package/schemas/extensions.cadence/declaration.cos.yaml +20 -0
  10. package/schemas/extensions.configuration/annotation.cos.yaml +29 -0
  11. package/schemas/extensions.configuration/manifest.cos.yaml +9 -0
  12. package/schemas/extensions.exposition/annotation.cos.yaml +125 -0
  13. package/schemas/extensions.exposition/call.cos.yaml +18 -0
  14. package/schemas/extensions.exposition/directive.cos.yaml +7 -0
  15. package/schemas/extensions.exposition/method.cos.yaml +23 -0
  16. package/schemas/extensions.exposition/node.cos.yaml +22 -0
  17. package/schemas/extensions.exposition/query.cos.yaml +31 -0
  18. package/schemas/extensions.exposition/querystring.cos.yaml +19 -0
  19. package/schemas/extensions.exposition/range.cos.yaml +10 -0
  20. package/schemas/extensions.exposition/route.cos.yaml +6 -0
  21. package/schemas/extensions.introspection/annotation.cos.yaml +31 -0
  22. package/schemas/extensions.introspection/declaration.cos.yaml +5 -0
  23. package/schemas/extensions.storages/annotation.cos.yaml +11 -0
  24. package/schemas/extensions.storages/cloudinary.cos.yaml +38 -0
  25. package/schemas/extensions.storages/fs.cos.yaml +13 -0
  26. package/schemas/extensions.storages/s3.cos.yaml +17 -0
  27. package/schemas/extensions.storages/spaces.cos.yaml +16 -0
  28. package/schemas/extensions.storages/test.cos.yaml +10 -0
  29. package/schemas/extensions.storages/tmp.cos.yaml +10 -0
  30. package/source/bindings.amqp/annotation.ts +26 -0
  31. package/source/bindings.amqp/context.ts +68 -0
  32. package/source/bindings.amqp/deployment.ts +14 -0
  33. package/source/bindings.amqp/index.ts +9 -0
  34. package/source/bindings.amqp/instance.ts +3 -0
  35. package/source/bindings.amqp/sources.ts +39 -0
  36. package/source/bindings.loop/index.ts +3 -0
  37. package/source/bridges.bash/const.ts +2 -0
  38. package/source/bridges.bash/define.ts +38 -0
  39. package/source/bridges.bash/index.ts +2 -0
  40. package/source/bridges.node/define.ts +69 -0
  41. package/source/bridges.node/exports.ts +175 -0
  42. package/source/bridges.node/index.ts +6 -0
  43. package/source/bridges.node/operations.ts +127 -0
  44. package/source/bridges.node/sources.ts +44 -0
  45. package/source/definition.ts +38 -0
  46. package/source/digest/generate.ts +77 -0
  47. package/source/digest/read.ts +39 -0
  48. package/source/extensions.cadence/components.ts +6 -0
  49. package/source/extensions.cadence/const.ts +31 -0
  50. package/source/extensions.cadence/context.ts +10 -0
  51. package/source/extensions.cadence/deployment.ts +37 -0
  52. package/source/extensions.cadence/index.ts +8 -0
  53. package/source/extensions.cadence/manifest.ts +64 -0
  54. package/source/extensions.cadence/schemas.ts +10 -0
  55. package/source/extensions.cadence/types.ts +41 -0
  56. package/source/extensions.configuration/components.ts +6 -0
  57. package/source/extensions.configuration/const.ts +30 -0
  58. package/source/extensions.configuration/context.ts +13 -0
  59. package/source/extensions.configuration/deployment.ts +159 -0
  60. package/source/extensions.configuration/epoch.ts +22 -0
  61. package/source/extensions.configuration/index.ts +10 -0
  62. package/source/extensions.configuration/manifest.ts +12 -0
  63. package/source/extensions.configuration/schemas.ts +9 -0
  64. package/source/extensions.exposition/Annotation.ts +91 -0
  65. package/source/extensions.exposition/components.ts +6 -0
  66. package/source/extensions.exposition/const.ts +45 -0
  67. package/source/extensions.exposition/deployment.ts +95 -0
  68. package/source/extensions.exposition/index.ts +16 -0
  69. package/source/extensions.exposition/manifest.ts +56 -0
  70. package/source/extensions.exposition/schemas.ts +16 -0
  71. package/source/extensions.exposition/shortcuts.ts +14 -0
  72. package/source/extensions.exposition/syntax/index.ts +2 -0
  73. package/source/extensions.exposition/syntax/parse.ts +171 -0
  74. package/source/extensions.exposition/syntax/types.ts +69 -0
  75. package/source/extensions.fetch/context.ts +10 -0
  76. package/source/extensions.fetch/index.ts +1 -0
  77. package/source/extensions.introspection/annotation.ts +87 -0
  78. package/source/extensions.introspection/components.ts +13 -0
  79. package/source/extensions.introspection/const.ts +46 -0
  80. package/source/extensions.introspection/deployment.ts +48 -0
  81. package/source/extensions.introspection/index.ts +6 -0
  82. package/source/extensions.introspection/manifest.ts +18 -0
  83. package/source/extensions.introspection/schemas.ts +12 -0
  84. package/source/extensions.realtime/components.ts +5 -0
  85. package/source/extensions.realtime/deployment.ts +89 -0
  86. package/source/extensions.realtime/index.ts +4 -0
  87. package/source/extensions.stash/context.ts +10 -0
  88. package/source/extensions.stash/deployment.ts +22 -0
  89. package/source/extensions.stash/index.ts +2 -0
  90. package/source/extensions.state/context.ts +9 -0
  91. package/source/extensions.state/index.ts +1 -0
  92. package/source/extensions.storages/Annotation.ts +57 -0
  93. package/source/extensions.storages/context.ts +14 -0
  94. package/source/extensions.storages/deployment.ts +91 -0
  95. package/source/extensions.storages/index.ts +9 -0
  96. package/source/extensions.storages/manifest.ts +7 -0
  97. package/source/extensions.storages/schemas.ts +15 -0
  98. package/source/extensions.storages/secrets.ts +22 -0
  99. package/source/extensions.telemetry/const.ts +6 -0
  100. package/source/extensions.telemetry/context.ts +11 -0
  101. package/source/extensions.telemetry/deployment.ts +91 -0
  102. package/source/extensions.telemetry/index.ts +5 -0
  103. package/source/extensions.telemetry/ready.ts +33 -0
  104. package/source/index.ts +2 -0
  105. package/source/storages.mongodb/deployment.ts +22 -0
  106. package/source/storages.mongodb/index.ts +1 -0
  107. package/source/version.ts +10 -0
  108. package/transpiled/bindings.amqp/annotation.d.ts +10 -0
  109. package/transpiled/bindings.amqp/annotation.js +16 -0
  110. package/transpiled/bindings.amqp/annotation.js.map +1 -0
  111. package/transpiled/bindings.amqp/annotation.test.d.ts +1 -0
  112. package/transpiled/bindings.amqp/annotation.test.js +36 -0
  113. package/transpiled/bindings.amqp/annotation.test.js.map +1 -0
  114. package/transpiled/bindings.amqp/context.d.ts +7 -0
  115. package/transpiled/bindings.amqp/context.js +47 -0
  116. package/transpiled/bindings.amqp/context.js.map +1 -0
  117. package/transpiled/bindings.amqp/deployment.d.ts +4 -0
  118. package/transpiled/bindings.amqp/deployment.js +11 -0
  119. package/transpiled/bindings.amqp/deployment.js.map +1 -0
  120. package/transpiled/bindings.amqp/index.d.ts +6 -0
  121. package/transpiled/bindings.amqp/index.js +5 -0
  122. package/transpiled/bindings.amqp/index.js.map +1 -0
  123. package/transpiled/bindings.amqp/instance.d.ts +2 -0
  124. package/transpiled/bindings.amqp/instance.js +2 -0
  125. package/transpiled/bindings.amqp/instance.js.map +1 -0
  126. package/transpiled/bindings.amqp/properties.test.d.ts +1 -0
  127. package/transpiled/bindings.amqp/properties.test.js +7 -0
  128. package/transpiled/bindings.amqp/properties.test.js.map +1 -0
  129. package/transpiled/bindings.amqp/sources.d.ts +7 -0
  130. package/transpiled/bindings.amqp/sources.js +27 -0
  131. package/transpiled/bindings.amqp/sources.js.map +1 -0
  132. package/transpiled/bindings.loop/index.d.ts +2 -0
  133. package/transpiled/bindings.loop/index.js +2 -0
  134. package/transpiled/bindings.loop/index.js.map +1 -0
  135. package/transpiled/bindings.loop/properties.test.d.ts +1 -0
  136. package/transpiled/bindings.loop/properties.test.js +7 -0
  137. package/transpiled/bindings.loop/properties.test.js.map +1 -0
  138. package/transpiled/bridges.bash/const.d.ts +2 -0
  139. package/transpiled/bridges.bash/const.js +3 -0
  140. package/transpiled/bridges.bash/const.js.map +1 -0
  141. package/transpiled/bridges.bash/define.d.ts +3 -0
  142. package/transpiled/bridges.bash/define.js +25 -0
  143. package/transpiled/bridges.bash/define.js.map +1 -0
  144. package/transpiled/bridges.bash/index.d.ts +2 -0
  145. package/transpiled/bridges.bash/index.js +3 -0
  146. package/transpiled/bridges.bash/index.js.map +1 -0
  147. package/transpiled/bridges.node/define.d.ts +18 -0
  148. package/transpiled/bridges.node/define.js +46 -0
  149. package/transpiled/bridges.node/define.js.map +1 -0
  150. package/transpiled/bridges.node/exports.d.ts +16 -0
  151. package/transpiled/bridges.node/exports.js +134 -0
  152. package/transpiled/bridges.node/exports.js.map +1 -0
  153. package/transpiled/bridges.node/exports.test.d.ts +1 -0
  154. package/transpiled/bridges.node/exports.test.js +88 -0
  155. package/transpiled/bridges.node/exports.test.js.map +1 -0
  156. package/transpiled/bridges.node/index.d.ts +5 -0
  157. package/transpiled/bridges.node/index.js +4 -0
  158. package/transpiled/bridges.node/index.js.map +1 -0
  159. package/transpiled/bridges.node/operations.d.ts +13 -0
  160. package/transpiled/bridges.node/operations.js +96 -0
  161. package/transpiled/bridges.node/operations.js.map +1 -0
  162. package/transpiled/bridges.node/operations.test.d.ts +1 -0
  163. package/transpiled/bridges.node/operations.test.js +108 -0
  164. package/transpiled/bridges.node/operations.test.js.map +1 -0
  165. package/transpiled/bridges.node/sources.d.ts +7 -0
  166. package/transpiled/bridges.node/sources.js +36 -0
  167. package/transpiled/bridges.node/sources.js.map +1 -0
  168. package/transpiled/definition.d.ts +7 -0
  169. package/transpiled/definition.js +34 -0
  170. package/transpiled/definition.js.map +1 -0
  171. package/transpiled/digest/generate.d.ts +1 -0
  172. package/transpiled/digest/generate.js +60 -0
  173. package/transpiled/digest/generate.js.map +1 -0
  174. package/transpiled/digest/read.d.ts +16 -0
  175. package/transpiled/digest/read.js +22 -0
  176. package/transpiled/digest/read.js.map +1 -0
  177. package/transpiled/extensions.cadence/components.d.ts +3 -0
  178. package/transpiled/extensions.cadence/components.js +6 -0
  179. package/transpiled/extensions.cadence/components.js.map +1 -0
  180. package/transpiled/extensions.cadence/const.d.ts +21 -0
  181. package/transpiled/extensions.cadence/const.js +26 -0
  182. package/transpiled/extensions.cadence/const.js.map +1 -0
  183. package/transpiled/extensions.cadence/context.d.ts +3 -0
  184. package/transpiled/extensions.cadence/context.js +9 -0
  185. package/transpiled/extensions.cadence/context.js.map +1 -0
  186. package/transpiled/extensions.cadence/deployment.d.ts +9 -0
  187. package/transpiled/extensions.cadence/deployment.js +28 -0
  188. package/transpiled/extensions.cadence/deployment.js.map +1 -0
  189. package/transpiled/extensions.cadence/index.d.ts +7 -0
  190. package/transpiled/extensions.cadence/index.js +7 -0
  191. package/transpiled/extensions.cadence/index.js.map +1 -0
  192. package/transpiled/extensions.cadence/manifest.d.ts +11 -0
  193. package/transpiled/extensions.cadence/manifest.js +42 -0
  194. package/transpiled/extensions.cadence/manifest.js.map +1 -0
  195. package/transpiled/extensions.cadence/manifest.test.d.ts +1 -0
  196. package/transpiled/extensions.cadence/manifest.test.js +41 -0
  197. package/transpiled/extensions.cadence/manifest.test.js.map +1 -0
  198. package/transpiled/extensions.cadence/schemas.d.ts +4 -0
  199. package/transpiled/extensions.cadence/schemas.js +7 -0
  200. package/transpiled/extensions.cadence/schemas.js.map +1 -0
  201. package/transpiled/extensions.cadence/types.d.ts +34 -0
  202. package/transpiled/extensions.cadence/types.js +2 -0
  203. package/transpiled/extensions.cadence/types.js.map +1 -0
  204. package/transpiled/extensions.configuration/components.d.ts +3 -0
  205. package/transpiled/extensions.configuration/components.js +6 -0
  206. package/transpiled/extensions.configuration/components.js.map +1 -0
  207. package/transpiled/extensions.configuration/const.d.ts +18 -0
  208. package/transpiled/extensions.configuration/const.js +22 -0
  209. package/transpiled/extensions.configuration/const.js.map +1 -0
  210. package/transpiled/extensions.configuration/context.d.ts +4 -0
  211. package/transpiled/extensions.configuration/context.js +9 -0
  212. package/transpiled/extensions.configuration/context.js.map +1 -0
  213. package/transpiled/extensions.configuration/deployment.d.ts +17 -0
  214. package/transpiled/extensions.configuration/deployment.js +106 -0
  215. package/transpiled/extensions.configuration/deployment.js.map +1 -0
  216. package/transpiled/extensions.configuration/deployment.test.d.ts +1 -0
  217. package/transpiled/extensions.configuration/deployment.test.js +74 -0
  218. package/transpiled/extensions.configuration/deployment.test.js.map +1 -0
  219. package/transpiled/extensions.configuration/epoch.d.ts +2 -0
  220. package/transpiled/extensions.configuration/epoch.js +19 -0
  221. package/transpiled/extensions.configuration/epoch.js.map +1 -0
  222. package/transpiled/extensions.configuration/index.d.ts +9 -0
  223. package/transpiled/extensions.configuration/index.js +8 -0
  224. package/transpiled/extensions.configuration/index.js.map +1 -0
  225. package/transpiled/extensions.configuration/manifest.d.ts +5 -0
  226. package/transpiled/extensions.configuration/manifest.js +6 -0
  227. package/transpiled/extensions.configuration/manifest.js.map +1 -0
  228. package/transpiled/extensions.configuration/manifest.test.d.ts +1 -0
  229. package/transpiled/extensions.configuration/manifest.test.js +14 -0
  230. package/transpiled/extensions.configuration/manifest.test.js.map +1 -0
  231. package/transpiled/extensions.configuration/schemas.d.ts +3 -0
  232. package/transpiled/extensions.configuration/schemas.js +7 -0
  233. package/transpiled/extensions.configuration/schemas.js.map +1 -0
  234. package/transpiled/extensions.exposition/Annotation.d.ts +71 -0
  235. package/transpiled/extensions.exposition/Annotation.js +2 -0
  236. package/transpiled/extensions.exposition/Annotation.js.map +1 -0
  237. package/transpiled/extensions.exposition/components.d.ts +3 -0
  238. package/transpiled/extensions.exposition/components.js +6 -0
  239. package/transpiled/extensions.exposition/components.js.map +1 -0
  240. package/transpiled/extensions.exposition/const.d.ts +36 -0
  241. package/transpiled/extensions.exposition/const.js +37 -0
  242. package/transpiled/extensions.exposition/const.js.map +1 -0
  243. package/transpiled/extensions.exposition/deployment.d.ts +6 -0
  244. package/transpiled/extensions.exposition/deployment.js +75 -0
  245. package/transpiled/extensions.exposition/deployment.js.map +1 -0
  246. package/transpiled/extensions.exposition/index.d.ts +8 -0
  247. package/transpiled/extensions.exposition/index.js +8 -0
  248. package/transpiled/extensions.exposition/index.js.map +1 -0
  249. package/transpiled/extensions.exposition/manifest.d.ts +3 -0
  250. package/transpiled/extensions.exposition/manifest.js +39 -0
  251. package/transpiled/extensions.exposition/manifest.js.map +1 -0
  252. package/transpiled/extensions.exposition/manifest.test.d.ts +1 -0
  253. package/transpiled/extensions.exposition/manifest.test.js +38 -0
  254. package/transpiled/extensions.exposition/manifest.test.js.map +1 -0
  255. package/transpiled/extensions.exposition/schemas.d.ts +7 -0
  256. package/transpiled/extensions.exposition/schemas.js +10 -0
  257. package/transpiled/extensions.exposition/schemas.js.map +1 -0
  258. package/transpiled/extensions.exposition/schemas.test.d.ts +1 -0
  259. package/transpiled/extensions.exposition/schemas.test.js +22 -0
  260. package/transpiled/extensions.exposition/schemas.test.js.map +1 -0
  261. package/transpiled/extensions.exposition/shortcuts.d.ts +3 -0
  262. package/transpiled/extensions.exposition/shortcuts.js +13 -0
  263. package/transpiled/extensions.exposition/shortcuts.js.map +1 -0
  264. package/transpiled/extensions.exposition/syntax/index.d.ts +2 -0
  265. package/transpiled/extensions.exposition/syntax/index.js +3 -0
  266. package/transpiled/extensions.exposition/syntax/index.js.map +1 -0
  267. package/transpiled/extensions.exposition/syntax/parse.d.ts +4 -0
  268. package/transpiled/extensions.exposition/syntax/parse.js +112 -0
  269. package/transpiled/extensions.exposition/syntax/parse.js.map +1 -0
  270. package/transpiled/extensions.exposition/syntax/parse.test.d.ts +1 -0
  271. package/transpiled/extensions.exposition/syntax/parse.test.js +156 -0
  272. package/transpiled/extensions.exposition/syntax/parse.test.js.map +1 -0
  273. package/transpiled/extensions.exposition/syntax/types.d.ts +52 -0
  274. package/transpiled/extensions.exposition/syntax/types.js +11 -0
  275. package/transpiled/extensions.exposition/syntax/types.js.map +1 -0
  276. package/transpiled/extensions.fetch/context.d.ts +3 -0
  277. package/transpiled/extensions.fetch/context.js +9 -0
  278. package/transpiled/extensions.fetch/context.js.map +1 -0
  279. package/transpiled/extensions.fetch/index.d.ts +1 -0
  280. package/transpiled/extensions.fetch/index.js +2 -0
  281. package/transpiled/extensions.fetch/index.js.map +1 -0
  282. package/transpiled/extensions.introspection/annotation.d.ts +40 -0
  283. package/transpiled/extensions.introspection/annotation.js +39 -0
  284. package/transpiled/extensions.introspection/annotation.js.map +1 -0
  285. package/transpiled/extensions.introspection/components.d.ts +8 -0
  286. package/transpiled/extensions.introspection/components.js +12 -0
  287. package/transpiled/extensions.introspection/components.js.map +1 -0
  288. package/transpiled/extensions.introspection/const.d.ts +30 -0
  289. package/transpiled/extensions.introspection/const.js +35 -0
  290. package/transpiled/extensions.introspection/const.js.map +1 -0
  291. package/transpiled/extensions.introspection/deployment.d.ts +14 -0
  292. package/transpiled/extensions.introspection/deployment.js +41 -0
  293. package/transpiled/extensions.introspection/deployment.js.map +1 -0
  294. package/transpiled/extensions.introspection/index.d.ts +6 -0
  295. package/transpiled/extensions.introspection/index.js +7 -0
  296. package/transpiled/extensions.introspection/index.js.map +1 -0
  297. package/transpiled/extensions.introspection/manifest.d.ts +9 -0
  298. package/transpiled/extensions.introspection/manifest.js +16 -0
  299. package/transpiled/extensions.introspection/manifest.js.map +1 -0
  300. package/transpiled/extensions.introspection/schemas.d.ts +4 -0
  301. package/transpiled/extensions.introspection/schemas.js +7 -0
  302. package/transpiled/extensions.introspection/schemas.js.map +1 -0
  303. package/transpiled/extensions.realtime/components.d.ts +2 -0
  304. package/transpiled/extensions.realtime/components.js +5 -0
  305. package/transpiled/extensions.realtime/components.js.map +1 -0
  306. package/transpiled/extensions.realtime/deployment.d.ts +22 -0
  307. package/transpiled/extensions.realtime/deployment.js +53 -0
  308. package/transpiled/extensions.realtime/deployment.js.map +1 -0
  309. package/transpiled/extensions.realtime/index.d.ts +3 -0
  310. package/transpiled/extensions.realtime/index.js +3 -0
  311. package/transpiled/extensions.realtime/index.js.map +1 -0
  312. package/transpiled/extensions.stash/context.d.ts +3 -0
  313. package/transpiled/extensions.stash/context.js +9 -0
  314. package/transpiled/extensions.stash/context.js.map +1 -0
  315. package/transpiled/extensions.stash/deployment.d.ts +5 -0
  316. package/transpiled/extensions.stash/deployment.js +14 -0
  317. package/transpiled/extensions.stash/deployment.js.map +1 -0
  318. package/transpiled/extensions.stash/index.d.ts +2 -0
  319. package/transpiled/extensions.stash/index.js +3 -0
  320. package/transpiled/extensions.stash/index.js.map +1 -0
  321. package/transpiled/extensions.state/context.d.ts +6 -0
  322. package/transpiled/extensions.state/context.js +8 -0
  323. package/transpiled/extensions.state/context.js.map +1 -0
  324. package/transpiled/extensions.state/index.d.ts +1 -0
  325. package/transpiled/extensions.state/index.js +2 -0
  326. package/transpiled/extensions.state/index.js.map +1 -0
  327. package/transpiled/extensions.storages/Annotation.d.ts +8 -0
  328. package/transpiled/extensions.storages/Annotation.js +31 -0
  329. package/transpiled/extensions.storages/Annotation.js.map +1 -0
  330. package/transpiled/extensions.storages/context.d.ts +3 -0
  331. package/transpiled/extensions.storages/context.js +12 -0
  332. package/transpiled/extensions.storages/context.js.map +1 -0
  333. package/transpiled/extensions.storages/deployment.d.ts +5 -0
  334. package/transpiled/extensions.storages/deployment.js +64 -0
  335. package/transpiled/extensions.storages/deployment.js.map +1 -0
  336. package/transpiled/extensions.storages/index.d.ts +8 -0
  337. package/transpiled/extensions.storages/index.js +7 -0
  338. package/transpiled/extensions.storages/index.js.map +1 -0
  339. package/transpiled/extensions.storages/manifest.d.ts +1 -0
  340. package/transpiled/extensions.storages/manifest.js +8 -0
  341. package/transpiled/extensions.storages/manifest.js.map +1 -0
  342. package/transpiled/extensions.storages/schemas.d.ts +9 -0
  343. package/transpiled/extensions.storages/schemas.js +12 -0
  344. package/transpiled/extensions.storages/schemas.js.map +1 -0
  345. package/transpiled/extensions.storages/schemas.test.d.ts +1 -0
  346. package/transpiled/extensions.storages/schemas.test.js +59 -0
  347. package/transpiled/extensions.storages/schemas.test.js.map +1 -0
  348. package/transpiled/extensions.storages/secrets.d.ts +10 -0
  349. package/transpiled/extensions.storages/secrets.js +16 -0
  350. package/transpiled/extensions.storages/secrets.js.map +1 -0
  351. package/transpiled/extensions.telemetry/const.d.ts +4 -0
  352. package/transpiled/extensions.telemetry/const.js +6 -0
  353. package/transpiled/extensions.telemetry/const.js.map +1 -0
  354. package/transpiled/extensions.telemetry/context.d.ts +3 -0
  355. package/transpiled/extensions.telemetry/context.js +9 -0
  356. package/transpiled/extensions.telemetry/context.js.map +1 -0
  357. package/transpiled/extensions.telemetry/deployment.d.ts +18 -0
  358. package/transpiled/extensions.telemetry/deployment.js +49 -0
  359. package/transpiled/extensions.telemetry/deployment.js.map +1 -0
  360. package/transpiled/extensions.telemetry/index.d.ts +5 -0
  361. package/transpiled/extensions.telemetry/index.js +5 -0
  362. package/transpiled/extensions.telemetry/index.js.map +1 -0
  363. package/transpiled/extensions.telemetry/ready.d.ts +14 -0
  364. package/transpiled/extensions.telemetry/ready.js +16 -0
  365. package/transpiled/extensions.telemetry/ready.js.map +1 -0
  366. package/transpiled/index.d.ts +2 -0
  367. package/transpiled/index.js +3 -0
  368. package/transpiled/index.js.map +1 -0
  369. package/transpiled/storages.mongodb/deployment.d.ts +5 -0
  370. package/transpiled/storages.mongodb/deployment.js +14 -0
  371. package/transpiled/storages.mongodb/deployment.js.map +1 -0
  372. package/transpiled/storages.mongodb/index.d.ts +1 -0
  373. package/transpiled/storages.mongodb/index.js +2 -0
  374. package/transpiled/storages.mongodb/index.js.map +1 -0
  375. package/transpiled/version.d.ts +5 -0
  376. package/transpiled/version.js +8 -0
  377. package/transpiled/version.js.map +1 -0
  378. package/tsconfig.json +10 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,108 @@
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { exports } from './exports.js';
4
+ import { algorithm } from './operations.js';
5
+ const define = (text) => algorithm(exports('module.js', text), 'module.js');
6
+ it('returns null where no function is exported', () => {
7
+ assert.equal(define('export const foo = "bar"'), null);
8
+ });
9
+ it('refuses a function that does not match conventions', () => {
10
+ assert.throws(() => define('export const append = () => null'), /does not match conventions/);
11
+ });
12
+ it('refuses a class that does not match conventions', () => {
13
+ assert.throws(() => define('export class Foo {}'), /does not match conventions/);
14
+ });
15
+ it('refuses two algorithms', () => {
16
+ assert.throws(() => define('export function transition() {}\nexport function observation() {}'), /exports 'transition', 'observation'/);
17
+ });
18
+ describe('function', () => {
19
+ const cases = [
20
+ ['function transition(input, object) {}', { type: 'transition', scope: 'object' }],
21
+ ['function observation(input, object) {}', { type: 'observation', scope: 'object' }],
22
+ ['function assignment(input, changeset) {}', { type: 'assignment', scope: 'changeset' }],
23
+ ['function computation(input, context) {}', { type: 'computation', scope: 'none' }],
24
+ ['function effect(input, context) {}', { type: 'effect', scope: 'none' }],
25
+ ['const observation = (input, objects) => null', { type: 'observation', scope: 'objects' }],
26
+ ['const effect = (_, stream) => stream', { type: 'effect', scope: 'stream' }]
27
+ ];
28
+ for (const [source, expected] of cases)
29
+ it(`defines '${source}'`, () => {
30
+ assert.deepStrictEqual(define('export ' + source), expected);
31
+ });
32
+ it('does not define an unknown scope', () => {
33
+ assert.equal(define('export const assignment = (input, message) => null')?.scope, undefined);
34
+ });
35
+ it('defines null input', () => {
36
+ assert.deepStrictEqual(define('export const observation = () => null'), {
37
+ type: 'observation',
38
+ scope: 'none',
39
+ input: null
40
+ });
41
+ });
42
+ it('defines a default export by its declared name', () => {
43
+ assert.deepStrictEqual(define('export default function transition(input, object) {}'), {
44
+ type: 'transition',
45
+ scope: 'object'
46
+ });
47
+ });
48
+ it('defines an alias by the exported name', () => {
49
+ assert.deepStrictEqual(define('const meter = (input) => 1\nexport { meter as computation }'), {
50
+ type: 'computation',
51
+ scope: 'none'
52
+ });
53
+ });
54
+ it('leaves the scope of a computed export to the manifest', () => {
55
+ assert.deepStrictEqual(define('export const transition = wrap(fn)'), { type: 'transition' });
56
+ });
57
+ it('ignores an export that is neither a function nor named as an algorithm', () => {
58
+ assert.deepStrictEqual(define('export const NAME = "x"\nexport function effect() {}'), {
59
+ type: 'effect',
60
+ scope: 'none',
61
+ input: null
62
+ });
63
+ });
64
+ });
65
+ describe('class', () => {
66
+ it('defines type and scope by the execute method', () => {
67
+ assert.deepStrictEqual(define('export class Transition { execute(input, object) {} }'), {
68
+ type: 'transition',
69
+ scope: 'object'
70
+ });
71
+ });
72
+ it('finds execute among other methods', () => {
73
+ assert.deepStrictEqual(define('export class Assignment { execute(input, object) {}\n run(input, objects) {} }'), { type: 'assignment', scope: 'object' });
74
+ });
75
+ it('refuses a class without execute', () => {
76
+ assert.throws(() => define('export class Observation {}'), /Method 'execute' not found/);
77
+ });
78
+ it('refuses a function named as a class', () => {
79
+ assert.throws(() => define('export function Transition() {}'), /does not match conventions/);
80
+ });
81
+ it('defines none scope and null input', () => {
82
+ assert.deepStrictEqual(define('export class Observation { execute() {} }'), {
83
+ type: 'observation',
84
+ scope: 'none',
85
+ input: null
86
+ });
87
+ });
88
+ it('defines Computation and Effect', () => {
89
+ assert.equal(define('export class Computation { execute() {} }')?.type, 'computation');
90
+ assert.equal(define('export class Effect { execute() {} }')?.type, 'effect');
91
+ });
92
+ });
93
+ describe('factory', () => {
94
+ it('defines type and scope by the name', () => {
95
+ assert.deepStrictEqual(define('export class ObjectTransitionFactory { create() {} }'), {
96
+ type: 'transition',
97
+ scope: 'object'
98
+ });
99
+ });
100
+ it('refuses a scope outside the convention', () => {
101
+ assert.throws(() => define('export class NoneObservationFactory { create() {} }'), /does not match conventions/);
102
+ });
103
+ it('defines ComputationFactory and EffectFactory', () => {
104
+ assert.deepStrictEqual(define('export class ComputationFactory {}'), { type: 'computation' });
105
+ assert.deepStrictEqual(define('export class EffectFactory {}'), { type: 'effect' });
106
+ });
107
+ });
108
+ //# sourceMappingURL=operations.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.test.js","sourceRoot":"","sources":["../../source/bridges.node/operations.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,MAAM,GAAG,CAAC,IAAY,EAAgC,EAAE,CAC5D,SAAS,CAAC,OA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olve to one name are a conflict rather than a race: which of them a scan
5
+ * reached first is not something a component may depend on.
6
+ */
7
+ export declare function sources(root: string, directory: string): Promise<Map<string, string>>;
@@ -0,0 +1,36 @@
1
+ import { readdir } from 'node:fs/promises';
2
+ import { basename, extname, join } from 'node:path';
3
+ /**
4
+ * A component's modules by name, whatever extension each was written with.
5
+ *
6
+ * Two files that resolve to one name are a conflict rather than a race: which of them a scan
7
+ * reached first is not something a component may depend on.
8
+ */
9
+ export async function sources(root, directory) {
10
+ const path = join(root, directory);
11
+ const files = (await list(path)).filter((file) => EXTENSIONS.has(extname(file))).sort();
12
+ const modules = new Map();
13
+ // sorted, so the two files a conflict names are the same two on every machine
14
+ for (const file of files) {
15
+ const name = basename(file, extname(file));
16
+ const found = modules.get(name);
17
+ if (found !== undefined)
18
+ throw new Error(`Component at '${root}' has more than one ${directory}/${name}: ` +
19
+ `${basename(found)} and ${file}`);
20
+ modules.set(name, join(path, file));
21
+ }
22
+ return modules;
23
+ }
24
+ async function list(path) {
25
+ try {
26
+ const entries = await readdir(path, { withFileTypes: true });
27
+ return entries.filter((entry) => entry.isFile()).map((entry) => entry.name);
28
+ }
29
+ catch (error) {
30
+ if (error.code === 'ENOENT')
31
+ return [];
32
+ throw error;
33
+ }
34
+ }
35
+ const EXTENSIONS = new Set(['.js', '.mjs', '.cjs', '.ts']);
36
+ //# sourceMappingURL=sources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.js","sourceRoot":"","sources":["../../source/bridges.node/sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,SAAiB;IAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IAClC,MAAM,K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,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A first-party package's definition, by the reference a manifest or a context names it by.
3
+ * `undefined` for a package this one does not define, which norm then reads on its own.
4
+ */
5
+ export declare function definition(reference: string): Promise<object | undefined>;
6
+ /** Every package defined here, by its directory, which is its name within the scope. */
7
+ export declare const DEFINED: ReadonlySet<string>;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * A first-party package's definition, by the reference a manifest or a context names it by.
3
+ * `undefined` for a package this one does not define, which norm then reads on its own.
4
+ */
5
+ export async function definition(reference) {
6
+ if (!reference.startsWith(SCOPE))
7
+ return undefined;
8
+ const suffix = reference.slice(SCOPE.length);
9
+ if (!DEFINED.has(suffix))
10
+ return undefined;
11
+ cache[suffix] ??= import(`./${suffix}/index.js`);
12
+ return cache[suffix];
13
+ }
14
+ const cache = {};
15
+ const SCOPE = '@toa.io/';
16
+ /** Every package defined here, by its directory, which is its name within the scope. */
17
+ export const DEFINED = new Set([
18
+ 'bindings.amqp',
19
+ 'bindings.loop',
20
+ 'bridges.bash',
21
+ 'bridges.node',
22
+ 'extensions.cadence',
23
+ 'extensions.configuration',
24
+ 'extensions.exposition',
25
+ 'extensions.fetch',
26
+ 'extensions.introspection',
27
+ 'extensions.realtime',
28
+ 'extensions.stash',
29
+ 'extensions.state',
30
+ 'extensions.storages',
31
+ 'extensions.telemetry',
32
+ 'storages.mongodb'
33
+ ]);
34
+ //# sourceMappingURL=definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../source/definition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,SAAiB;IAChD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IAElD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAE5C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAA;IAE1C,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,KAAK,MAAM,WAAW,CAAC,CAAA;IAEhD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,KAAK,GAAoC,EAAE,CAAA;AAEjD,MAAM,KAAK,GAAG,UAAU,CAAA;AAExB,wFAAwF;AACxF,MAAM,CAAC,MAAM,OAAO,GAAwB,IAAI,GAAG,CAAC;IAClD,eAAe;IACf,eAAe;IACf,cAAc;IACd,cAAc;IACd,oBAAoB;IACpB,0BAA0B;IAC1B,uBAAuB;IACvB,kBAAkB;IAClB,0BAA0B;IAC1B,qBAAqB;IACrB,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;IACrB,sBAAsB;IACtB,kBAAkB;CACnB,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,60 @@
1
+ import { createRequire } from 'node:module';
2
+ import { dirname, join, relative, resolve, sep } from 'node:path';
3
+ import { mkdirSync, readdirSync, writeFileSync } from 'node:fs';
4
+ /**
5
+ * Writes the digest of the components each extension ships: their manifests as norm reads
6
+ * them, with every path that reaches into a package replaced by that package's name — so the
7
+ * digest reads the same wherever this package is installed.
8
+ *
9
+ * Runs after the workspace transpiled, from the workspace, where every extension resolves.
10
+ */
11
+ const require = createRequire(import.meta.url);
12
+ // norm types its manifests, not its functions
13
+ const { component } = (await import('@toa.io/norm'));
14
+ const DIGESTED = [
15
+ 'extensions.cadence',
16
+ 'extensions.configuration',
17
+ 'extensions.exposition',
18
+ 'extensions.introspection',
19
+ 'extensions.realtime'
20
+ ];
21
+ const OUT = resolve(import.meta.dirname, '../../digest');
22
+ mkdirSync(OUT, { recursive: true });
23
+ const packages = ['@toa.io/prototype', ...DIGESTED.map((suffix) => '@toa.io/' + suffix)];
24
+ const roots = new Map(packages.map((name) => [root(name), name]));
25
+ for (const suffix of DIGESTED) {
26
+ const directory = join(root('@toa.io/' + suffix), 'components');
27
+ const entries = [];
28
+ for (const dirent of readdirSync(directory, { withFileTypes: true })) {
29
+ if (!dirent.isDirectory())
30
+ continue;
31
+ const manifest = await component(join(directory, dirent.name));
32
+ entries.push({ label: dirent.name.replace('.', '-'), manifest: relativize(manifest) });
33
+ }
34
+ writeFileSync(join(OUT, suffix + '.json'), JSON.stringify(entries));
35
+ }
36
+ function root(name) {
37
+ return dirname(require.resolve(name + '/package.json'));
38
+ }
39
+ /** Absolute paths into a package become `<name>/<inside>`; the locator norm rebuilds. */
40
+ function relativize(value) {
41
+ if (typeof value === 'string')
42
+ return specifier(value);
43
+ if (Array.isArray(value))
44
+ return value.map(relativize);
45
+ if (value !== null && typeof value === 'object') {
46
+ const object = {};
47
+ for (const [key, item] of Object.entries(value))
48
+ if (key !== 'locator')
49
+ object[key] = relativize(item);
50
+ return object;
51
+ }
52
+ return value;
53
+ }
54
+ function specifier(value) {
55
+ for (const [directory, name] of roots)
56
+ if (value === directory || value.startsWith(directory + sep))
57
+ return [name, ...relative(directory, value).split(sep)].filter(Boolean).join('/');
58
+ return value;
59
+ }
60
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../source/digest/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAG/D;;;;;;GAMG;AACH,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,C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AC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAErF,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The components an extension ships, as the digest of their manifests generated when this
3
+ * package was built. A deploy reads them from here, because the extension is not installed
4
+ * beside it; a running service reads them from the extension, where their code is.
5
+ */
6
+ export declare function components(suffix: string, filter?: (label: string) => boolean): Components;
7
+ export interface Components {
8
+ /** what a chart names each component's workload by: `identity-basic` */
9
+ labels: string[];
10
+ /** the manifests as norm reads them, with `path` as a package-relative specifier */
11
+ manifests: object[];
12
+ }
13
+ export interface Entry {
14
+ label: string;
15
+ manifest: object;
16
+ }
@@ -0,0 +1,22 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ /**
4
+ * The components an extension ships, as the digest of their manifests generated when this
5
+ * package was built. A deploy reads them from here, because the extension is not installed
6
+ * beside it; a running service reads them from the extension, where their code is.
7
+ */
8
+ export function components(suffix, filter) {
9
+ const manifests = digest(suffix).filter((manifest) => filter?.(manifest.label) ?? true);
10
+ return {
11
+ labels: manifests.map((manifest) => manifest.label),
12
+ manifests: manifests.map((manifest) => structuredClone(manifest.manifest))
13
+ };
14
+ }
15
+ function digest(suffix) {
16
+ cache[suffix] ??= JSON.parse(readFileSync(resolve(ROOT, suffix + '.json'), 'utf8'));
17
+ return cache[suffix];
18
+ }
19
+ const cache = {};
20
+ /** `transpiled/digest/read.js` → `digest/` */
21
+ const ROOT = resolve(import.meta.dirname, '../../digest');
22
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../source/digest/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,MAAmC;IAC5E,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAA;IAEvF,OAAO;QACL,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;QACnD,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KAC3E,CAAA;AACH,CAAC;AAED,SAAS,MAAM,CAAC,MAAc;IAC5B,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;IAEnF,OAAO,KAAK,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,KAAK,GAA4B,EAAE,CAAA;AAEzC,8CAA8C;AAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { type Components } from '../digest/read.js';
2
+ /** The components this extension ships, which run inside its own service. */
3
+ export declare function components(): Components;
@@ -0,0 +1,6 @@
1
+ import { components as digest } from '../digest/read.js';
2
+ /** The components this extension ships, which run inside its own service. */
3
+ export function components() {
4
+ return digest('extensions.cadence');
5
+ }
6
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../../source/extensions.cadence/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,MAAM,EAAmB,MAAM,mBAAmB,CAAA;AAEzE,6EAA6E;AAC7E,MAAM,UAAU,UAAU;IACxB,OAAO,MAAM,CAAC,oBAAoB,CAAC,CAAA;AACrC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /** The component the extension ships to hold delayed calls. */
2
+ export declare const NAMESPACE = "cadence";
3
+ export declare const COMPONENT = "metronome";
4
+ /**
5
+ * Constant, never configuration: a row carries its lane, so lowering this would leave rows in
6
+ * lanes nobody reads any more. It is also the ceiling on replicas dispatching, and a power of
7
+ * two so that the common replica counts divide evenly. The outbox says the same of its own.
8
+ *
9
+ * A scan asks for its lanes as a set and sorts on `due`, which is the index's second key, so
10
+ * the plan that serves it explodes the set into one scan per lane and merges them in order.
11
+ * MongoDB stops exploding past `internalQueryMaxScansToExplode`, 200 by default, and falls
12
+ * back to sorting the whole result in memory — so this staying well under that is not
13
+ * incidental.
14
+ */
15
+ export declare const LANES = 128;
16
+ /** seconds between passes over the calls waiting to be made, and how far ahead each reaches */
17
+ export declare const DISCRETENESS = 60;
18
+ /** rows one scan brings back */
19
+ export declare const BATCH = 200;
20
+ /** A number from the environment, where a deployment or a test suite states one. */
21
+ export declare function number(variable: string, fallback: number): number;
@@ -0,0 +1,26 @@
1
+ import { environment } from '@toa.io/generic';
2
+ /** The component the extension ships to hold delayed calls. */
3
+ export const NAMESPACE = 'cadence';
4
+ export const COMPONENT = 'metronome';
5
+ /**
6
+ * Constant, never configuration: a row carries its lane, so lowering this would leave rows in
7
+ * lanes nobody reads any more. It is also the ceiling on replicas dispatching, and a power of
8
+ * two so that the common replica counts divide evenly. The outbox says the same of its own.
9
+ *
10
+ * A scan asks for its lanes as a set and sorts on `due`, which is the index's second key, so
11
+ * the plan that serves it explodes the set into one scan per lane and merges them in order.
12
+ * MongoDB stops exploding past `internalQueryMaxScansToExplode`, 200 by default, and falls
13
+ * back to sorting the whole result in memory — so this staying well under that is not
14
+ * incidental.
15
+ */
16
+ export const LANES = 128;
17
+ /** seconds between passes over the calls waiting to be made, and how far ahead each reaches */
18
+ export const DISCRETENESS = 60;
19
+ /** rows one scan brings back */
20
+ export const BATCH = 200;
21
+ /** A number from the environment, where a deployment or a test suite states one. */
22
+ export function number(variable, fallback) {
23
+ const value = Number(environment.get(variable));
24
+ return Number.isNaN(value) || value <= 0 ? fallback : value;
25
+ }
26
+ //# sourceMappingURL=const.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../../source/extensions.cadence/const.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,+DAA+D;AAC/D,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAA;AAClC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAA;AAEpC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;AAExB,+FAA+F;AAC/F,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAA;AAE9B,gCAAgC;AAChC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;AAExB,oFAAoF;AACpF,MAAM,UAAU,MAAM,CAAC,QAAgB,EAAE,QAAgB;IACvD,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAA;IAE/C,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAA;AAC7D,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Contribution } from '@toa.io/core/types';
2
+ /** What this extension puts on the context of a component that declares it. */
3
+ export declare function context(): Contribution;
@@ -0,0 +1,9 @@
1
+ /** What this extension puts on the context of a component that declares it. */
2
+ export function context() {
3
+ return {
4
+ name: 'delay',
5
+ type: 'Delay',
6
+ imports: { '@toa.io/extensions.cadence': ['Delay'] }
7
+ };
8
+ }
9
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../source/extensions.cadence/context.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,MAAM,UAAU,OAAO;IACrB,OAAO;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,EAAE,4BAA4B,EAAE,CAAC,OAAO,CAAC,EAAE;KACrD,CAAA;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Annotation } from './types.js';
2
+ import type { Dependency } from '@toa.io/operations';
3
+ /**
4
+ * The component that keeps delayed calls runs in a service of its own, the way the identity
5
+ * components run in the gateway. A composition may claim it and run it in its own pods instead.
6
+ */
7
+ export declare function deployment(_: unknown, annotation?: Annotation | null): Dependency;
8
+ /** The extension is deployed for the sake of `delay`, which nothing has to declare to use. */
9
+ export declare const standalone = true;
@@ -0,0 +1,28 @@
1
+ import { components } from './components.js';
2
+ import { version } from '../version.js';
3
+ import { DISCRETENESS, NAMESPACE } from './const.js';
4
+ import * as schemas from './schemas.js';
5
+ /**
6
+ * The component that keeps delayed calls runs in a service of its own, the way the identity
7
+ * components run in the gateway. A composition may claim it and run it in its own pods instead.
8
+ */
9
+ export function deployment(_, annotation) {
10
+ schemas.annotation.validate(annotation ?? null, 'Invalid cadence annotation');
11
+ // stated in seconds and carried in milliseconds, so that what an application writes is what
12
+ // the rest of a manifest is written in
13
+ const discreteness = (annotation?.discreteness ?? DISCRETENESS) * 1000;
14
+ const variables = [
15
+ { name: 'TOA_CADENCE_DISCRETENESS', value: String(discreteness) }
16
+ ];
17
+ const service = {
18
+ group: NAMESPACE,
19
+ name: 'metronome',
20
+ version,
21
+ components: components().labels,
22
+ variables
23
+ };
24
+ return { services: [service] };
25
+ }
26
+ /** The extension is deployed for the sake of `delay`, which nothing has to declare to use. */
27
+ export const standalone = true;
28
+ //# sourceMappingURL=deployment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../source/extensions.cadence/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAIvC;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,CAAU,EAAE,UAA8B;IACnE,OAAO,CAAC,UAAU,CAAC,QAAQ,CACzB,UAAU,IAAI,IAAI,EAClB,4BAA4B,CAC7B,CAAA;IAED,4FAA4F;IAC5F,uCAAuC;IACvC,MAAM,YAAY,GAAG,CAAC,UAAU,EAAE,YAAY,IAAI,YAAY,CAAC,GAAG,IAAI,CAAA;IACtE,MAAM,SAAS,GAAe;QAC5B,EAAE,IAAI,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE;KAClE,CAAA;IAED,MAAM,OAAO,GAAY;QACvB,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,WAAW;QACjB,OAAO;QACP,UAAU,EAAE,UAAU,EAAE,CAAC,MAAM;QAC/B,SAAS;KACV,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAA;AAChC,CAAC;AAED,8FAA8F;AAC9F,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAA"}
@@ -0,0 +1,7 @@
1
+ export { manifest } from './manifest.js';
2
+ export { components } from './components.js';
3
+ export { deployment, standalone } from './deployment.js';
4
+ export { context } from './context.js';
5
+ export * from './const.js';
6
+ export * as schemas from './schemas.js';
7
+ export type { Annotation, Declaration, Delay, Options, Pulse } from './types.js';
@@ -0,0 +1,7 @@
1
+ export { manifest } from './manifest.js';
2
+ export { components } from './components.js';
3
+ export { deployment, standalone } from './deployment.js';
4
+ export { context } from './context.js';
5
+ export * from './const.js';
6
+ export * as schemas from './schemas.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/extensions.cadence/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,cAAc,YAAY,CAAA;AAC1B,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { Declaration } from './types.js';
2
+ import type { Manifest } from '@toa.io/norm';
3
+ /**
4
+ * The `cadence:` block of a component manifest: the operations called on a cadence, by the
5
+ * operation each one calls. Norm hands over the whole manifest, so what the declaration refers
6
+ * to is checked here rather than left to fail at boot.
7
+ *
8
+ * A component that declares nothing still has a declaration. `cadence: ~` is how one that only
9
+ * delays calls says so, and it has to produce a value or norm rejects the extension.
10
+ */
11
+ export declare function manifest(declaration: Declaration | null | undefined, component: Manifest): Declaration;
@@ -0,0 +1,42 @@
1
+ import * as schemas from './schemas.js';
2
+ /**
3
+ * The `cadence:` block of a component manifest: the operations called on a cadence, by the
4
+ * operation each one calls. Norm hands over the whole manifest, so what the declaration refers
5
+ * to is checked here rather than left to fail at boot.
6
+ *
7
+ * A component that declares nothing still has a declaration. `cadence: ~` is how one that only
8
+ * delays calls says so, and it has to produce a value or norm rejects the extension.
9
+ */
10
+ export function manifest(declaration, component) {
11
+ const normalized = expand(declaration);
12
+ schemas.declaration.validate(normalized, 'Invalid cadence declaration');
13
+ for (const [endpoint, pulse] of Object.entries(normalized)) {
14
+ const operation = component.operations?.[endpoint];
15
+ if (operation === undefined)
16
+ throw new Error(`Pulse refers to undefined operation '${endpoint}'`);
17
+ if (!TYPES.has(operation.type))
18
+ throw new Error(`Pulse '${endpoint}' must refer to an operation of the allowed types: ` +
19
+ [...TYPES].join(', '));
20
+ if (pulse.intervals > pulse.cycle)
21
+ throw new Error(`Pulse '${endpoint}' splits a cycle of ${pulse.cycle} seconds into ` +
22
+ `${pulse.intervals} intervals, which is less than a second each`);
23
+ }
24
+ return normalized;
25
+ }
26
+ /** A pulse whose cycle is not split has nothing to state but the cycle. */
27
+ function expand(declaration) {
28
+ if (declaration === null || declaration === undefined)
29
+ return {};
30
+ // a cycle nothing splits is one interval, which is what the shorthand declares
31
+ return Object.fromEntries(Object.entries(declaration).map(([endpoint, pulse]) => {
32
+ const declared = typeof pulse === 'number' ? { cycle: pulse } : { ...pulse };
33
+ declared.intervals ??= 1;
34
+ return [endpoint, declared];
35
+ }));
36
+ }
37
+ /**
38
+ * The types a receiver may refer to. An operation that produces no side effects has nothing to
39
+ * be called periodically for.
40
+ */
41
+ const TYPES = new Set(['transition', 'assignment', 'effect', 'unmanaged']);
42
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../source/extensions.cadence/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAIvC;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CACtB,WAA2C,EAC3C,SAAmB;IAEnB,MAAM,UAAU,GAA4B,MAAM,CAAC,WAAW,CAAC,CAAA;IAE/D,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAc,UAAU,EAAE,6BAA6B,CAAC,CAAA;IAEpF,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3D,MAAM,SAAS,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAA;QAElD,IAAI,SAAS,KAAK,SAAS;YACzB,MAAM,IAAI,KAAK,CAAC,wCAAwC,QAAQ,GAAG,CAAC,CAAA;QAEtE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;YAC5B,MAAM,IAAI,KAAK,CACb,UAAU,QAAQ,qDAAqD;gBACrE,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACxB,CAAA;QAEH,IAAI,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK;YAC/B,MAAM,IAAI,KAAK,CACb,UAAU,QAAQ,uBAAuB,KAAK,CAAC,KAAK,gBAAgB;gBAClE,GAAG,KAAK,CAAC,SAAS,8CAA8C,CACnE,CAAA;IACL,CAAC;IAED,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,2EAA2E;AAC3E,SAAS,MAAM,CAAC,WAA2C;IACzD,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IAEhE,+EAA+E;IAC/E,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE;QACpD,MAAM,QAAQ,GACZ,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAA;QAE7D,QAAQ,CAAC,SAAS,KAAK,CAAC,CAAA;QAExB,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAC7B,CAAC,CAAC,CACH,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ import { it } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { manifest } from './manifest.js';
4
+ const component = {
5
+ operations: {
6
+ sweep: { type: 'effect' },
7
+ gather: { type: 'transition' },
8
+ peek: { type: 'observation' }
9
+ }
10
+ };
11
+ it('should normalize a declaration', () => {
12
+ const declaration = manifest({ sweep: { cycle: 86400, intervals: 24 } }, component);
13
+ assert.deepStrictEqual(declaration, { sweep: { cycle: 86400, intervals: 24 } });
14
+ });
15
+ it('should split a cycle into one interval by default', () => {
16
+ const declaration = manifest({ sweep: { cycle: 3600 } }, component);
17
+ assert.deepStrictEqual(declaration, { sweep: { cycle: 3600, intervals: 1 } });
18
+ });
19
+ it('should expand the shorthand', () => {
20
+ const declaration = manifest({ sweep: 3600 }, component);
21
+ assert.deepStrictEqual(declaration, { sweep: { cycle: 3600, intervals: 1 } });
22
+ });
23
+ it('should answer a component that only delays calls', () => {
24
+ assert.deepStrictEqual(manifest(null, component), {});
25
+ });
26
+ it('should refuse an undefined operation', () => {
27
+ assert.throws(() => manifest({ nothing: 3600 }, component), /refers to undefined operation 'nothing'/);
28
+ });
29
+ it('should refuse an operation that produces no side effects', () => {
30
+ assert.throws(() => manifest({ peek: 3600 }, component), /of the allowed types/);
31
+ });
32
+ it('should refuse an interval shorter than a second', () => {
33
+ assert.throws(() => manifest({ sweep: { cycle: 60, intervals: 61 } }, component), /less than a second/);
34
+ });
35
+ it('should refuse a cycle of no time at all', () => {
36
+ assert.throws(() => manifest({ sweep: { cycle: 0, intervals: 1 } }, component));
37
+ });
38
+ it('should refuse what the declaration does not describe', () => {
39
+ assert.throws(() => manifest({ sweep: { cycle: 60, every: 3 } }, component));
40
+ });
41
+ //# sourceMappingURL=manifest.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.test.js","sourceRoot":"","sources":["../../source/extensions.cadence/manifest.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AAC9B,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,MAAM,SAAS,GAAG;IAChB,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,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types.js';
3
+ export declare const declaration: Schema<Declaration>;
4
+ export declare const annotation: Schema<Annotation>;
@@ -0,0 +1,7 @@
1
+ import { resolve } from 'node:path';
2
+ import * as schemas from '@toa.io/schemas';
3
+ const path = resolve(import.meta.dirname, '../../schemas/extensions.cadence');
4
+ const namespace = schemas.namespace(path);
5
+ export const declaration = namespace.schema('declaration');
6
+ export const annotation = namespace.schema('annotation');
7
+ //# sourceMappingURL=schemas.js.map