@grnsft/if 0.5.0 → 0.6.0-beta.0

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 (451) hide show
  1. package/README.md +5 -17
  2. package/Refactor-migration-guide.md +110 -164
  3. package/build/common/config/index.d.ts +1 -0
  4. package/build/common/config/index.js +6 -0
  5. package/build/common/config/strings.d.ts +8 -0
  6. package/build/common/config/strings.js +16 -0
  7. package/build/common/lib/load.d.ts +6 -0
  8. package/build/common/lib/load.js +18 -0
  9. package/build/{types → common/types}/manifest.d.ts +4 -1
  10. package/build/common/types/manifest.js +3 -0
  11. package/build/common/util/debug-logger.js +115 -0
  12. package/build/common/util/fs.js +94 -0
  13. package/build/common/util/helpers.d.ts +15 -0
  14. package/build/common/util/helpers.js +80 -0
  15. package/build/{util → common/util}/logger.js +1 -1
  16. package/build/{util → common/util}/validations.d.ts +149 -47
  17. package/build/common/util/validations.js +141 -0
  18. package/build/common/util/yaml.js +59 -0
  19. package/build/if-check/config/config.d.ts +6 -0
  20. package/build/if-check/config/config.js +31 -0
  21. package/build/{config → if-check/config}/index.d.ts +0 -1
  22. package/build/if-check/config/index.js +8 -0
  23. package/build/if-check/config/strings.d.ts +12 -0
  24. package/build/if-check/config/strings.js +16 -0
  25. package/build/if-check/index.js +98 -0
  26. package/build/if-check/types/process-args.d.ts +4 -0
  27. package/build/if-check/types/process-args.js +3 -0
  28. package/build/if-check/util/args.d.ts +10 -0
  29. package/build/if-check/util/args.js +56 -0
  30. package/build/if-check/util/helpers.d.ts +4 -0
  31. package/build/if-check/util/helpers.js +18 -0
  32. package/build/if-check/util/npm.d.ts +4 -0
  33. package/build/if-check/util/npm.js +59 -0
  34. package/build/if-csv/config/config.d.ts +6 -0
  35. package/build/if-csv/config/config.js +37 -0
  36. package/build/if-csv/config/index.d.ts +2 -0
  37. package/build/if-csv/config/index.js +8 -0
  38. package/build/if-csv/config/strings.d.ts +4 -0
  39. package/build/if-csv/config/strings.js +8 -0
  40. package/build/if-csv/index.js +63 -0
  41. package/build/if-csv/types/csv.d.ts +7 -0
  42. package/build/if-csv/types/csv.js +3 -0
  43. package/build/if-csv/types/process-args.d.ts +5 -0
  44. package/build/if-csv/types/process-args.js +3 -0
  45. package/build/if-csv/util/args.d.ts +12 -0
  46. package/build/if-csv/util/args.js +51 -0
  47. package/build/if-csv/util/helpers.d.ts +9 -0
  48. package/build/if-csv/util/helpers.js +95 -0
  49. package/build/if-diff/config/config.d.ts +6 -0
  50. package/build/if-diff/config/config.js +31 -0
  51. package/build/if-diff/config/index.d.ts +2 -0
  52. package/build/if-diff/config/index.js +8 -0
  53. package/build/if-diff/config/strings.d.ts +6 -0
  54. package/build/if-diff/config/strings.js +10 -0
  55. package/build/if-diff/index.js +46 -0
  56. package/build/{lib → if-diff/lib}/compare.d.ts +1 -1
  57. package/build/if-diff/lib/compare.js +56 -0
  58. package/build/{lib → if-diff/lib}/load.d.ts +16 -18
  59. package/build/if-diff/lib/load.js +51 -0
  60. package/build/if-diff/types/args.js +3 -0
  61. package/build/if-diff/types/compare.js +3 -0
  62. package/build/if-diff/types/process-args.d.ts +4 -0
  63. package/build/if-diff/types/process-args.js +3 -0
  64. package/build/if-diff/util/args.d.ts +5 -0
  65. package/build/if-diff/util/args.js +51 -0
  66. package/build/if-diff/util/helpers.d.ts +13 -0
  67. package/build/if-diff/util/helpers.js +75 -0
  68. package/build/if-env/config/config.d.ts +6 -0
  69. package/build/if-env/config/config.js +37 -0
  70. package/build/if-env/config/index.d.ts +2 -0
  71. package/build/if-env/config/index.js +8 -0
  72. package/build/if-env/config/strings.d.ts +7 -0
  73. package/build/if-env/config/strings.js +11 -0
  74. package/build/if-env/index.js +40 -0
  75. package/build/if-env/types/if-env.js +3 -0
  76. package/build/if-env/types/npm.js +3 -0
  77. package/build/if-env/types/process-args.d.ts +5 -0
  78. package/build/if-env/types/process-args.js +3 -0
  79. package/build/if-env/util/args.d.ts +12 -0
  80. package/build/if-env/util/args.js +47 -0
  81. package/build/if-env/util/helpers.d.ts +20 -0
  82. package/build/if-env/util/helpers.js +94 -0
  83. package/build/{util → if-env/util}/npm.d.ts +0 -4
  84. package/build/if-env/util/npm.js +126 -0
  85. package/build/if-run/builtins/coefficient/index.d.ts +2 -0
  86. package/build/if-run/builtins/coefficient/index.js +67 -0
  87. package/build/if-run/builtins/copy-param/index.d.ts +2 -0
  88. package/build/if-run/builtins/copy-param/index.js +70 -0
  89. package/build/if-run/builtins/csv-lookup/index.d.ts +2 -0
  90. package/build/if-run/builtins/csv-lookup/index.js +190 -0
  91. package/build/if-run/builtins/divide/index.d.ts +2 -0
  92. package/build/if-run/builtins/divide/index.js +80 -0
  93. package/build/if-run/builtins/exponent/index.d.ts +2 -0
  94. package/build/if-run/builtins/exponent/index.js +60 -0
  95. package/build/{builtins → if-run/builtins}/export-log.d.ts +1 -1
  96. package/build/{builtins → if-run/builtins}/export-log.js +1 -1
  97. package/build/{builtins → if-run/builtins}/export-yaml.d.ts +1 -1
  98. package/build/if-run/builtins/export-yaml.js +30 -0
  99. package/build/{builtins → if-run/builtins}/index.d.ts +1 -2
  100. package/build/{builtins → if-run/builtins}/index.js +4 -6
  101. package/build/if-run/builtins/interpolation/index.d.ts +2 -0
  102. package/build/if-run/builtins/interpolation/index.js +151 -0
  103. package/build/if-run/builtins/mock-observations/helpers/common-generator.js +29 -0
  104. package/build/if-run/builtins/mock-observations/helpers/rand-int-generator.js +48 -0
  105. package/build/if-run/builtins/mock-observations/index.d.ts +2 -0
  106. package/build/if-run/builtins/mock-observations/index.js +116 -0
  107. package/build/if-run/builtins/mock-observations/interfaces/index.js +3 -0
  108. package/build/if-run/builtins/multiply/index.d.ts +2 -0
  109. package/build/if-run/builtins/multiply/index.js +59 -0
  110. package/build/if-run/builtins/regex/index.d.ts +2 -0
  111. package/build/if-run/builtins/regex/index.js +76 -0
  112. package/build/if-run/builtins/sci/config.js +44 -0
  113. package/build/if-run/builtins/sci/index.d.ts +2 -0
  114. package/build/if-run/builtins/sci/index.js +92 -0
  115. package/build/if-run/builtins/sci-embodied/index.d.ts +2 -0
  116. package/build/if-run/builtins/sci-embodied/index.js +156 -0
  117. package/build/if-run/builtins/shell/index.d.ts +2 -0
  118. package/build/if-run/builtins/shell/index.js +60 -0
  119. package/build/if-run/builtins/subtract/index.d.ts +2 -0
  120. package/build/if-run/builtins/subtract/index.js +61 -0
  121. package/build/if-run/builtins/sum/index.d.ts +2 -0
  122. package/build/if-run/builtins/sum/index.js +66 -0
  123. package/build/if-run/builtins/time-sync/index.d.ts +17 -0
  124. package/build/if-run/builtins/time-sync/index.js +339 -0
  125. package/build/if-run/config/config.d.ts +9 -0
  126. package/build/if-run/config/config.js +73 -0
  127. package/build/if-run/config/index.d.ts +2 -0
  128. package/build/if-run/config/index.js +8 -0
  129. package/build/{config → if-run/config}/strings.d.ts +28 -54
  130. package/build/if-run/config/strings.js +76 -0
  131. package/build/if-run/index.d.ts +2 -0
  132. package/build/if-run/index.js +63 -0
  133. package/build/if-run/lib/aggregate.d.ts +15 -0
  134. package/build/if-run/lib/aggregate.js +123 -0
  135. package/build/if-run/lib/compute.js +136 -0
  136. package/build/{lib → if-run/lib}/environment.d.ts +1 -1
  137. package/build/if-run/lib/environment.js +75 -0
  138. package/build/{lib → if-run/lib}/exhaust.d.ts +1 -1
  139. package/build/if-run/lib/exhaust.js +27 -0
  140. package/build/if-run/lib/explain.d.ts +9 -0
  141. package/build/if-run/lib/explain.js +43 -0
  142. package/build/if-run/lib/initialize.d.ts +6 -0
  143. package/build/if-run/lib/initialize.js +109 -0
  144. package/build/if-run/lib/regroup.d.ts +5 -0
  145. package/build/if-run/lib/regroup.js +64 -0
  146. package/build/if-run/types/aggregation.d.ts +5 -0
  147. package/build/if-run/types/aggregation.js +6 -0
  148. package/build/{types → if-run/types}/compute.d.ts +12 -8
  149. package/build/if-run/types/compute.js +3 -0
  150. package/build/if-run/types/environment.js +3 -0
  151. package/build/{types → if-run/types}/exhaust-plugin-interface.d.ts +1 -1
  152. package/build/if-run/types/exhaust-plugin-interface.js +3 -0
  153. package/build/if-run/types/explain.d.ts +10 -0
  154. package/build/if-run/types/explain.js +3 -0
  155. package/build/if-run/types/interface.d.ts +3 -0
  156. package/build/if-run/types/interface.js +6 -0
  157. package/build/if-run/types/plugin-storage.js +3 -0
  158. package/build/if-run/types/process-args.d.ts +25 -0
  159. package/build/if-run/types/process-args.js +3 -0
  160. package/build/if-run/types/time-sync.js +3 -0
  161. package/build/{util → if-run/util}/aggregation-helper.d.ts +2 -1
  162. package/build/if-run/util/aggregation-helper.js +47 -0
  163. package/build/if-run/util/args.d.ts +9 -0
  164. package/build/if-run/util/args.js +60 -0
  165. package/build/if-run/util/helpers.d.ts +14 -0
  166. package/build/if-run/util/helpers.js +57 -0
  167. package/build/if-run/util/log-memoize.js +19 -0
  168. package/build/if-run/util/os-checker.js +97 -0
  169. package/build/{util → if-run/util}/plugin-storage.d.ts +1 -1
  170. package/build/if-run/util/plugin-storage.js +34 -0
  171. package/jest.config.js +2 -6
  172. package/manifests/examples/builtins/coefficient/failure-invalid-config-input-param.yml +2 -2
  173. package/manifests/examples/builtins/coefficient/failure-output-param-is-null.yaml +3 -3
  174. package/manifests/examples/builtins/coefficient/success.yml +2 -2
  175. package/manifests/examples/builtins/csv-lookup/cloud-metadata/failure-invalid-instance-type.yaml +3 -3
  176. package/manifests/examples/builtins/csv-lookup/cloud-metadata/failure-invalid-vendor.yaml +3 -3
  177. package/manifests/examples/builtins/csv-lookup/cloud-metadata/failure-missing-cloud-vendor.yml +3 -3
  178. package/manifests/examples/builtins/csv-lookup/cloud-metadata/success.yml +3 -3
  179. package/manifests/examples/builtins/csv-lookup/region-metadata/failure-missing-column.yml +3 -3
  180. package/manifests/examples/builtins/csv-lookup/region-metadata/failure-missing-output.yml +3 -3
  181. package/manifests/examples/builtins/csv-lookup/region-metadata/success-renaming.yml +4 -4
  182. package/manifests/examples/builtins/csv-lookup/region-metadata/success.yml +3 -3
  183. package/manifests/examples/builtins/csv-lookup/tdp-finder/failure-missing-input-param.yml +2 -2
  184. package/manifests/examples/builtins/csv-lookup/tdp-finder/failure-unsupported-physical-processor.yml +2 -2
  185. package/manifests/examples/builtins/csv-lookup/tdp-finder/success.yml +2 -2
  186. package/manifests/examples/builtins/divide/failure-denominator-equal-zero.yml +4 -4
  187. package/manifests/examples/builtins/divide/failure-invalid-config-denominator.yml +5 -5
  188. package/manifests/examples/builtins/divide/failure-missing-numerator.yml +4 -4
  189. package/manifests/examples/builtins/divide/success.yml +4 -6
  190. package/manifests/examples/builtins/exponent/success.yml +5 -7
  191. package/manifests/examples/builtins/interpolation/interpolation.yml +2 -2
  192. package/manifests/examples/builtins/interpolation/success.yml +2 -1
  193. package/manifests/examples/builtins/mock-observations/failure-invalid-config-cpu-range.yml +2 -2
  194. package/manifests/examples/builtins/mock-observations/failure-invalid-memory-utilization-range.yml +2 -2
  195. package/manifests/examples/builtins/mock-observations/failure-missing-timestamp-from-param.yml +2 -2
  196. package/manifests/examples/builtins/mock-observations/success.yml +2 -2
  197. package/manifests/examples/builtins/multiply/failure-input-parameter-is-missing.yml +2 -4
  198. package/manifests/examples/builtins/multiply/success-with-multiple-inputs.yml +2 -4
  199. package/manifests/examples/builtins/multiply/success.yml +3 -4
  200. package/manifests/examples/builtins/regex/failure-missing-input-param.yml +2 -4
  201. package/manifests/examples/builtins/regex/failure-not-matching-with-regex.yml +2 -4
  202. package/manifests/examples/builtins/regex/success.yml +2 -4
  203. package/manifests/examples/builtins/sci/failure-invalid-config-value.yml +2 -2
  204. package/manifests/examples/builtins/sci/failure-missing-input-param.yml +3 -2
  205. package/manifests/examples/builtins/sci/success.yml +2 -3
  206. package/manifests/examples/builtins/sci-embodied/failure-invalid-default-emission-value.yml +3 -3
  207. package/manifests/examples/builtins/sci-embodied/failure-missing-expected-lifespan.yml +2 -2
  208. package/manifests/examples/builtins/sci-embodied/success.yml +2 -2
  209. package/manifests/examples/builtins/shell/failure-invalid-command.yml +2 -2
  210. package/manifests/examples/builtins/shell/success.yml +2 -1
  211. package/manifests/examples/builtins/subtract/success.yml +6 -8
  212. package/manifests/examples/builtins/sum/failure-missing-input-param.yml +2 -4
  213. package/manifests/examples/builtins/sum/failure-missing-output-param.yml +3 -5
  214. package/manifests/examples/builtins/sum/success.yml +2 -4
  215. package/manifests/examples/builtins/time-sync/failure-config-start-later-end.yml +3 -3
  216. package/manifests/examples/builtins/time-sync/failure-missing-global-config.yml +3 -3
  217. package/manifests/examples/builtins/time-sync/success.yml +2 -2
  218. package/manifests/examples/{builtins/groupby/failure-invalid-config-group.yml → features/regroup/failure-invalid-regroup.yml} +4 -11
  219. package/manifests/examples/{builtins/groupby → features/regroup}/failure-missing-cloud-instance-type.yml +5 -12
  220. package/manifests/examples/{builtins/groupby → features/regroup}/success.yml +4 -11
  221. package/manifests/examples/pipelines/generics.yml +12 -13
  222. package/manifests/examples/pipelines/instance-metadata.yml +4 -5
  223. package/manifests/examples/pipelines/nesting.yml +157 -50
  224. package/manifests/examples/pipelines/outputs-if-diff/pipeline-with-aggregate.yaml +997 -0
  225. package/manifests/examples/pipelines/outputs-if-diff/pipeline-with-mocks.yaml +1059 -0
  226. package/manifests/examples/pipelines/pipeline-teads-sci.yml +11 -11
  227. package/manifests/examples/pipelines/pipeline-with-aggregate.yml +114 -37
  228. package/manifests/examples/pipelines/pipeline-with-mocks.yml +193 -103
  229. package/manifests/examples/pipelines/scenario-1.yml +34 -0
  230. package/manifests/examples/pipelines/scenario-2.yml +52 -0
  231. package/manifests/examples/pipelines/scenario-3.yml +86 -0
  232. package/manifests/examples/pipelines/scenario-4.yml +46 -0
  233. package/manifests/examples/pipelines/scenario-5.yml +46 -0
  234. package/manifests/examples/pipelines/sci.yml +15 -17
  235. package/manifests/examples/pipelines/teads-curve.yml +7 -6
  236. package/manifests/examples/pipelines/zeros.yml +15 -16
  237. package/manifests/outputs/bugs/aggregation-error-wrong-metric.yaml +51 -59
  238. package/manifests/outputs/bugs/input-error-missing-duration.yaml +14 -16
  239. package/manifests/outputs/bugs/mock-observations-failure-duration-is-zero.yaml +14 -16
  240. package/manifests/outputs/bugs/pipeline-error-naming-mismatch.yaml +14 -16
  241. package/manifests/outputs/bugs/pipeline-error-uninitialized-plugin.yaml +15 -17
  242. package/manifests/outputs/bugs/pipeline-ordering-error.yaml +23 -26
  243. package/manifests/outputs/bugs/sci-embodied-missing-resources-total.yaml +13 -14
  244. package/manifests/outputs/{plugins → builtins}/coefficient/failure-invalid-config-input-param.yaml +13 -17
  245. package/manifests/outputs/{plugins → builtins}/coefficient/failure-output-param-is-null.yaml +13 -17
  246. package/manifests/outputs/{plugins → builtins}/coefficient/success.yaml +11 -16
  247. package/manifests/outputs/builtins/csv-lookup/cloud-metadata/failure-invalid-instance-type.yaml +76 -0
  248. package/manifests/outputs/{plugins → builtins}/csv-lookup/cloud-metadata/failure-missing-cloud-vendor.yaml +16 -19
  249. package/manifests/outputs/{plugins → builtins}/csv-lookup/cloud-metadata/success.yaml +16 -19
  250. package/manifests/outputs/{plugins → builtins}/csv-lookup/region-metadata/failure-missing-column.yaml +14 -15
  251. package/manifests/outputs/{plugins → builtins}/csv-lookup/region-metadata/failure-missing-output.yaml +13 -15
  252. package/manifests/outputs/{plugins → builtins}/csv-lookup/region-metadata/success-renaming.yaml +13 -15
  253. package/manifests/outputs/{plugins → builtins}/csv-lookup/region-metadata/success.yaml +14 -16
  254. package/manifests/outputs/{plugins → builtins}/csv-lookup/tdp-finder/failure-missing-input-param.yaml +13 -16
  255. package/manifests/outputs/{plugins → builtins}/csv-lookup/tdp-finder/failure-unsupported-physical-processor.yaml +13 -15
  256. package/manifests/outputs/{plugins → builtins}/csv-lookup/tdp-finder/success.yaml +13 -15
  257. package/manifests/outputs/{plugins → builtins}/divide/failure-invalid-config-denominator.yaml +13 -17
  258. package/manifests/outputs/{plugins → builtins}/divide/failure-missing-numerator.yaml +13 -15
  259. package/manifests/outputs/{plugins → builtins}/divide/success-denominator-equal-zero.yaml +14 -18
  260. package/manifests/outputs/{plugins → builtins}/divide/success.yaml +14 -18
  261. package/manifests/outputs/{plugins → builtins}/exponent/success.yaml +13 -17
  262. package/manifests/outputs/{plugins → builtins}/interpolation/interpolation.yaml +14 -16
  263. package/manifests/outputs/{plugins → builtins}/interpolation/success.yaml +14 -16
  264. package/manifests/outputs/{plugins → builtins}/mock-observations/failure-invalid-config-cpu-range.yaml +13 -15
  265. package/manifests/outputs/{plugins → builtins}/mock-observations/failure-invalid-memory-utilization-range.yaml +13 -15
  266. package/manifests/outputs/{plugins → builtins}/mock-observations/failure-missing-timestamp-from-param.yaml +13 -15
  267. package/manifests/outputs/builtins/mock-observations/success.yaml +358 -0
  268. package/manifests/outputs/{plugins → builtins}/multiply/failure-input-parameter-is-missing.yaml +13 -17
  269. package/manifests/outputs/{plugins → builtins}/multiply/success-with-multiple-inputs.yaml +13 -17
  270. package/manifests/outputs/{plugins → builtins}/multiply/success.yaml +13 -17
  271. package/manifests/outputs/{plugins → builtins}/regex/failure-missing-input-param.yaml +13 -17
  272. package/manifests/outputs/{plugins → builtins}/regex/success.yaml +14 -19
  273. package/manifests/outputs/{plugins → builtins}/sci/failure-invalid-config-value.yaml +14 -16
  274. package/manifests/outputs/{plugins → builtins}/sci/failure-missing-input-param.yaml +13 -15
  275. package/manifests/outputs/{plugins/sci/success.yml.yaml → builtins/sci/success.yaml} +13 -16
  276. package/manifests/outputs/{plugins → builtins}/sci-embodied/failure-invalid-default-emission-value.yaml +13 -15
  277. package/manifests/outputs/{plugins → builtins}/sci-embodied/failure-missing-expected-lifespan.yaml +13 -15
  278. package/manifests/outputs/{plugins → builtins}/sci-embodied/success.yaml +13 -15
  279. package/manifests/outputs/{plugins → builtins}/shell/failure-invalid-command.yaml +14 -16
  280. package/manifests/outputs/{plugins → builtins}/shell/success.yaml +14 -16
  281. package/manifests/outputs/{plugins → builtins}/subtract/success.yaml +13 -17
  282. package/manifests/outputs/{plugins → builtins}/sum/failure-missing-input-param.yaml +13 -17
  283. package/manifests/outputs/{plugins → builtins}/sum/failure-missing-output-param.yaml +13 -17
  284. package/manifests/outputs/{plugins → builtins}/sum/success.yaml +13 -17
  285. package/manifests/outputs/{plugins → builtins}/time-sync/failure-config-start-later-end.yaml +20 -23
  286. package/manifests/outputs/{plugins → builtins}/time-sync/success.yaml +38 -35
  287. package/manifests/outputs/features/aggregate-failure-invalid-metrics.yaml +17 -18
  288. package/manifests/outputs/features/aggregate-failure-missing-metric-in-inputs.yaml +17 -18
  289. package/manifests/outputs/features/aggregate-horizontal.yaml +27 -23
  290. package/manifests/outputs/features/aggregate-vertical.yaml +33 -29
  291. package/manifests/outputs/features/aggregate.yaml +33 -29
  292. package/manifests/outputs/{plugins/groupby/failure-invalid-config-group.yaml → features/failure-invalid-regroup.yaml} +16 -25
  293. package/manifests/outputs/{plugins/groupby → features}/failure-missing-cloud-instance-type.yaml +16 -25
  294. package/manifests/outputs/pipelines/cloud-metadata-divide.yaml +14 -18
  295. package/manifests/outputs/pipelines/generics.yaml +239 -0
  296. package/manifests/outputs/pipelines/instance-metadata.yaml +98 -0
  297. package/manifests/outputs/pipelines/mock-obs-time-sync.yaml +246 -147
  298. package/manifests/outputs/pipelines/nesting.yaml +1799 -0
  299. package/manifests/outputs/pipelines/pipeline-teads-sci.yaml +276 -0
  300. package/manifests/outputs/pipelines/sci.yaml +297 -0
  301. package/manifests/outputs/pipelines/teads-curve.yaml +188 -0
  302. package/manifests/outputs/pipelines/zeros.yaml +198 -0
  303. package/package.json +15 -16
  304. package/src/__mocks__/mock-manifest.yaml +2 -3
  305. package/src/{config → if-env/config}/env-template.yml +2 -3
  306. package/src/{builtins → if-run/builtins}/coefficient/README.md +31 -9
  307. package/src/{builtins → if-run/builtins}/copy-param/README.md +30 -11
  308. package/src/{builtins → if-run/builtins}/csv-lookup/README.md +32 -20
  309. package/src/{builtins → if-run/builtins}/divide/README.md +21 -8
  310. package/src/{builtins → if-run/builtins}/exponent/README.md +19 -8
  311. package/src/{builtins → if-run/builtins}/interpolation/README.md +21 -6
  312. package/src/{builtins → if-run/builtins}/mock-observations/README.md +18 -4
  313. package/src/{builtins → if-run/builtins}/multiply/README.md +20 -8
  314. package/src/{builtins → if-run/builtins}/regex/README.md +19 -9
  315. package/src/{builtins → if-run/builtins}/sci/README.md +19 -9
  316. package/src/{builtins → if-run/builtins}/sci-embodied/README.md +17 -5
  317. package/src/{builtins → if-run/builtins}/shell/README.md +19 -7
  318. package/src/{builtins → if-run/builtins}/subtract/README.md +17 -6
  319. package/src/{builtins → if-run/builtins}/sum/README.md +34 -8
  320. package/src/if-run/builtins/time-sync/README.md +267 -0
  321. package/build/builtins/coefficient/index.d.ts +0 -2
  322. package/build/builtins/coefficient/index.js +0 -65
  323. package/build/builtins/copy-param/index.d.ts +0 -2
  324. package/build/builtins/copy-param/index.js +0 -68
  325. package/build/builtins/csv-lookup/index.d.ts +0 -2
  326. package/build/builtins/csv-lookup/index.js +0 -188
  327. package/build/builtins/divide/index.d.ts +0 -2
  328. package/build/builtins/divide/index.js +0 -78
  329. package/build/builtins/exponent/index.d.ts +0 -2
  330. package/build/builtins/exponent/index.js +0 -58
  331. package/build/builtins/export-csv-raw.d.ts +0 -4
  332. package/build/builtins/export-csv-raw.js +0 -132
  333. package/build/builtins/export-csv.d.ts +0 -10
  334. package/build/builtins/export-csv.js +0 -96
  335. package/build/builtins/export-yaml.js +0 -30
  336. package/build/builtins/group-by.d.ts +0 -5
  337. package/build/builtins/group-by.js +0 -71
  338. package/build/builtins/interpolation/index.d.ts +0 -2
  339. package/build/builtins/interpolation/index.js +0 -148
  340. package/build/builtins/mock-observations/helpers/common-generator.js +0 -29
  341. package/build/builtins/mock-observations/helpers/rand-int-generator.js +0 -48
  342. package/build/builtins/mock-observations/index.d.ts +0 -2
  343. package/build/builtins/mock-observations/index.js +0 -114
  344. package/build/builtins/mock-observations/interfaces/index.js +0 -3
  345. package/build/builtins/multiply/index.d.ts +0 -2
  346. package/build/builtins/multiply/index.js +0 -57
  347. package/build/builtins/regex/index.d.ts +0 -2
  348. package/build/builtins/regex/index.js +0 -74
  349. package/build/builtins/sci/config.js +0 -44
  350. package/build/builtins/sci/index.d.ts +0 -2
  351. package/build/builtins/sci/index.js +0 -70
  352. package/build/builtins/sci-embodied/index.d.ts +0 -2
  353. package/build/builtins/sci-embodied/index.js +0 -114
  354. package/build/builtins/shell/index.d.ts +0 -2
  355. package/build/builtins/shell/index.js +0 -58
  356. package/build/builtins/subtract/index.d.ts +0 -2
  357. package/build/builtins/subtract/index.js +0 -59
  358. package/build/builtins/sum/index.d.ts +0 -2
  359. package/build/builtins/sum/index.js +0 -64
  360. package/build/builtins/time-sync.d.ts +0 -2
  361. package/build/builtins/time-sync.js +0 -300
  362. package/build/check.js +0 -95
  363. package/build/config/config.d.ts +0 -29
  364. package/build/config/config.js +0 -147
  365. package/build/config/index.js +0 -10
  366. package/build/config/params.d.ts +0 -2
  367. package/build/config/params.js +0 -196
  368. package/build/config/strings.js +0 -105
  369. package/build/diff.js +0 -46
  370. package/build/env.js +0 -38
  371. package/build/index.js +0 -48
  372. package/build/lib/aggregate.d.ts +0 -6
  373. package/build/lib/aggregate.js +0 -77
  374. package/build/lib/compare.js +0 -56
  375. package/build/lib/compute.js +0 -91
  376. package/build/lib/environment.js +0 -75
  377. package/build/lib/exhaust.js +0 -53
  378. package/build/lib/initialize.d.ts +0 -6
  379. package/build/lib/initialize.js +0 -101
  380. package/build/lib/load.js +0 -70
  381. package/build/lib/parameterize.d.ts +0 -6
  382. package/build/lib/parameterize.js +0 -55
  383. package/build/types/aggregation.d.ts +0 -2
  384. package/build/types/aggregation.js +0 -5
  385. package/build/types/compute.js +0 -3
  386. package/build/types/environment.js +0 -3
  387. package/build/types/exhaust-plugin-interface.js +0 -3
  388. package/build/types/if-env.js +0 -3
  389. package/build/types/interface.d.ts +0 -4
  390. package/build/types/interface.js +0 -8
  391. package/build/types/lib/compare.js +0 -3
  392. package/build/types/manifest.js +0 -3
  393. package/build/types/npm.js +0 -3
  394. package/build/types/parameters.d.ts +0 -5
  395. package/build/types/parameters.js +0 -5
  396. package/build/types/plugin-storage.js +0 -3
  397. package/build/types/process-args.d.ts +0 -33
  398. package/build/types/process-args.js +0 -3
  399. package/build/types/time-sync.js +0 -3
  400. package/build/types/util/args.js +0 -3
  401. package/build/util/aggregation-helper.js +0 -55
  402. package/build/util/args.d.ts +0 -37
  403. package/build/util/args.js +0 -205
  404. package/build/util/debug-logger.js +0 -118
  405. package/build/util/fs.js +0 -94
  406. package/build/util/helpers.d.ts +0 -57
  407. package/build/util/helpers.js +0 -251
  408. package/build/util/json.d.ts +0 -4
  409. package/build/util/json.js +0 -36
  410. package/build/util/log-memoize.js +0 -19
  411. package/build/util/npm.js +0 -152
  412. package/build/util/os-checker.js +0 -97
  413. package/build/util/plugin-storage.js +0 -34
  414. package/build/util/validations.js +0 -124
  415. package/build/util/yaml.js +0 -59
  416. package/manifests/outputs/bugs/initialize-error-no-config.yaml +0 -78
  417. package/manifests/outputs/bugs/initialize-error-no-path.yaml +0 -91
  418. package/manifests/outputs/bugs/initialize-error-no-plugins.yaml +0 -74
  419. package/manifests/outputs/divide.yaml +0 -93
  420. package/manifests/outputs/pipelines/mock-obs-group-by-cloud-meta.yaml +0 -645
  421. package/manifests/outputs/pipelines/mock-obs-groupby.yaml +0 -178
  422. package/manifests/outputs/plugins/csv-lookup/cloud-metadata/failure-invalid-instance-type.yaml +0 -27
  423. package/manifests/outputs/plugins/csv-lookup/cloud-metadata/failure-invalid-vendor.yaml +0 -27
  424. package/manifests/outputs/plugins/groupby/success.yaml +0 -101
  425. package/manifests/outputs/plugins/mock-observations/success.yaml +0 -220
  426. package/manifests/outputs/plugins/regex/failure-not-matching-with-regex.yaml +0 -76
  427. package/manifests/outputs/plugins/time-sync/failure-missing-global-config.yaml +0 -78
  428. package/src/__tests__/integration/templates/integration.yaml +0 -16
  429. package/src/builtins/README.md +0 -848
  430. /package/build/{util → common/util}/debug-logger.d.ts +0 -0
  431. /package/build/{util → common/util}/fs.d.ts +0 -0
  432. /package/build/{util → common/util}/logger.d.ts +0 -0
  433. /package/build/{util → common/util}/yaml.d.ts +0 -0
  434. /package/build/{index.d.ts → if-check/index.d.ts} +0 -0
  435. /package/build/{check.d.ts → if-csv/index.d.ts} +0 -0
  436. /package/build/{diff.d.ts → if-diff/index.d.ts} +0 -0
  437. /package/build/{types/util → if-diff/types}/args.d.ts +0 -0
  438. /package/build/{types/lib → if-diff/types}/compare.d.ts +0 -0
  439. /package/build/{env.d.ts → if-env/index.d.ts} +0 -0
  440. /package/build/{types → if-env/types}/if-env.d.ts +0 -0
  441. /package/build/{types → if-env/types}/npm.d.ts +0 -0
  442. /package/build/{builtins → if-run/builtins}/mock-observations/helpers/common-generator.d.ts +0 -0
  443. /package/build/{builtins → if-run/builtins}/mock-observations/helpers/rand-int-generator.d.ts +0 -0
  444. /package/build/{builtins → if-run/builtins}/mock-observations/interfaces/index.d.ts +0 -0
  445. /package/build/{builtins → if-run/builtins}/sci/config.d.ts +0 -0
  446. /package/build/{lib → if-run/lib}/compute.d.ts +0 -0
  447. /package/build/{types → if-run/types}/environment.d.ts +0 -0
  448. /package/build/{types → if-run/types}/plugin-storage.d.ts +0 -0
  449. /package/build/{types → if-run/types}/time-sync.d.ts +0 -0
  450. /package/build/{util → if-run/util}/log-memoize.d.ts +0 -0
  451. /package/build/{util → if-run/util}/os-checker.d.ts +0 -0
package/README.md CHANGED
@@ -19,7 +19,7 @@ Read the [specification and design docs](https://if.greensoftware.foundation) to
19
19
 
20
20
  ## Get started
21
21
 
22
- IF is a framework for running pipelines of plugins that operate on a set of observations. This is all configured using a manifest file. We provide a standard library of plugins that come bundled with IF - we refer to these as `builtins`. We also have an [Explorer](https://explorer.if.greensoftware.foundation) where anyone can list third party plugins you can install.
22
+ IF is a framework for running pipelines of plugins that operate on a set of observations. This is all configured using a manifest file. We provide a standard library of plugins that come bundled with IF - we refer to these as `builtins`. We also have an [Explorer](https://explorer.if.greensoftware.foundation) where anyone can list third party plugins you can install.
23
23
 
24
24
  Start by installing the latest version of IF:
25
25
 
@@ -32,26 +32,18 @@ Then create a `manifest` file that describes your application (see our docs for
32
32
  Then, run `if` using the following command:
33
33
 
34
34
  ```sh
35
- if-run --manifest <path-to-your-manifest-file> --stdout
36
- ## or you can use aliases
37
- if-run -m <path-to-your-manifest-file> -s
35
+ if-run --manifest <path-to-your-manifest-file>
36
+ ## or you can use alias
37
+ if-run -m <path-to-your-manifest-file>
38
38
 
39
39
  ```
40
40
 
41
- Note that above command will print your outputs to the console. You can also provide the `--output` command to save your outputs to a yaml file:
41
+ Note that above command will print your outputs to the console. If you do not want to print the outputs to the console, you need to provide `--no-output` command. You can also provide the `--output` command to save your outputs to a yaml file:
42
42
 
43
43
  ```sh
44
44
  if-run -m <path-to-your-manifest> -o <savepath>
45
45
  ```
46
46
 
47
- Note that you also have to add configuration to your manifest to enable this, as follows:
48
-
49
- ```yaml
50
- initialize:
51
- output:
52
- - yaml
53
- ```
54
-
55
47
  The `if-run` CLI tool will configure and run the plugins defined in your input `yaml` (`manifest`) and return the results as an output `yaml` (`output`).
56
48
 
57
49
  Use the `debug` command if you want to diagnose and fix errors in your plugin:
@@ -72,19 +64,16 @@ if-run -h
72
64
 
73
65
  Please read our documentation at [if.greensoftware.foundation](https://if.greensoftware.foundation/)
74
66
 
75
-
76
67
  ## Video walk-through
77
68
 
78
69
  Watch this video to learn how to create and run a `manifest`.
79
70
 
80
71
  [![Watch the walk-through video](https://i3.ytimg.com/vi/R-6eDM8AsvY/maxresdefault.jpg)](https://youtu.be/GW37Qd4AQbU)
81
72
 
82
-
83
73
  ## Join our mailing list
84
74
 
85
75
  We have a public mailing list at [if-community@greensoftware.foundation](https://groups.google.com/u/1/a/greensoftware.foundation/g/if-community). We send out weekly updates that explain what we've shipped, what we're working on and how you can get involved each week!
86
76
 
87
-
88
77
  ## Contributing
89
78
 
90
79
  To contribute to IF, please fork this repository and raise a pull request from your fork.
@@ -93,7 +82,6 @@ You can check our issue board for issues. We mark some issues `core-only` if the
93
82
 
94
83
  Please read the full contribution guidelines at [if.greensoftware.foundation](https://if.greensoftware.foundation/Contributing)
95
84
 
96
-
97
85
  ## Bug reports
98
86
 
99
87
  To report bugs please use our bug report template. You can do this by opening a new issue and selecting `Bug Report` when you are prompted to pick a template. The more information you provide,.the quicker we will be able to reproduce, diagnose and triage your issue.
@@ -8,43 +8,29 @@ If you are a IF user or developer, there are some changes you must be aware of r
8
8
 
9
9
  There have been some name changes to the CLI, specifically:
10
10
 
11
- - `impact-engine` --> `ie`
12
- The command line tool has been renamed from `impact-engine` to simply `ie`. This means that to invoke the Impact Framework on the command line you simply use
11
+ - `impact-engine` --> `if-run`
12
+ The command line tool has been renamed from `impact-engine` to simply `if-run`. This means that to invoke the Impact Framework on the command line you simply use
13
13
 
14
- ```
15
- if-run ...
16
- ```
17
- - `impl` --> `manifest`
18
- We have deprecated the original `impl` and `ompl` terminology across all our repositories and on the command line. Now, to pass a manifest file to IF, you use the `--manifest` command, as follows:
14
+ ```
15
+ if-run ...
16
+ ```
19
17
 
20
- ```sh
21
- if-run --manifest <path-to-manifest>
22
- ```
18
+ - `impl` --> `manifest`
19
+ We have deprecated the original `impl` and `ompl` terminology across all our repositories and on the command line. Now, to pass a manifest file to IF, you use the `--manifest` command, as follows:
23
20
 
21
+ ```sh
22
+ if-run --manifest <path-to-manifest>
23
+ ```
24
24
 
25
25
  - `ompl` --> `output`
26
-
27
- We have deprecated the original `impl` and `ompl` terminology across all our repositories and on the command line. Now, to define a savepath for your output file, you use the `--output` command, as follows:
28
26
 
29
- ```sh
30
- if-run --manifest <path-to-manifest> --output <savepath>
31
- ```
27
+ We have deprecated the original `impl` and `ompl` terminology across all our repositories and on the command line. Now, to define a savepath for your output file, you use the `--output` command, as follows:
32
28
 
33
- ## Outputs
29
+ ```sh
30
+ if-run --manifest <path-to-manifest> --output <savepath>
31
+ ```
34
32
 
35
- We currently default to exporting output data to the console only. If you want to export to a file, you have to add a small piece of config inside your manifest, as follows:
36
-
37
- ```yaml
38
- initalize:
39
- plugins: ...
40
- outputs: ['yaml']
41
- ```
42
-
43
- You then provide your savepatrh (without file extension) to the `--output` command on the CLI.
44
-
45
- The available options are currently `csv`, `yaml` or `log`.
46
-
47
- ### Summary of how to run the refactored IF
33
+ ### Summary of how to run the refactored IF
48
34
 
49
35
  As before, you can install IF from our npm package using
50
36
 
@@ -64,7 +50,6 @@ This will dump the output to the console. If you want to save the output to a ya
64
50
  if-run --manifest <path-to-manifest> --output <savepath>
65
51
  ```
66
52
 
67
-
68
53
  If you want to clone the source code and install and run a local copy of IF, you can do so using:
69
54
 
70
55
  ```sh
@@ -76,138 +61,136 @@ npm i
76
61
  Then run IF using the following command:
77
62
 
78
63
  ```sh
79
- npm run if -- --manifest <path-to-manifest>
64
+ npm run if-run -- --manifest <path-to-manifest>
80
65
  ```
81
66
 
82
-
83
67
  ## Manifest files
84
68
 
85
69
  There have also been some changes to the structure of manifest files. Some of these are simple renaming changes, others are more functional.
86
70
 
87
71
  - **Rename `graph` -> `tree`**
88
- The `graph` section of the manifest file is now renamed to `tree`. This is just to help us stay consistent in our metaphors and provide a more familiar naming convention for the data beneath.
72
+ The `graph` section of the manifest file is now renamed to `tree`. This is just to help us stay consistent in our metaphors and provide a more familiar naming convention for the data beneath.
89
73
 
90
74
  - **Use plugin name as key in `Initialize` block**
91
- In the previous version of IF, the plugins were organized into an array each having a `name` key, with the plugin name as the value. In the refactored IF, we use the name as the key identifying the plugin. For example, this is the OLD way:
92
-
93
- ```yaml
94
- initialize:
95
- plugins:
96
- - name: ccf
97
- model: CloudCarbonFootprint
98
- path: if-plugins
99
- ```
100
-
101
- This is the new way:
102
-
103
- ```yaml
104
- initialize:
105
- plugins:
106
- "sci-e":
107
- path: "@grnsft/if-plugins"
108
- method: SciE
109
- ```
75
+ In the previous version of IF, the plugins were organized into an array each having a `name` key, with the plugin name as the value. In the refactored IF, we use the name as the key identifying the plugin. For example, this is the OLD way:
76
+
77
+ ```yaml
78
+ initialize:
79
+ plugins:
80
+ - name: ccf
81
+ model: CloudCarbonFootprint
82
+ path: if-plugins
83
+ ```
84
+
85
+ This is the new way:
86
+
87
+ ```yaml
88
+ initialize:
89
+ plugins:
90
+ 'sci-e':
91
+ path: '@grnsft/if-plugins'
92
+ method: SciE
93
+ ```
110
94
 
111
95
  - **Rename `model` to `method` in `Initialize` block**
112
- Each plugin in the initialize block
113
-
114
- Each plugin in the `Initialize` block has a field where the name of the exported function representing that plugin is defined. Previously, these were class names and they were defined using the `model` key. Now, they are functions, and they are defined using the `method` key. We use `method` instead of `function` because `function` is a reserved keyword in Typescript.
115
-
116
- For example:
117
-
118
- ```yaml
119
- "sci-embodied":
120
- path: "builtin"
121
- method: SciEmbodied
122
- ```
96
+ Each plugin in the initialize block
97
+
98
+ Each plugin in the `Initialize` block has a field where the name of the exported function representing that plugin is defined. Previously, these were class names and they were defined using the `model` key. Now, they are functions, and they are defined using the `method` key. We use `method` instead of `function` because `function` is a reserved keyword in Typescript.
99
+
100
+ For example:
101
+
102
+ ```yaml
103
+ 'sci-embodied':
104
+ path: 'builtin'
105
+ method: SciEmbodied
106
+ ```
123
107
 
124
108
  - **Global config**
125
- We have introduced the concept of global config to the plugins. This is truly global configuration data that should be kept constant regardless of where the plugin is invoked across the manifest file.
126
-
127
- A good example is the `interpolation` method to use in the Teads curve plugin - this is not expected to vary from component to component and can therefore be defined in global config. The plugin code itself must expect the global config. Then, the config can be passed in the `Initialize` block, for example:
128
-
129
- ```yaml
130
- initialize:
131
- plugins:
132
- "time-sync":
133
- method: TimeSync
134
- path: "builtin"
135
- global-config:
136
- start-time: "2023-12-12T00:00:00.000Z"
137
- end-time: "2023-12-12T00:01:00.000Z"
138
- interval: 5
139
- allow-padding: true
140
- ```
109
+ We have introduced the concept of global config to the plugins. This is truly global configuration data that should be kept constant regardless of where the plugin is invoked across the manifest file.
110
+
111
+ A good example is the `interpolation` method to use in the Teads curve plugin - this is not expected to vary from component to component and can therefore be defined in global config. The plugin code itself must expect the global config. Then, the config can be passed in the `Initialize` block, for example:
112
+
113
+ ```yaml
114
+ initialize:
115
+ plugins:
116
+ 'time-sync':
117
+ method: TimeSync
118
+ path: 'builtin'
119
+ global-config:
120
+ start-time: '2023-12-12T00:00:00.000Z'
121
+ end-time: '2023-12-12T00:01:00.000Z'
122
+ interval: 5
123
+ allow-padding: true
124
+ ```
141
125
 
142
126
  - **Node level config**
143
127
 
144
- We have also introduced the concept of node-level config. This is designed for pluin configuration that might vary between components in the tree. For example, for each child in the tree you might wish to use the `groupby` plugin to group the outputs according to a different set of keys.
128
+ We have also introduced the concept of node-level config. This is designed for pluin configuration that might vary between components in the tree. For example, for each child in the tree you might wish to use the `regroup` feature to group the outputs according to a different set of keys.
145
129
 
146
- ```yaml
147
- tree:
148
- children:
149
- child-1:
150
- pipeline:
130
+ ```yaml
131
+ tree:
132
+ children:
133
+ child-1:
134
+ pipeline:
135
+ compute:
151
136
  - teads-curve
152
137
  - sci-e
153
138
  - sci-embodied
154
139
  - sci-o
155
140
  - time-sync
156
141
  - sci
157
- config:
158
- group-by:
159
- group:
160
- - region
161
- - cloud/instance-type
162
- ```
142
+ regroup:
143
+ - region
144
+ - cloud/instance-type
145
+ ```
163
146
 
164
147
  - **Defaults**
165
148
 
166
- We have also introduced the concept of `defaults`. This is a section in each component's definition that can be used to provide fallbacks for missing input data. For example, perhaps you have a value arriving from an external API that should be present in every observation in your inputs array, but for soem reason the API fails to deliver a value for some timestamps. In this case, IF would fallback to the value provided for that metric in the `defaults` section of the manifest for that component.
149
+ We have also introduced the concept of `defaults`. This is a section in each component's definition that can be used to provide fallbacks for missing input data. For example, perhaps you have a value arriving from an external API that should be present in every observation in your inputs array, but for soem reason the API fails to deliver a value for some timestamps. In this case, IF would fallback to the value provided for that metric in the `defaults` section of the manifest for that component.
167
150
 
168
- You can also use `defaults` as a quick way to add values to everyobservation in your input array if those values are expected to be constant over time (e.g. some of the lifespan values for embodied carbon calculations could be appropriate to include in defaults). This saves you from having to enter the value in every observation in the input array, instead IF can automatically grab it from `defaults` for every timestamp.
151
+ You can also use `defaults` as a quick way to add values to everyobservation in your input array if those values are expected to be constant over time (e.g. some of the lifespan values for embodied carbon calculations could be appropriate to include in defaults). This saves you from having to enter the value in every observation in the input array, instead IF can automatically grab it from `defaults` for every timestamp.
169
152
 
170
- ```yaml
171
- tree:
172
- children:
173
- child-1:
174
- pipeline:
153
+ ```yaml
154
+ tree:
155
+ children:
156
+ child-1:
157
+ pipeline:
158
+ compute:
175
159
  - teads-curve
176
160
  - sci-e
177
161
  - sci-embodied
178
162
  - sci-o
179
163
  - time-sync
180
164
  - sci
181
- defaults:
182
- cpu/thermal-design-power: 100
183
- grid/carbon-intensity: 800
184
- device/emissions-embodied: 1533.120 # gCO2eq
185
- time-reserved: 3600 # 1hr in seconds
186
- device/expected-lifespan: 94608000 # 3 years in seconds
187
- resources-reserved: 1
188
- resources-total: 8
189
- ```
190
-
191
-
165
+ defaults:
166
+ cpu/thermal-design-power: 100
167
+ grid/carbon-intensity: 800
168
+ device/emissions-embodied: 1533.120 # gCO2eq
169
+ time-reserved: 3600 # 1hr in seconds
170
+ device/expected-lifespan: 94608000 # 3 years in seconds
171
+ resources-reserved: 1
172
+ resources-total: 8
173
+ ```
192
174
 
193
175
  ## New IF features
194
176
 
195
177
  ### Time-sync
196
- Technically time-sync is not a new feature as it was present in IF before the refactor, but there are some tweaks to how the plugin is configured that are worth explaining here. Time sync snaps all input arrays across an entire graph to a common time grid.
178
+
179
+ Technically time-sync is not a new feature as it was present in IF before the refactor, but there are some tweaks to how the plugin is configured that are worth explaining here. Time sync snaps all input arrays across an entire graph to a common time grid.
197
180
 
198
181
  This means you have to define a global start time, end time and interval to use everywhere. There is also a boolean to toggle whether you should allow the time sync model to pad the start and end of your time series with zeroes. You should default to `true` unless you have a specific reason not to. In the refactored IF we expect this information to be provided in global config, as follows:
199
182
 
200
183
  ```yaml
201
184
  initialize:
202
- plugins:
203
- "time-sync":
204
- method: TimeSync
205
- path: "builtin"
206
- global-config:
207
- start-time: "2023-12-12T00:00:00.000Z"
208
- end-time: "2023-12-12T00:01:00.000Z"
209
- interval: 5
210
- allow-padding: true
185
+ plugins:
186
+ 'time-sync':
187
+ method: TimeSync
188
+ path: 'builtin'
189
+ global-config:
190
+ start-time: '2023-12-12T00:00:00.000Z'
191
+ end-time: '2023-12-12T00:01:00.000Z'
192
+ interval: 5
193
+ allow-padding: true
211
194
  ```
212
195
 
213
196
  ### Aggregate
@@ -216,7 +199,7 @@ The aggregate plugin aggregates data in two ways: first it condenses individual
216
199
 
217
200
  This is a builtin feature of IF, meaning it does not have to be initialized as a plugin. Instead, you just have to include a short config block in the top of the manifest file. There are two pieces of information required:
218
201
 
219
- - `metrics`: which metrics do you want to aggregate? Every metric you provide here must exist in the output array.
202
+ - `metrics`: which metrics do you want to aggregate? Every metric you provide here must exist in the output array and be described in the `parameter-metadata` of the plugin.
220
203
 
221
204
  - `type`: the options are `horizontal`, `vertical` or both. Horizontal aggregation is the type that condenses each time series into a single summary value. Vertical aggregation is aggregated across components.
222
205
 
@@ -225,52 +208,16 @@ Here's what the config block should look like:
225
208
  ```yaml
226
209
  aggregation:
227
210
  metrics:
228
- - 'carbon'
211
+ - carbon
229
212
  type: 'both'
230
213
  ```
231
214
 
232
-
233
- ### Groupby
234
-
235
- Groupby allows you to regroup your outputs according to keys you define. For example, maybe you want to group your outputs by region (show me all the outputs for applications run in `uk-south` etc). Groupby *is* a plugin that needs to be initialized in the manifest.
236
-
237
- You can initialize the plugin as follows:
238
-
239
- ```yaml
240
- initialize:
241
- plugins:
242
- 'group-by':
243
- path: builtin
244
- method: GroupBy
245
- ```
246
-
247
- Then you configure groupby for each component in the node level config. In the following example we will regroup the outputs by the `region`:
248
-
249
- ```yaml
250
- tree:
251
- children:
252
- child-1:
253
- pipeline:
254
- - teads-curve
255
- - sci-e
256
- - sci-embodied
257
- - sci-o
258
- - time-sync
259
- - group-by
260
- - sci
261
- config:
262
- group-by:
263
- group:
264
- - region
265
- ```
266
-
267
215
  ### Exhaust
268
216
 
269
- We have introduced `exhaust` as an IF feature. This is a wrapper around export plugins and it allows community contributors to create plugins for exporting to different formats.
217
+ We have introduced `exhaust` as an IF feature. This is a wrapper around export plugins and it allows community contributors to create plugins for exporting to different formats.
270
218
 
271
219
  Details tbc...
272
220
 
273
-
274
221
  ## Plugins
275
222
 
276
223
  The plugins themselves require some changes to keep them compatible with the refactored IF.
@@ -295,18 +242,17 @@ The plugin still requires an execute function. This is where you implement the p
295
242
  Here's a minimal example for a plugin that sums some inputs defined in global config - see inline comments for some important notes:
296
243
 
297
244
  ```ts
298
-
299
245
  // Here's the function definition - notice that global config is passed in here!
300
246
  export const Sum = (globalConfig: SumConfig): PluginInterface => {
301
247
  const inputParameters = globalConfig['input-parameters'] || [];
302
248
  const outputParameter = globalConfig['output-parameter'];
303
-
304
- // we also return metadata now too - you can add more or just use this default
249
+
250
+ // we also return metadata now too - you can add more or just use this default
305
251
  const metadata = {
306
252
  kind: 'execute',
307
253
  };
308
-
309
- /**
254
+
255
+ /**
310
256
  * Calculate the sum of the input metrics for each timestamp.
311
257
  */
312
258
  const execute = async (inputs: PluginParams[]): Promise<PluginParams[]> => {
@@ -332,7 +278,7 @@ export const Sum = (globalConfig: SumConfig): PluginInterface => {
332
278
  );
333
279
  };
334
280
 
335
- // return the metadata and the execute function
281
+ // return the metadata and the execute function
336
282
  return {
337
283
  metadata,
338
284
  execute,
@@ -0,0 +1 @@
1
+ export { STRINGS } from './strings';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STRINGS = void 0;
4
+ var strings_1 = require("./strings");
5
+ Object.defineProperty(exports, "STRINGS", { enumerable: true, get: function () { return strings_1.STRINGS; } });
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29tbW9uL2NvbmZpZy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxxQ0FBa0M7QUFBMUIsa0dBQUEsT0FBTyxPQUFBIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHtTVFJJTkdTfSBmcm9tICcuL3N0cmluZ3MnO1xuIl19
@@ -0,0 +1,8 @@
1
+ export declare const STRINGS: {
2
+ DISCLAIMER_MESSAGE: string;
3
+ SOURCE_IS_NOT_YAML: string;
4
+ TARGET_IS_NOT_YAML: string;
5
+ MANIFEST_NOT_FOUND: string;
6
+ SUCCESS_MESSAGE: string;
7
+ MANIFEST_IS_MISSING: string;
8
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STRINGS = void 0;
4
+ exports.STRINGS = {
5
+ DISCLAIMER_MESSAGE: `
6
+ Incubation Project
7
+
8
+ This project is an incubation project being run inside the Green Software Foundation; as such, we DON’T recommend using it in any critical use case.
9
+ Incubation projects are experimental, offer no support guarantee, have minimal governance and process, and may be retired at any moment. This project may one day graduate, in which case this disclaimer will be removed.`,
10
+ SOURCE_IS_NOT_YAML: 'Given source file is not in yaml format.',
11
+ TARGET_IS_NOT_YAML: 'Given target file is not in yaml format.',
12
+ MANIFEST_NOT_FOUND: 'Manifest file not found.',
13
+ SUCCESS_MESSAGE: 'The environment is successfully setup!',
14
+ MANIFEST_IS_MISSING: 'Manifest is missing.',
15
+ };
16
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5ncy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21tb24vY29uZmlnL3N0cmluZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQWEsUUFBQSxPQUFPLEdBQUc7SUFDckIsa0JBQWtCLEVBQUU7Ozs7Mk5BSXFNO0lBQ3pOLGtCQUFrQixFQUFFLDBDQUEwQztJQUM5RCxrQkFBa0IsRUFBRSwwQ0FBMEM7SUFDOUQsa0JBQWtCLEVBQUUsMEJBQTBCO0lBQzlDLGVBQWUsRUFBRSx3Q0FBd0M7SUFDekQsbUJBQW1CLEVBQUUsc0JBQXNCO0NBQzVDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgU1RSSU5HUyA9IHtcbiAgRElTQ0xBSU1FUl9NRVNTQUdFOiBgXG5JbmN1YmF0aW9uIFByb2plY3RcblxuVGhpcyBwcm9qZWN0IGlzIGFuIGluY3ViYXRpb24gcHJvamVjdCBiZWluZyBydW4gaW5zaWRlIHRoZSBHcmVlbiBTb2Z0d2FyZSBGb3VuZGF0aW9uOyBhcyBzdWNoLCB3ZSBET07igJlUIHJlY29tbWVuZCB1c2luZyBpdCBpbiBhbnkgY3JpdGljYWwgdXNlIGNhc2UuIFxuSW5jdWJhdGlvbiBwcm9qZWN0cyBhcmUgZXhwZXJpbWVudGFsLCBvZmZlciBubyBzdXBwb3J0IGd1YXJhbnRlZSwgaGF2ZSBtaW5pbWFsIGdvdmVybmFuY2UgYW5kIHByb2Nlc3MsIGFuZCBtYXkgYmUgcmV0aXJlZCBhdCBhbnkgbW9tZW50LiBUaGlzIHByb2plY3QgbWF5IG9uZSBkYXkgZ3JhZHVhdGUsIGluIHdoaWNoIGNhc2UgdGhpcyBkaXNjbGFpbWVyIHdpbGwgYmUgcmVtb3ZlZC5gLFxuICBTT1VSQ0VfSVNfTk9UX1lBTUw6ICdHaXZlbiBzb3VyY2UgZmlsZSBpcyBub3QgaW4geWFtbCBmb3JtYXQuJyxcbiAgVEFSR0VUX0lTX05PVF9ZQU1MOiAnR2l2ZW4gdGFyZ2V0IGZpbGUgaXMgbm90IGluIHlhbWwgZm9ybWF0LicsXG4gIE1BTklGRVNUX05PVF9GT1VORDogJ01hbmlmZXN0IGZpbGUgbm90IGZvdW5kLicsXG4gIFNVQ0NFU1NfTUVTU0FHRTogJ1RoZSBlbnZpcm9ubWVudCBpcyBzdWNjZXNzZnVsbHkgc2V0dXAhJyxcbiAgTUFOSUZFU1RfSVNfTUlTU0lORzogJ01hbmlmZXN0IGlzIG1pc3NpbmcuJyxcbn07XG4iXX0=
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Parses manifest file as an object.
3
+ */
4
+ export declare const load: (inputPath: string) => Promise<{
5
+ rawManifest: any;
6
+ }>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.load = void 0;
4
+ const yaml_1 = require("../util/yaml");
5
+ const config_1 = require("../../if-run/config");
6
+ const { LOADING_MANIFEST } = config_1.STRINGS;
7
+ /**
8
+ * Parses manifest file as an object.
9
+ */
10
+ const load = async (inputPath) => {
11
+ console.debug(LOADING_MANIFEST);
12
+ const rawManifest = await (0, yaml_1.openYamlFileAsObject)(inputPath);
13
+ return {
14
+ rawManifest,
15
+ };
16
+ };
17
+ exports.load = load;
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21tb24vbGliL2xvYWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsdUNBQWtEO0FBRWxELGdEQUE0QztBQUU1QyxNQUFNLEVBQUMsZ0JBQWdCLEVBQUMsR0FBRyxnQkFBTyxDQUFDO0FBRW5DOztHQUVHO0FBQ0ksTUFBTSxJQUFJLEdBQUcsS0FBSyxFQUFFLFNBQWlCLEVBQUUsRUFBRTtJQUM5QyxPQUFPLENBQUMsS0FBSyxDQUFDLGdCQUFnQixDQUFDLENBQUM7SUFFaEMsTUFBTSxXQUFXLEdBQUcsTUFBTSxJQUFBLDJCQUFvQixFQUFNLFNBQVMsQ0FBQyxDQUFDO0lBRS9ELE9BQU87UUFDTCxXQUFXO0tBQ1osQ0FBQztBQUNKLENBQUMsQ0FBQztBQVJXLFFBQUEsSUFBSSxRQVFmIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHtvcGVuWWFtbEZpbGVBc09iamVjdH0gZnJvbSAnLi4vdXRpbC95YW1sJztcblxuaW1wb3J0IHtTVFJJTkdTfSBmcm9tICcuLi8uLi9pZi1ydW4vY29uZmlnJztcblxuY29uc3Qge0xPQURJTkdfTUFOSUZFU1R9ID0gU1RSSU5HUztcblxuLyoqXG4gKiBQYXJzZXMgbWFuaWZlc3QgZmlsZSBhcyBhbiBvYmplY3QuXG4gKi9cbmV4cG9ydCBjb25zdCBsb2FkID0gYXN5bmMgKGlucHV0UGF0aDogc3RyaW5nKSA9PiB7XG4gIGNvbnNvbGUuZGVidWcoTE9BRElOR19NQU5JRkVTVCk7XG5cbiAgY29uc3QgcmF3TWFuaWZlc3QgPSBhd2FpdCBvcGVuWWFtbEZpbGVBc09iamVjdDxhbnk+KGlucHV0UGF0aCk7XG5cbiAgcmV0dXJuIHtcbiAgICByYXdNYW5pZmVzdCxcbiAgfTtcbn07XG4iXX0=
@@ -1,10 +1,13 @@
1
1
  import { z } from 'zod';
2
+ import { AggregationMethodTypes } from '../../if-run/types/aggregation';
2
3
  import { manifestSchema } from '../util/validations';
3
4
  export type Manifest = z.infer<typeof manifestSchema>;
4
5
  export type GlobalPlugins = Manifest['initialize']['plugins'];
5
6
  export type PluginOptions = GlobalPlugins[string];
6
7
  export type AggregationParams = Manifest['aggregation'];
8
+ export type AggregationMetricsWithMethod = {
9
+ [key: string]: AggregationMethodTypes;
10
+ };
7
11
  export type AggregationParamsSure = Extract<Manifest['aggregation'], {}>;
8
12
  export type Context = Omit<Manifest, 'tree'>;
9
13
  export type ContextWithExec = Omit<Manifest, 'tree'>;
10
- export type ManifestParameter = Extract<Manifest['params'], {}>[number];
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFuaWZlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29tbW9uL3R5cGVzL21hbmlmZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQge3p9IGZyb20gJ3pvZCc7XG5cbmltcG9ydCB7QWdncmVnYXRpb25NZXRob2RUeXBlc30gZnJvbSAnLi4vLi4vaWYtcnVuL3R5cGVzL2FnZ3JlZ2F0aW9uJztcblxuaW1wb3J0IHttYW5pZmVzdFNjaGVtYX0gZnJvbSAnLi4vdXRpbC92YWxpZGF0aW9ucyc7XG5cbmV4cG9ydCB0eXBlIE1hbmlmZXN0ID0gei5pbmZlcjx0eXBlb2YgbWFuaWZlc3RTY2hlbWE+O1xuXG5leHBvcnQgdHlwZSBHbG9iYWxQbHVnaW5zID0gTWFuaWZlc3RbJ2luaXRpYWxpemUnXVsncGx1Z2lucyddO1xuXG5leHBvcnQgdHlwZSBQbHVnaW5PcHRpb25zID0gR2xvYmFsUGx1Z2luc1tzdHJpbmddO1xuXG5leHBvcnQgdHlwZSBBZ2dyZWdhdGlvblBhcmFtcyA9IE1hbmlmZXN0WydhZ2dyZWdhdGlvbiddO1xuZXhwb3J0IHR5cGUgQWdncmVnYXRpb25NZXRyaWNzV2l0aE1ldGhvZCA9IHtcbiAgW2tleTogc3RyaW5nXTogQWdncmVnYXRpb25NZXRob2RUeXBlcztcbn07XG5cbmV4cG9ydCB0eXBlIEFnZ3JlZ2F0aW9uUGFyYW1zU3VyZSA9IEV4dHJhY3Q8TWFuaWZlc3RbJ2FnZ3JlZ2F0aW9uJ10sIHt9PjtcblxuZXhwb3J0IHR5cGUgQ29udGV4dCA9IE9taXQ8TWFuaWZlc3QsICd0cmVlJz47XG5cbmV4cG9ydCB0eXBlIENvbnRleHRXaXRoRXhlYyA9IE9taXQ8TWFuaWZlc3QsICd0cmVlJz47XG4iXX0=