@grnsft/if 0.6.0 → 0.7.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 (370) hide show
  1. package/Refactor-migration-guide.md +68 -82
  2. package/github-processes.md +3 -9
  3. package/manifests/examples/builtins/coefficient/failure-invalid-config-input-param.yml +2 -4
  4. package/manifests/examples/builtins/coefficient/failure-output-param-is-null.yaml +1 -3
  5. package/manifests/examples/builtins/coefficient/success.yml +1 -3
  6. package/manifests/examples/builtins/csv-lookup/cloud-metadata/failure-invalid-instance-type.yaml +1 -2
  7. package/manifests/examples/builtins/csv-lookup/cloud-metadata/failure-invalid-vendor.yaml +3 -4
  8. package/manifests/examples/builtins/csv-lookup/cloud-metadata/failure-missing-cloud-vendor.yml +2 -3
  9. package/manifests/examples/builtins/csv-lookup/cloud-metadata/success.yml +1 -2
  10. package/manifests/examples/builtins/csv-lookup/region-metadata/failure-missing-column.yml +1 -1
  11. package/manifests/examples/builtins/csv-lookup/region-metadata/failure-missing-output.yml +2 -2
  12. package/manifests/examples/builtins/csv-lookup/region-metadata/success-renaming.yml +1 -1
  13. package/manifests/examples/builtins/csv-lookup/region-metadata/success.yml +1 -1
  14. package/manifests/examples/builtins/csv-lookup/tdp-finder/failure-missing-input-param.yml +1 -2
  15. package/manifests/examples/builtins/csv-lookup/tdp-finder/failure-unsupported-physical-processor.yml +1 -2
  16. package/manifests/examples/builtins/csv-lookup/tdp-finder/success.yml +1 -2
  17. package/manifests/examples/builtins/divide/failure-invalid-config-denominator.yml +3 -5
  18. package/manifests/examples/builtins/divide/failure-missing-numerator.yml +2 -4
  19. package/manifests/examples/builtins/divide/success.yml +2 -2
  20. package/manifests/examples/builtins/exponent/success.yml +1 -1
  21. package/manifests/examples/builtins/interpolation/success.yml +1 -1
  22. package/manifests/examples/builtins/mock-observations/failure-invalid-config-cpu-range.yml +2 -2
  23. package/manifests/examples/builtins/mock-observations/failure-invalid-memory-utilization-range.yml +1 -1
  24. package/manifests/examples/builtins/mock-observations/failure-missing-timestamp-from-param.yml +1 -1
  25. package/manifests/examples/builtins/mock-observations/success.yml +1 -1
  26. package/manifests/examples/builtins/multiply/failure-input-parameter-is-missing.yml +1 -1
  27. package/manifests/examples/builtins/multiply/success-with-multiple-inputs.yml +1 -1
  28. package/manifests/examples/builtins/multiply/success.yml +1 -1
  29. package/manifests/examples/builtins/regex/failure-missing-input-param.yml +1 -1
  30. package/manifests/examples/builtins/regex/failure-not-matching-with-regex.yml +2 -2
  31. package/manifests/examples/builtins/regex/success.yml +1 -1
  32. package/manifests/examples/builtins/sci/failure-invalid-config-value.yml +3 -4
  33. package/manifests/examples/builtins/sci/failure-missing-input-param.yml +1 -1
  34. package/manifests/examples/builtins/sci/success.yml +1 -1
  35. package/manifests/examples/builtins/sci-embodied/scenario-1.yml +27 -0
  36. package/manifests/examples/builtins/sci-embodied/scenario-2.yml +37 -0
  37. package/manifests/examples/builtins/sci-embodied/success.yml +13 -0
  38. package/manifests/examples/builtins/shell/failure-invalid-command.yml +2 -2
  39. package/manifests/examples/builtins/shell/success.yml +2 -2
  40. package/manifests/examples/builtins/subtract/success.yml +1 -1
  41. package/manifests/examples/builtins/sum/failure-missing-input-param.yml +2 -2
  42. package/manifests/examples/builtins/sum/failure-missing-output-param.yml +2 -2
  43. package/manifests/examples/builtins/sum/success.yml +1 -1
  44. package/manifests/examples/builtins/time-converter/success.yaml +3 -3
  45. package/manifests/examples/builtins/time-sync/failure-config-start-later-end.yml +10 -12
  46. package/manifests/examples/builtins/time-sync/{failure-missing-global-config.yml → failure-missing-config.yml} +3 -8
  47. package/manifests/examples/builtins/time-sync/success.yml +2 -2
  48. package/manifests/examples/features/regroup/failure-missing-cloud-instance-type.yml +1 -1
  49. package/manifests/examples/features/regroup/success.yml +1 -1
  50. package/manifests/examples/pipelines/generics.yml +8 -8
  51. package/manifests/examples/pipelines/instance-metadata.yml +2 -2
  52. package/manifests/examples/pipelines/nesting.yml +75 -33
  53. package/manifests/examples/pipelines/outputs-if-diff/pipeline-with-aggregate.yaml +166 -122
  54. package/manifests/examples/pipelines/outputs-if-diff/pipeline-with-mocks.yaml +130 -70
  55. package/manifests/examples/pipelines/pipeline-teads-sci.yml +15 -15
  56. package/manifests/examples/pipelines/pipeline-with-aggregate.yml +57 -27
  57. package/manifests/examples/pipelines/pipeline-with-mocks.yml +99 -41
  58. package/manifests/examples/pipelines/scenario-3.yml +1 -1
  59. package/manifests/examples/pipelines/scenario-4.yml +5 -5
  60. package/manifests/examples/pipelines/scenario-5.yml +3 -3
  61. package/manifests/examples/pipelines/sci.yml +12 -12
  62. package/manifests/examples/pipelines/teads-curve.yml +10 -10
  63. package/manifests/examples/pipelines/zeros.yml +23 -23
  64. package/manifests/outputs/bugs/aggregation-error-wrong-metric.yaml +40 -40
  65. package/manifests/outputs/bugs/input-error-missing-duration.yaml +1 -1
  66. package/manifests/outputs/bugs/mock-observations-failure-duration-is-zero.yaml +2 -2
  67. package/manifests/outputs/bugs/pipeline-error-naming-mismatch.yaml +1 -1
  68. package/manifests/outputs/bugs/pipeline-error-uninitialized-plugin.yaml +1 -1
  69. package/manifests/outputs/bugs/pipeline-ordering-error.yaml +6 -6
  70. package/manifests/outputs/builtins/coefficient/failure-invalid-config-input-param.yaml +2 -2
  71. package/manifests/outputs/builtins/coefficient/failure-output-param-is-null.yaml +1 -1
  72. package/manifests/outputs/builtins/coefficient/success.yaml +23 -22
  73. package/manifests/outputs/builtins/csv-lookup/cloud-metadata/failure-invalid-instance-type.yaml +1 -1
  74. package/manifests/outputs/builtins/csv-lookup/cloud-metadata/failure-invalid-vendor.yaml +76 -0
  75. package/manifests/outputs/builtins/csv-lookup/cloud-metadata/failure-missing-cloud-vendor.yaml +22 -21
  76. package/manifests/outputs/builtins/csv-lookup/cloud-metadata/success.yaml +1 -1
  77. package/manifests/outputs/builtins/csv-lookup/region-metadata/failure-missing-column.yaml +1 -1
  78. package/manifests/outputs/builtins/csv-lookup/region-metadata/failure-missing-output.yaml +21 -20
  79. package/manifests/outputs/builtins/csv-lookup/region-metadata/success-renaming.yaml +1 -1
  80. package/manifests/outputs/builtins/csv-lookup/region-metadata/success.yaml +1 -1
  81. package/manifests/outputs/builtins/csv-lookup/tdp-finder/failure-missing-input-param.yaml +1 -1
  82. package/manifests/outputs/builtins/csv-lookup/tdp-finder/failure-unsupported-physical-processor.yaml +1 -1
  83. package/manifests/outputs/builtins/csv-lookup/tdp-finder/success.yaml +1 -1
  84. package/manifests/outputs/builtins/divide/failure-invalid-config-denominator.yaml +41 -25
  85. package/manifests/outputs/builtins/divide/failure-missing-numerator.yaml +32 -23
  86. package/manifests/outputs/builtins/divide/success-denominator-equal-zero.yaml +2 -2
  87. package/manifests/outputs/builtins/divide/success.yaml +2 -2
  88. package/manifests/outputs/builtins/exponent/success.yaml +1 -1
  89. package/manifests/outputs/builtins/interpolation/interpolation.yaml +1 -1
  90. package/manifests/outputs/builtins/interpolation/success.yaml +1 -1
  91. package/manifests/outputs/builtins/mock-observations/failure-invalid-config-cpu-range.yaml +3 -3
  92. package/manifests/outputs/builtins/mock-observations/failure-invalid-memory-utilization-range.yaml +2 -2
  93. package/manifests/outputs/builtins/mock-observations/failure-missing-timestamp-from-param.yaml +1 -1
  94. package/manifests/outputs/builtins/mock-observations/success.yaml +49 -190
  95. package/manifests/outputs/builtins/multiply/failure-input-parameter-is-missing.yaml +1 -1
  96. package/manifests/outputs/builtins/multiply/success-with-multiple-inputs.yaml +1 -1
  97. package/manifests/outputs/builtins/multiply/success.yaml +1 -1
  98. package/manifests/outputs/builtins/regex/failure-missing-input-param.yaml +1 -1
  99. package/manifests/outputs/builtins/regex/failure-not-matching-with-regex.yaml +72 -0
  100. package/manifests/outputs/builtins/regex/success.yaml +1 -1
  101. package/manifests/outputs/builtins/sci/failure-invalid-config-value.yaml +22 -23
  102. package/manifests/outputs/builtins/sci/failure-missing-input-param.yaml +1 -1
  103. package/manifests/outputs/builtins/sci/success.yaml +1 -1
  104. package/manifests/outputs/builtins/sci-embodied/failure-invalid-default-emission-value.yaml +22 -26
  105. package/manifests/outputs/builtins/sci-embodied/scenario-1.yaml +100 -0
  106. package/manifests/outputs/builtins/sci-embodied/scenario-2.yaml +101 -0
  107. package/manifests/outputs/builtins/sci-embodied/success.yaml +44 -20
  108. package/manifests/outputs/builtins/shell/failure-invalid-command.yaml +2 -2
  109. package/manifests/outputs/builtins/shell/success.yaml +1 -1
  110. package/manifests/outputs/builtins/subtract/success.yaml +1 -1
  111. package/manifests/outputs/builtins/sum/failure-missing-input-param.yaml +2 -2
  112. package/manifests/outputs/builtins/sum/failure-missing-output-param.yaml +2 -2
  113. package/manifests/outputs/builtins/sum/success.yaml +1 -1
  114. package/manifests/outputs/builtins/time-converter/success.yaml +73 -0
  115. package/manifests/outputs/builtins/time-sync/failure-config-start-later-end.yaml +3 -3
  116. package/manifests/outputs/builtins/time-sync/failure-missing-config.yaml +74 -0
  117. package/manifests/outputs/builtins/time-sync/success.yaml +50 -59
  118. package/manifests/outputs/features/aggregate-failure-invalid-metrics.yaml +1 -1
  119. package/manifests/outputs/features/aggregate-failure-missing-metric-in-inputs.yaml +1 -1
  120. package/manifests/outputs/features/aggregate-horizontal.yaml +4 -2
  121. package/manifests/outputs/features/aggregate-vertical.yaml +4 -2
  122. package/manifests/outputs/features/aggregate.yaml +4 -2
  123. package/manifests/outputs/features/regroup/failure-invalid-regroup.yaml +87 -0
  124. package/manifests/outputs/features/regroup/failure-missing-cloud-instance-type.yaml +87 -0
  125. package/manifests/outputs/pipelines/cloud-metadata-divide.yaml +2 -2
  126. package/manifests/outputs/pipelines/generics.yaml +28 -28
  127. package/manifests/outputs/pipelines/instance-metadata.yaml +14 -14
  128. package/manifests/outputs/pipelines/nesting.yaml +713 -486
  129. package/manifests/outputs/pipelines/pipeline-teads-sci.yaml +63 -32
  130. package/manifests/outputs/pipelines/scenario-4.yaml +105 -0
  131. package/manifests/outputs/pipelines/sci.yaml +56 -32
  132. package/manifests/outputs/pipelines/teads-curve.yaml +18 -18
  133. package/manifests/outputs/pipelines/zeros.yaml +27 -27
  134. package/package.json +4 -4
  135. package/src/__mocks__/mock-manifest.yaml +1 -2
  136. package/src/if-env/config/env-template.yml +1 -2
  137. package/src/if-run/builtins/coefficient/README.md +41 -17
  138. package/src/if-run/builtins/copy-param/README.md +28 -8
  139. package/src/if-run/builtins/csv-lookup/README.md +31 -11
  140. package/src/if-run/builtins/divide/README.md +34 -12
  141. package/src/if-run/builtins/exponent/README.md +29 -11
  142. package/src/if-run/builtins/interpolation/README.md +37 -22
  143. package/src/if-run/builtins/mock-observations/README.md +27 -7
  144. package/src/if-run/builtins/multiply/README.md +27 -9
  145. package/src/if-run/builtins/regex/README.md +31 -11
  146. package/src/if-run/builtins/sci/README.md +29 -8
  147. package/src/if-run/builtins/sci-embodied/README.md +76 -75
  148. package/src/if-run/builtins/shell/README.md +15 -7
  149. package/src/if-run/builtins/subtract/README.md +28 -11
  150. package/src/if-run/builtins/sum/README.md +47 -14
  151. package/src/if-run/builtins/time-converter/README.md +8 -8
  152. package/src/if-run/builtins/time-sync/README.md +44 -22
  153. package/.gitmodules +0 -3
  154. package/build/common/config/index.d.ts +0 -1
  155. package/build/common/config/index.js +0 -6
  156. package/build/common/config/strings.d.ts +0 -9
  157. package/build/common/config/strings.js +0 -17
  158. package/build/common/lib/load.d.ts +0 -6
  159. package/build/common/lib/load.js +0 -18
  160. package/build/common/types/manifest.d.ts +0 -13
  161. package/build/common/types/manifest.js +0 -3
  162. package/build/common/util/debug-logger.d.ts +0 -4
  163. package/build/common/util/debug-logger.js +0 -115
  164. package/build/common/util/fs.d.ts +0 -20
  165. package/build/common/util/fs.js +0 -94
  166. package/build/common/util/helpers.d.ts +0 -15
  167. package/build/common/util/helpers.js +0 -80
  168. package/build/common/util/logger.d.ts +0 -5
  169. package/build/common/util/logger.js +0 -39
  170. package/build/common/util/validations.d.ts +0 -367
  171. package/build/common/util/validations.js +0 -141
  172. package/build/common/util/yaml.d.ts +0 -12
  173. package/build/common/util/yaml.js +0 -59
  174. package/build/if-check/config/config.d.ts +0 -6
  175. package/build/if-check/config/config.js +0 -31
  176. package/build/if-check/config/index.d.ts +0 -2
  177. package/build/if-check/config/index.js +0 -8
  178. package/build/if-check/config/strings.d.ts +0 -11
  179. package/build/if-check/config/strings.js +0 -15
  180. package/build/if-check/index.d.ts +0 -2
  181. package/build/if-check/index.js +0 -98
  182. package/build/if-check/types/process-args.d.ts +0 -4
  183. package/build/if-check/types/process-args.js +0 -3
  184. package/build/if-check/util/args.d.ts +0 -10
  185. package/build/if-check/util/args.js +0 -56
  186. package/build/if-check/util/helpers.d.ts +0 -4
  187. package/build/if-check/util/helpers.js +0 -18
  188. package/build/if-check/util/npm.d.ts +0 -4
  189. package/build/if-check/util/npm.js +0 -59
  190. package/build/if-csv/config/config.d.ts +0 -6
  191. package/build/if-csv/config/config.js +0 -36
  192. package/build/if-csv/config/index.d.ts +0 -2
  193. package/build/if-csv/config/index.js +0 -8
  194. package/build/if-csv/config/strings.d.ts +0 -3
  195. package/build/if-csv/config/strings.js +0 -7
  196. package/build/if-csv/index.d.ts +0 -2
  197. package/build/if-csv/index.js +0 -63
  198. package/build/if-csv/types/csv.d.ts +0 -7
  199. package/build/if-csv/types/csv.js +0 -3
  200. package/build/if-csv/types/process-args.d.ts +0 -5
  201. package/build/if-csv/types/process-args.js +0 -3
  202. package/build/if-csv/util/args.d.ts +0 -12
  203. package/build/if-csv/util/args.js +0 -47
  204. package/build/if-csv/util/helpers.d.ts +0 -9
  205. package/build/if-csv/util/helpers.js +0 -95
  206. package/build/if-diff/config/config.d.ts +0 -6
  207. package/build/if-diff/config/config.js +0 -31
  208. package/build/if-diff/config/index.d.ts +0 -2
  209. package/build/if-diff/config/index.js +0 -8
  210. package/build/if-diff/config/strings.d.ts +0 -6
  211. package/build/if-diff/config/strings.js +0 -10
  212. package/build/if-diff/index.d.ts +0 -2
  213. package/build/if-diff/index.js +0 -46
  214. package/build/if-diff/lib/compare.d.ts +0 -10
  215. package/build/if-diff/lib/compare.js +0 -56
  216. package/build/if-diff/lib/load.d.ts +0 -55
  217. package/build/if-diff/lib/load.js +0 -51
  218. package/build/if-diff/types/args.d.ts +0 -5
  219. package/build/if-diff/types/args.js +0 -3
  220. package/build/if-diff/types/compare.d.ts +0 -7
  221. package/build/if-diff/types/compare.js +0 -3
  222. package/build/if-diff/types/process-args.d.ts +0 -4
  223. package/build/if-diff/types/process-args.js +0 -3
  224. package/build/if-diff/util/args.d.ts +0 -5
  225. package/build/if-diff/util/args.js +0 -51
  226. package/build/if-diff/util/helpers.d.ts +0 -13
  227. package/build/if-diff/util/helpers.js +0 -75
  228. package/build/if-env/config/config.d.ts +0 -6
  229. package/build/if-env/config/config.js +0 -37
  230. package/build/if-env/config/index.d.ts +0 -2
  231. package/build/if-env/config/index.js +0 -8
  232. package/build/if-env/config/strings.d.ts +0 -7
  233. package/build/if-env/config/strings.js +0 -11
  234. package/build/if-env/index.d.ts +0 -2
  235. package/build/if-env/index.js +0 -40
  236. package/build/if-env/types/if-env.d.ts +0 -8
  237. package/build/if-env/types/if-env.js +0 -3
  238. package/build/if-env/types/npm.d.ts +0 -9
  239. package/build/if-env/types/npm.js +0 -3
  240. package/build/if-env/types/process-args.d.ts +0 -5
  241. package/build/if-env/types/process-args.js +0 -3
  242. package/build/if-env/util/args.d.ts +0 -12
  243. package/build/if-env/util/args.js +0 -47
  244. package/build/if-env/util/helpers.d.ts +0 -20
  245. package/build/if-env/util/helpers.js +0 -94
  246. package/build/if-env/util/npm.d.ts +0 -24
  247. package/build/if-env/util/npm.js +0 -126
  248. package/build/if-merge/config/config.d.ts +0 -6
  249. package/build/if-merge/config/config.js +0 -43
  250. package/build/if-merge/config/index.d.ts +0 -2
  251. package/build/if-merge/config/index.js +0 -8
  252. package/build/if-merge/config/strings.d.ts +0 -5
  253. package/build/if-merge/config/strings.js +0 -9
  254. package/build/if-merge/index.d.ts +0 -2
  255. package/build/if-merge/index.js +0 -26
  256. package/build/if-merge/types/process-args.d.ts +0 -6
  257. package/build/if-merge/types/process-args.js +0 -3
  258. package/build/if-merge/util/args.d.ts +0 -9
  259. package/build/if-merge/util/args.js +0 -59
  260. package/build/if-merge/util/helpers.d.ts +0 -5
  261. package/build/if-merge/util/helpers.js +0 -83
  262. package/build/if-run/builtins/coefficient/index.d.ts +0 -2
  263. package/build/if-run/builtins/coefficient/index.js +0 -67
  264. package/build/if-run/builtins/copy-param/index.d.ts +0 -2
  265. package/build/if-run/builtins/copy-param/index.js +0 -70
  266. package/build/if-run/builtins/csv-lookup/index.d.ts +0 -2
  267. package/build/if-run/builtins/csv-lookup/index.js +0 -190
  268. package/build/if-run/builtins/divide/index.d.ts +0 -2
  269. package/build/if-run/builtins/divide/index.js +0 -80
  270. package/build/if-run/builtins/exponent/index.d.ts +0 -2
  271. package/build/if-run/builtins/exponent/index.js +0 -60
  272. package/build/if-run/builtins/export-log.d.ts +0 -4
  273. package/build/if-run/builtins/export-log.js +0 -44
  274. package/build/if-run/builtins/export-yaml.d.ts +0 -4
  275. package/build/if-run/builtins/export-yaml.js +0 -30
  276. package/build/if-run/builtins/index.d.ts +0 -16
  277. package/build/if-run/builtins/index.js +0 -36
  278. package/build/if-run/builtins/interpolation/index.d.ts +0 -2
  279. package/build/if-run/builtins/interpolation/index.js +0 -151
  280. package/build/if-run/builtins/mock-observations/helpers/common-generator.d.ts +0 -3
  281. package/build/if-run/builtins/mock-observations/helpers/common-generator.js +0 -29
  282. package/build/if-run/builtins/mock-observations/helpers/rand-int-generator.d.ts +0 -3
  283. package/build/if-run/builtins/mock-observations/helpers/rand-int-generator.js +0 -48
  284. package/build/if-run/builtins/mock-observations/index.d.ts +0 -2
  285. package/build/if-run/builtins/mock-observations/index.js +0 -116
  286. package/build/if-run/builtins/mock-observations/interfaces/index.d.ts +0 -6
  287. package/build/if-run/builtins/mock-observations/interfaces/index.js +0 -3
  288. package/build/if-run/builtins/multiply/index.d.ts +0 -2
  289. package/build/if-run/builtins/multiply/index.js +0 -59
  290. package/build/if-run/builtins/regex/index.d.ts +0 -2
  291. package/build/if-run/builtins/regex/index.js +0 -76
  292. package/build/if-run/builtins/sci/index.d.ts +0 -2
  293. package/build/if-run/builtins/sci/index.js +0 -92
  294. package/build/if-run/builtins/sci-embodied/index.d.ts +0 -2
  295. package/build/if-run/builtins/sci-embodied/index.js +0 -156
  296. package/build/if-run/builtins/shell/index.d.ts +0 -2
  297. package/build/if-run/builtins/shell/index.js +0 -60
  298. package/build/if-run/builtins/subtract/index.d.ts +0 -2
  299. package/build/if-run/builtins/subtract/index.js +0 -61
  300. package/build/if-run/builtins/sum/index.d.ts +0 -2
  301. package/build/if-run/builtins/sum/index.js +0 -66
  302. package/build/if-run/builtins/time-converter/config.d.ts +0 -1
  303. package/build/if-run/builtins/time-converter/config.js +0 -44
  304. package/build/if-run/builtins/time-converter/index.d.ts +0 -2
  305. package/build/if-run/builtins/time-converter/index.js +0 -79
  306. package/build/if-run/builtins/time-sync/index.d.ts +0 -17
  307. package/build/if-run/builtins/time-sync/index.js +0 -339
  308. package/build/if-run/config/config.d.ts +0 -9
  309. package/build/if-run/config/config.js +0 -73
  310. package/build/if-run/config/index.d.ts +0 -2
  311. package/build/if-run/config/index.js +0 -8
  312. package/build/if-run/config/strings.d.ts +0 -64
  313. package/build/if-run/config/strings.js +0 -76
  314. package/build/if-run/index.d.ts +0 -2
  315. package/build/if-run/index.js +0 -63
  316. package/build/if-run/lib/aggregate.d.ts +0 -15
  317. package/build/if-run/lib/aggregate.js +0 -123
  318. package/build/if-run/lib/compute.d.ts +0 -5
  319. package/build/if-run/lib/compute.js +0 -142
  320. package/build/if-run/lib/environment.d.ts +0 -5
  321. package/build/if-run/lib/environment.js +0 -75
  322. package/build/if-run/lib/exhaust.d.ts +0 -7
  323. package/build/if-run/lib/exhaust.js +0 -27
  324. package/build/if-run/lib/explain.d.ts +0 -9
  325. package/build/if-run/lib/explain.js +0 -43
  326. package/build/if-run/lib/initialize.d.ts +0 -6
  327. package/build/if-run/lib/initialize.js +0 -109
  328. package/build/if-run/lib/regroup.d.ts +0 -5
  329. package/build/if-run/lib/regroup.js +0 -64
  330. package/build/if-run/types/aggregation.d.ts +0 -5
  331. package/build/if-run/types/aggregation.js +0 -6
  332. package/build/if-run/types/compute.d.ts +0 -29
  333. package/build/if-run/types/compute.js +0 -3
  334. package/build/if-run/types/environment.d.ts +0 -18
  335. package/build/if-run/types/environment.js +0 -3
  336. package/build/if-run/types/exhaust-plugin-interface.d.ts +0 -7
  337. package/build/if-run/types/exhaust-plugin-interface.js +0 -3
  338. package/build/if-run/types/explain.d.ts +0 -10
  339. package/build/if-run/types/explain.js +0 -3
  340. package/build/if-run/types/interface.d.ts +0 -3
  341. package/build/if-run/types/interface.js +0 -6
  342. package/build/if-run/types/plugin-storage.d.ts +0 -6
  343. package/build/if-run/types/plugin-storage.js +0 -3
  344. package/build/if-run/types/process-args.d.ts +0 -25
  345. package/build/if-run/types/process-args.js +0 -3
  346. package/build/if-run/types/time-sync.d.ts +0 -17
  347. package/build/if-run/types/time-sync.js +0 -3
  348. package/build/if-run/util/aggregation-helper.d.ts +0 -7
  349. package/build/if-run/util/aggregation-helper.js +0 -47
  350. package/build/if-run/util/args.d.ts +0 -9
  351. package/build/if-run/util/args.js +0 -60
  352. package/build/if-run/util/helpers.d.ts +0 -14
  353. package/build/if-run/util/helpers.js +0 -57
  354. package/build/if-run/util/log-memoize.d.ts +0 -3
  355. package/build/if-run/util/log-memoize.js +0 -19
  356. package/build/if-run/util/os-checker.d.ts +0 -7
  357. package/build/if-run/util/os-checker.js +0 -97
  358. package/build/if-run/util/plugin-storage.d.ts +0 -14
  359. package/build/if-run/util/plugin-storage.js +0 -34
  360. package/grafana/IF_GRAFANA_SETUP.md +0 -71
  361. package/grafana/if_grafana_config.json +0 -370
  362. package/manifests/examples/builtins/divide/failure-denominator-equal-zero.yml +0 -38
  363. package/manifests/examples/builtins/interpolation/interpolation.yml +0 -24
  364. package/manifests/examples/builtins/sci-embodied/failure-invalid-default-emission-value.yml +0 -23
  365. package/manifests/examples/builtins/sci-embodied/failure-missing-expected-lifespan.yml +0 -23
  366. package/manifests/examples/pipelines/scenario-1.yml +0 -34
  367. package/manifests/examples/pipelines/scenario-2.yml +0 -52
  368. package/manifests/outputs/bugs/sci-embodied-missing-resources-total.yaml +0 -72
  369. package/manifests/outputs/builtins/sci-embodied/failure-missing-expected-lifespan.yaml +0 -69
  370. package/manifests/outputs/pipelines/mock-obs-time-sync.yaml +0 -449
@@ -8,7 +8,7 @@ initialize:
8
8
  sum-zero-and-one:
9
9
  path: builtin
10
10
  method: Sum
11
- global-config:
11
+ config:
12
12
  input-parameters:
13
13
  - some-value
14
14
  - zero-value
@@ -16,7 +16,7 @@ initialize:
16
16
  sum-zero-and-zero:
17
17
  path: builtin
18
18
  method: Sum
19
- global-config:
19
+ config:
20
20
  input-parameters:
21
21
  - zero-value
22
22
  - zero-value
@@ -24,7 +24,7 @@ initialize:
24
24
  subtract-one-and-zero:
25
25
  path: builtin
26
26
  method: Subtract
27
- global-config:
27
+ config:
28
28
  input-parameters:
29
29
  - some-value
30
30
  - zero-value
@@ -32,7 +32,7 @@ initialize:
32
32
  subtract-zero-and-zero:
33
33
  path: builtin
34
34
  method: Sum
35
- global-config:
35
+ config:
36
36
  input-parameters:
37
37
  - zero-value
38
38
  - zero-value
@@ -40,7 +40,7 @@ initialize:
40
40
  subtract-zero-and-one:
41
41
  path: builtin
42
42
  method: Subtract
43
- global-config:
43
+ config:
44
44
  input-parameters:
45
45
  - zero-value
46
46
  - some-value
@@ -48,28 +48,28 @@ initialize:
48
48
  coefficient-one-times-zero:
49
49
  path: builtin
50
50
  method: Coefficient
51
- global-config:
51
+ config:
52
52
  input-parameter: zero-value
53
53
  coefficient: 1
54
54
  output-parameter: zero-times-one-coefficient
55
55
  coefficient-zero-times-one:
56
56
  path: builtin
57
57
  method: Coefficient
58
- global-config:
58
+ config:
59
59
  input-parameter: some-value
60
60
  coefficient: 0
61
61
  output-parameter: one-times-zero-coefficient
62
62
  coefficient-zero-times-zero:
63
63
  path: builtin
64
64
  method: Coefficient
65
- global-config:
65
+ config:
66
66
  input-parameter: zero-value
67
67
  coefficient: 0
68
68
  output-parameter: zero-times-zero-coefficient
69
69
  multiply-one-times-zero:
70
70
  path: builtin
71
71
  method: Multiply
72
- global-config:
72
+ config:
73
73
  input-parameters:
74
74
  - some-value
75
75
  - zero-value
@@ -77,7 +77,7 @@ initialize:
77
77
  multiply-zero-times-one:
78
78
  path: builtin
79
79
  method: Multiply
80
- global-config:
80
+ config:
81
81
  input-parameters:
82
82
  - zero-value
83
83
  - zero-value
@@ -85,28 +85,28 @@ initialize:
85
85
  exponent-one-to-zero:
86
86
  path: builtin
87
87
  method: Exponent
88
- global-config:
88
+ config:
89
89
  input-parameter: some-value
90
90
  exponent: 0
91
91
  output-parameter: one-raised-to-zero-power
92
92
  exponent-zero-to-zero:
93
93
  path: builtin
94
94
  method: Exponent
95
- global-config:
95
+ config:
96
96
  input-parameter: zero-value
97
97
  exponent: 0
98
98
  output-parameter: zero-raised-to-zero-power
99
99
  exponent-zero-to-one:
100
100
  path: builtin
101
101
  method: Exponent
102
- global-config:
102
+ config:
103
103
  input-parameter: zero-value
104
104
  exponent: 1
105
105
  output-parameter: zero-raised-to-first-power
106
106
  sci:
107
107
  path: builtin
108
108
  method: Sci
109
- global-config:
109
+ config:
110
110
  functional-unit: zero-value
111
111
  execution:
112
112
  command: >-
@@ -116,20 +116,20 @@ execution:
116
116
  environment:
117
117
  if-version: 0.5.0
118
118
  os: macOS
119
- os-version: '14.5'
119
+ os-version: "14.5"
120
120
  node-version: 18.14.2
121
121
  date-time: 2024-07-19T06:36:00.790Z (UTC)
122
122
  dependencies:
123
- - '@babel/core@7.22.10'
124
- - '@babel/preset-typescript@7.23.3'
125
- - '@commitlint/cli@18.6.0'
126
- - '@commitlint/config-conventional@18.6.0'
127
- - '@grnsft/if-core@0.0.10'
128
- - '@jest/globals@29.7.0'
129
- - '@types/jest@29.5.8'
130
- - '@types/js-yaml@4.0.9'
131
- - '@types/luxon@3.4.2'
132
- - '@types/node@20.9.0'
123
+ - "@babel/core@7.22.10"
124
+ - "@babel/preset-typescript@7.23.3"
125
+ - "@commitlint/cli@18.6.0"
126
+ - "@commitlint/config-conventional@18.6.0"
127
+ - "@grnsft/if-core@0.0.10"
128
+ - "@jest/globals@29.7.0"
129
+ - "@types/jest@29.5.8"
130
+ - "@types/js-yaml@4.0.9"
131
+ - "@types/luxon@3.4.2"
132
+ - "@types/node@20.9.0"
133
133
  - axios-mock-adapter@1.22.0
134
134
  - axios@1.7.2
135
135
  - cross-env@7.0.3
@@ -171,13 +171,13 @@ tree:
171
171
  - exponent-zero-to-zero
172
172
  - sci
173
173
  inputs:
174
- - timestamp: '2023-12-12T00:00:00.000Z'
174
+ - timestamp: "2023-12-12T00:00:00.000Z"
175
175
  duration: 1
176
176
  some-value: 1
177
177
  zero-value: 0
178
178
  carbon: 10
179
179
  outputs:
180
- - timestamp: '2023-12-12T00:00:00.000Z'
180
+ - timestamp: "2023-12-12T00:00:00.000Z"
181
181
  duration: 1
182
182
  some-value: 1
183
183
  zero-value: 0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grnsft/if",
3
3
  "description": "Impact Framework",
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "author": {
6
6
  "name": "Green Software Foundation",
7
7
  "email": "info@gsf.com"
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@commitlint/cli": "^18.6.0",
22
22
  "@commitlint/config-conventional": "^18.6.0",
23
- "@grnsft/if-core": "^0.0.16",
23
+ "@grnsft/if-core": "^0.0.25",
24
24
  "axios": "^1.7.2",
25
25
  "csv-parse": "^5.5.6",
26
26
  "csv-stringify": "^6.4.6",
@@ -58,11 +58,12 @@
58
58
  "homepage": "https://greensoftware.foundation",
59
59
  "keywords": [
60
60
  "engine",
61
+ "framework",
61
62
  "green software foundation",
62
63
  "greensoftware",
63
64
  "if",
64
65
  "impact",
65
- "models"
66
+ "plugins"
66
67
  ],
67
68
  "license": "MIT",
68
69
  "publishConfig": {
@@ -86,7 +87,6 @@
86
87
  "lint": "gts lint",
87
88
  "pre-commit": "lint-staged",
88
89
  "prepare": "husky install",
89
- "prepublish": "npm run build",
90
90
  "release": "release-it",
91
91
  "test": "jest --verbose --testPathPattern=src/__tests__/"
92
92
  },
@@ -6,7 +6,7 @@ initialize:
6
6
  memory-energy-from-memory-util:
7
7
  path: builtin
8
8
  method: Coefficient
9
- global-config:
9
+ config:
10
10
  input-parameter: memory/utilization
11
11
  coefficient: 0.0001
12
12
  output-parameter: memory/energy
@@ -59,7 +59,6 @@ tree:
59
59
  pipeline:
60
60
  compute:
61
61
  - memory-energy-from-memory-util
62
- config: null
63
62
  inputs:
64
63
  - timestamp: 2023-12-12T00:00:00.000Z
65
64
  duration: 3600
@@ -6,7 +6,7 @@ initialize:
6
6
  memory-energy-from-memory-util: # you can name this any way you like!
7
7
  method: Coefficient # the name of the function exported from the plugin
8
8
  path: "builtin" # the import path
9
- global-config: # anmy config required by the plugin
9
+ config: # any config required by the plugin
10
10
  input-parameter: "memory/utilization"
11
11
  coefficient: 0.0001 #kwH/GB
12
12
  output-parameter: "memory/energy"
@@ -16,7 +16,6 @@ tree:
16
16
  pipeline: # the pipeline is an ordered list of plugins you want to execute
17
17
  compute:
18
18
  - memory-energy-from-memory-util # must match the name in initialize!
19
- config: # any plugin specific, node-level config
20
19
  inputs:
21
20
  - timestamp: 2023-12-12T00:00:00.000Z # ISO 8061 string
22
21
  duration: 3600 # units of seconds
@@ -8,9 +8,9 @@ For example, you could multiply `cpu/energy` by 10 and name the result `energy-p
8
8
 
9
9
  ## Parameters
10
10
 
11
- ### Plugin global config
11
+ ### Plugin config
12
12
 
13
- Three parameters are required in global config: `input-parameter`, `coefficient` and `output-parameter`.
13
+ Three parameters are required in config: `input-parameter`, `coefficient` and `output-parameter`.
14
14
 
15
15
  - `input-parameter`: a string matching an existing key in the `inputs` array
16
16
  - `coefficient`: the value to multiply `input-parameter` by.
@@ -21,16 +21,32 @@ Three parameters are required in global config: `input-parameter`, `coefficient`
21
21
  The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method`
22
22
  of the parameters of the inputs and outputs
23
23
 
24
- - `inputs`: describe parameters of the `input-parameter` of the global config. Each parameter has:
24
+ - `inputs`: describe parameters of the `input-parameter` of the config. Each parameter has:
25
25
 
26
26
  - `description`: description of the parameter
27
27
  - `unit`: unit of the parameter
28
- - `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
28
+ - `aggregation-method`: aggregation method object of the parameter
29
+ - `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
30
+ - `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
29
31
 
30
- - `outputs`: describe parameters of the `output-parameter` of the global config. Each parameter has:
32
+ - `outputs`: describe parameters of the `output-parameter` of the config. Each parameter has:
31
33
  - `description`: description of the parameter
32
34
  - `unit`: unit of the parameter
33
- - `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
35
+ - `aggregation-method`: aggregation method object of the parameter
36
+ - `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
37
+ - `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
38
+
39
+ ### Mapping
40
+
41
+ The `mapping` block is an optional block. It is added in the plugin section and allows the plugin to receive a parameter from the input with a different name than the one the plugin uses for data manipulation. The parameter with the mapped name will not appear in the outputs. It also maps the output parameter of the plugin. The structure of the `mapping` block is:
42
+
43
+ ```yaml
44
+ coefficient:
45
+ method: Coefficient
46
+ path: 'builtin'
47
+ mapping:
48
+ 'parameter-name-in-the-plugin': 'parameter-name-in-the-input'
49
+ ```
34
50
 
35
51
  ### Inputs
36
52
 
@@ -38,7 +54,7 @@ All of `input-parameters` must be available in the input array.
38
54
 
39
55
  ## Returns
40
56
 
41
- - `output-parameter`: the product of all `input-parameters` with the parameter name defined by `output-parameter` in global config.
57
+ - `output-parameter`: the product of all `input-parameters` with the parameter name defined by `output-parameter` in config.
42
58
 
43
59
  ## Calculation
44
60
 
@@ -56,9 +72,11 @@ const config = {
56
72
  coefficient: 10,
57
73
  'output-parameter': 'carbon-product',
58
74
  };
75
+ const parametersMetadata = {inputs: {}, outputs: {}};
76
+ const mapping = {};
59
77
 
60
- const coeff = Coefficient(config);
61
- const result = coeff.execute([
78
+ const coeff = Coefficient(config, parametersMetadata, mapping);
79
+ const result = await coeff.execute([
62
80
  {
63
81
  duration: 3600,
64
82
  timestamp: '2021-01-01T00:00:00Z',
@@ -80,19 +98,25 @@ initialize:
80
98
  coefficient:
81
99
  method: Coefficient
82
100
  path: 'builtin'
83
- global-config:
101
+ config:
84
102
  input-parameter: 'carbon'
85
103
  coefficient: 3
86
104
  output-parameter: 'carbon-product'
87
- parameter-metadata:
105
+ parameter-metadata:
88
106
  inputs:
89
107
  carbon:
90
- description: "an amount of carbon emitted into the atmosphere"
91
- unit: "gCO2e"
108
+ description: 'an amount of carbon emitted into the atmosphere'
109
+ unit: 'gCO2e'
110
+ aggregation-method:
111
+ time: sum
112
+ component: sum
92
113
  outputs:
93
114
  carbon-product:
94
- description: "a product of cabon property and the coefficient"
95
- unit: "gCO2e"
115
+ description: 'a product of cabon property and the coefficient'
116
+ unit: 'gCO2e'
117
+ aggregation-method:
118
+ time: sum
119
+ component: sum
96
120
  tree:
97
121
  children:
98
122
  child:
@@ -117,9 +141,9 @@ The results will be saved to a new `yaml` file in `./examples/outputs`
117
141
 
118
142
  `Coefficient` exposes one of the IF error classes.
119
143
 
120
- ### GlobalConfigError
144
+ ### ConfigError
121
145
 
122
- You will receive an error starting `GlobalConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
146
+ You will receive an error starting `ConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
123
147
 
124
148
  The required parameters are:
125
149
 
@@ -43,16 +43,32 @@ Three parameters are required in config: `from` and `to` and `keep-existing`.
43
43
 
44
44
  The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
45
45
 
46
- - `inputs`: describe the parameter of the `from` of the global config. The parameter has the following attributes:
46
+ - `inputs`: describe the parameter of the `from` of the config. The parameter has the following attributes:
47
47
 
48
48
  - `description`: description of the parameter
49
49
  - `unit`: unit of the parameter
50
- - `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
50
+ - `aggregation-method`: aggregation method object of the parameter
51
+ - `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
52
+ - `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
51
53
 
52
- - `outputs`: describe the parameters of the `to` of the global config. The parameter has the following attributes:
54
+ - `outputs`: describe the parameters of the `to` of the config. The parameter has the following attributes:
53
55
  - `description`: description of the parameter
54
56
  - `unit`: unit of the parameter
55
- - `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
57
+ - `aggregation-method`: aggregation method object of the parameter
58
+ - `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
59
+ - `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
60
+
61
+ ### Mapping
62
+
63
+ The `mapping` block is an optional block. It is added in the plugin section and allows the plugin to receive a parameter from the input with a different name than the one the plugin uses for data manipulation. The parameter with the mapped name will not appear in the outputs. It also maps the output parameter of the plugin. The structure of the `mapping` block is:
64
+
65
+ ```yaml
66
+ copy-param:
67
+ path: builtin
68
+ method: Copy
69
+ mapping:
70
+ 'parameter-name-in-the-plugin': 'parameter-name-in-the-input'
71
+ ```
56
72
 
57
73
  ### Inputs
58
74
 
@@ -69,13 +85,17 @@ To run the plugin, you must first create an instance of `Copy`. Then, you can ca
69
85
  ```typescript
70
86
  import {Copy} from '.';
71
87
 
72
- const plugin = Copy({
88
+ const config = {
73
89
  'keep-existing': true,
74
90
  from: 'from-param',
75
91
  to: 'to-param',
76
- });
92
+ };
93
+ const parametersMetadata = {inputs: {}, outputs: {}};
94
+ const mapping = {};
95
+
96
+ const plugin = Copy(config, parametersMetadata, mapping);
77
97
 
78
- const result = plugin.execute([
98
+ const result = await plugin.execute([
79
99
  {
80
100
  timestamp: '2023-12-12T00:00:13.000Z',
81
101
  duration: 30,
@@ -99,7 +119,7 @@ initialize:
99
119
  copy-param:
100
120
  path: builtin
101
121
  method: Copy
102
- global-config:
122
+ config:
103
123
  keep-existing: true
104
124
  from: original
105
125
  to: copy
@@ -61,12 +61,28 @@ The `parameter-metadata` section contains information about `description`, `unit
61
61
 
62
62
  - `description`: description of the parameter
63
63
  - `unit`: unit of the parameter
64
- - `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
64
+ - `aggregation-method`: aggregation method object of the parameter
65
+ - `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
66
+ - `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
65
67
 
66
68
  - `outputs`: describe the parameters in the `output` of the config block. The parameter has the following attributes:
67
69
  - `description`: description of the parameter
68
70
  - `unit`: unit of the parameter
69
- - `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
71
+ - `aggregation-method`: aggregation method object of the parameter
72
+ - `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
73
+ - `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
74
+
75
+ ### Mapping
76
+
77
+ The `mapping` block is an optional block. It is added in the plugin section and allows the plugin to receive a parameter from the input with a different name than the one the plugin uses for data manipulation. The parameter with the mapped name will not appear in the outputs. It also maps the output parameter of the plugin. The structure of the `mapping` block is:
78
+
79
+ ```yaml
80
+ cloud-metadata:
81
+ method: CSVLookup
82
+ path: 'builtin'
83
+ mapping:
84
+ 'parameter-name-in-the-plugin': 'parameter-name-in-the-input'
85
+ ```
70
86
 
71
87
  ### Inputs
72
88
 
@@ -78,7 +94,7 @@ The input data with the requested csv content appended to it.
78
94
 
79
95
  ## Plugin logic
80
96
 
81
- 1. Validates global config which contains `filepath`, `query` and `output`.
97
+ 1. Validates config which contains `filepath`, `query` and `output`.
82
98
  2. Tries to retrieve given file (with url or local path).
83
99
  3. Parses given CSV.
84
100
  4. Filters requested information from CSV.
@@ -90,7 +106,7 @@ The input data with the requested csv content appended to it.
90
106
  To run the plugin, you must first create an instance of `CSVLookup`. Then, you can call `execute()`.
91
107
 
92
108
  ```typescript
93
- const globalConfig = {
109
+ const config = {
94
110
  filepath: 'https://raw.githubusercontent.com/Green-Software-Foundation/if-data/main/cloud-metdata-aws-instances.csv',
95
111
  query: {
96
112
  'cloud-provider': 'cloud/provider'
@@ -99,9 +115,11 @@ const globalConfig = {
99
115
  },
100
116
  output: ['cpu-tdp', 'tdp'],
101
117
  };
102
- const csvLookup = CSVLookup(globalConfig);
118
+ const parametersMetadata = {inputs: {}, outputs: {}};
119
+ const mapping = {};
120
+ const csvLookup = CSVLookup(config, parametersMetadata, mapping);
103
121
 
104
- const input = [
122
+ const result = await csvLookup.execute([
105
123
  {
106
124
  timestamp: '2023-08-06T00:00'
107
125
  duration: 3600
@@ -109,7 +127,7 @@ const input = [
109
127
  'cloud/provider': gcp
110
128
  'cloud/region': asia-east
111
129
  },
112
- ];
130
+ ]);
113
131
  ```
114
132
 
115
133
  ## Example manifest
@@ -125,12 +143,14 @@ initialize:
125
143
  cloud-metadata:
126
144
  method: CSVLookup
127
145
  path: 'builtin'
128
- global-config:
146
+ config:
129
147
  filepath: https://raw.githubusercontent.com/Green-Software-Foundation/if-data/main/region-metadata.csv
130
148
  query:
131
149
  cloud-provider: 'cloud/provider'
132
150
  cloud-region: 'cloud/region'
133
151
  output: '*'
152
+ mapping:
153
+ cloud/region: cloud/area
134
154
  tree:
135
155
  children:
136
156
  child:
@@ -141,7 +161,7 @@ tree:
141
161
  - timestamp: 2023-08-06T00:00
142
162
  duration: 3600
143
163
  cloud/provider: Google Cloud
144
- cloud/region: europe-north1
164
+ cloud/area: europe-north1
145
165
  ```
146
166
 
147
167
  You can run this example by saving it as `./examples/manifests/csv-lookup.yml` and executing the following command from the project root:
@@ -177,9 +197,9 @@ This error is caused by the `CsvLookup` plugin failing to find data that matches
177
197
 
178
198
  This error arises due to problems parsing CSV data into IF. This can occur when the CSV data is incorrectly formatted or contains unexpected characters that IF does not recognize. These errors are expected to be unusual edge cases as incorrectly formatted data will usually be identified during file loading and cause a `ReadFileError`. To debug, check your CSV file for any unexpected formatting or unusual characters.
179
199
 
180
- ### GlobalConfigError
200
+ ### ConfigError
181
201
 
182
- You will receive an error starting `GlobalConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
202
+ You will receive an error starting `ConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
183
203
 
184
204
  The required parameters are:
185
205
 
@@ -16,16 +16,32 @@ You provide the names of the values you want to divide, and a name to use to add
16
16
 
17
17
  The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
18
18
 
19
- - `inputs`: describe the parameter of the `numerator` of the global config. The parameter has the following attributes:
19
+ - `inputs`: describe the parameter of the `numerator` of the config. The parameter has the following attributes:
20
20
 
21
21
  - `description`: description of the parameter
22
22
  - `unit`: unit of the parameter
23
- - `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
23
+ - `aggregation-method`: aggregation method object of the parameter
24
+ - `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
25
+ - `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
24
26
 
25
27
  - `outputs`: describe the parameter of the `denominator` of the global config. The parameter has the following attributes:
26
28
  - `description`: description of the parameter
27
29
  - `unit`: unit of the parameter
28
- - `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
30
+ - `aggregation-method`: aggregation method object of the parameter
31
+ - `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
32
+ - `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
33
+
34
+ ### Mapping
35
+
36
+ The `mapping` block is an optional block. It is added in the plugin section and allows the plugin to receive a parameter from the input with a different name than the one the plugin uses for data manipulation. The parameter with the mapped name will not appear in the outputs. It also maps the output parameter of the plugin. The structure of the `mapping` block is:
37
+
38
+ ```yaml
39
+ divide:
40
+ method: Divide
41
+ path: 'builtin'
42
+ mapping:
43
+ 'parameter-name-in-the-plugin': 'parameter-name-in-the-input'
44
+ ```
29
45
 
30
46
  ### Inputs
31
47
 
@@ -35,7 +51,7 @@ The `parameter-metadata` section contains information about `description`, `unit
35
51
 
36
52
  ## Returns
37
53
 
38
- - `output`: the division of `numerator` with the parameter name into `denominator` with the parameter name defined by `output` in global config.
54
+ - `output`: the division of `numerator` with the parameter name into `denominator` with the parameter name defined by `output` in config.
39
55
 
40
56
  The plugin throws an exception if the division result is not a number.
41
57
 
@@ -52,20 +68,24 @@ output = input0 / input1
52
68
  To run the plugin, you must first create an instance of `Divide`. Then, you can call `execute()`.
53
69
 
54
70
  ```typescript
55
- const globalConfig = {
71
+ const config = {
56
72
  numerator: 'vcpus-allocated',
57
73
  denominator: 2,
58
74
  output: 'cpu/number-cores',
59
75
  };
60
- const divide = Divide(globalConfig, parametersMetadata);
76
+ const parametersMetadata = {inputs: {}, outputs: {}};
77
+ const mapping = {
78
+ 'vcpus-allocated': 'vcpus-distributed',
79
+ };
80
+ const divide = Divide(config, parametersMetadata, mapping);
61
81
 
62
- const input = [
82
+ const result = await divide.execute([
63
83
  {
64
84
  timestamp: '2021-01-01T00:00:00Z',
65
85
  duration: 3600,
66
86
  'vcpus-allocated': 24,
67
87
  },
68
- ];
88
+ ]);
69
89
  ```
70
90
 
71
91
  ## Example manifest
@@ -81,10 +101,12 @@ initialize:
81
101
  divide:
82
102
  method: Divide
83
103
  path: 'builtin'
84
- global-config:
104
+ config:
85
105
  numerator: vcpus-allocated
86
106
  denominator: 2
87
107
  output: cpu/number-cores
108
+ mapping:
109
+ vcpus-allocated: vcpus-distributed
88
110
  tree:
89
111
  children:
90
112
  child:
@@ -94,7 +116,7 @@ tree:
94
116
  inputs:
95
117
  - timestamp: 2023-08-06T00:00
96
118
  duration: 3600
97
- vcpus-allocated: 24
119
+ vcpus-distributed: 24
98
120
  ```
99
121
 
100
122
  You can run this example by saving it as `./examples/manifests/divide.yml` and executing the following command from the project root:
@@ -110,9 +132,9 @@ The results will be saved to a new `yaml` file in `./examples/outputs`.
110
132
 
111
133
  `Divide` exposes two of IF's error classes.
112
134
 
113
- ### GlobalConfigError
135
+ ### ConfigError
114
136
 
115
- You will receive an error starting `GlobalConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
137
+ You will receive an error starting `ConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
116
138
 
117
139
  The required parameters are:
118
140