@grnsft/if 0.2.1 → 0.3.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 (87) hide show
  1. package/.commitlintrc.js +4 -7
  2. package/README.md +5 -1
  3. package/Refactor-migration-guide.md +342 -0
  4. package/build/{models/export-csv.d.ts → builtins/export-csv-raw.d.ts} +1 -1
  5. package/build/builtins/export-csv-raw.js +129 -0
  6. package/build/builtins/export-csv.d.ts +10 -0
  7. package/build/builtins/export-csv.js +83 -0
  8. package/build/builtins/export-log.js +18 -0
  9. package/build/builtins/export-yaml.js +27 -0
  10. package/build/builtins/group-by.d.ts +5 -0
  11. package/build/builtins/group-by.js +56 -0
  12. package/build/{models → builtins}/index.js +1 -1
  13. package/build/{models → builtins}/time-sync.d.ts +2 -2
  14. package/build/builtins/time-sync.js +304 -0
  15. package/build/config/config.js +2 -2
  16. package/build/config/params.js +56 -1
  17. package/build/config/strings.d.ts +4 -2
  18. package/build/config/strings.js +7 -9
  19. package/build/index.js +3 -1
  20. package/build/lib/aggregate.d.ts +1 -1
  21. package/build/lib/aggregate.js +4 -3
  22. package/build/lib/compute.js +9 -10
  23. package/build/lib/exhaust.js +8 -5
  24. package/build/lib/initialize.d.ts +2 -2
  25. package/build/lib/initialize.js +9 -5
  26. package/build/lib/load.d.ts +33 -2
  27. package/build/lib/load.js +4 -4
  28. package/build/lib/parameterize.d.ts +1 -1
  29. package/build/lib/parameterize.js +6 -4
  30. package/build/types/aggregation.d.ts +0 -1
  31. package/build/types/aggregation.js +1 -1
  32. package/build/types/compute.d.ts +3 -3
  33. package/build/types/compute.js +1 -1
  34. package/build/types/interface.d.ts +14 -1
  35. package/build/types/interface.js +6 -1
  36. package/build/types/manifest.d.ts +9 -40
  37. package/build/types/manifest.js +1 -1
  38. package/build/types/parameters.d.ts +2 -12
  39. package/build/types/parameters.js +1 -1
  40. package/build/types/plugin-storage.d.ts +6 -0
  41. package/build/types/plugin-storage.js +3 -0
  42. package/build/util/aggregation-helper.d.ts +1 -1
  43. package/build/util/aggregation-helper.js +11 -12
  44. package/build/util/errors.d.ts +1 -1
  45. package/build/util/errors.js +2 -2
  46. package/build/util/json.js +25 -5
  47. package/build/util/log-memoize.d.ts +3 -0
  48. package/build/util/log-memoize.js +19 -0
  49. package/build/util/logger.d.ts +1 -1
  50. package/build/util/logger.js +2 -3
  51. package/build/util/plugin-storage.d.ts +14 -0
  52. package/build/util/plugin-storage.js +34 -0
  53. package/build/util/validations.d.ts +144 -11
  54. package/build/util/validations.js +19 -17
  55. package/examples/manifests/asim-demo.yml +74 -0
  56. package/examples/manifests/basic-demo.yml +4 -9
  57. package/examples/manifests/boavizta-cloud.yml +20 -0
  58. package/examples/manifests/cim.yml +3 -3
  59. package/examples/manifests/divide.yml +38 -0
  60. package/examples/manifests/generics.yml +4 -4
  61. package/examples/manifests/group-by.yml +13 -13
  62. package/examples/manifests/mock-observation.yml +2 -2
  63. package/examples/manifests/nesting-demo.yml +2 -2
  64. package/examples/manifests/nesting.yml +16 -16
  65. package/examples/manifests/pipeline-demo-1.yml +4 -4
  66. package/examples/manifests/pipeline-demo-2.yml +9 -9
  67. package/examples/manifests/pipeline-demo.yml +10 -10
  68. package/examples/manifests/pipeline-teads-sci.yml +4 -4
  69. package/examples/manifests/pipeline-with-generics.yml +8 -8
  70. package/examples/manifests/pipeline-with-mocks.yml +10 -10
  71. package/examples/manifests/regex.yml +23 -0
  72. package/package.json +6 -3
  73. package/src/builtins/README.md +852 -0
  74. package/build/models/export-csv.js +0 -129
  75. package/build/models/export-log.js +0 -18
  76. package/build/models/export-yaml.js +0 -24
  77. package/build/models/group-by.d.ts +0 -11
  78. package/build/models/group-by.js +0 -56
  79. package/build/models/time-sync.js +0 -304
  80. package/build/types/initialize.d.ts +0 -4
  81. package/build/types/initialize.js +0 -3
  82. package/build/types/load.d.ts +0 -7
  83. package/build/types/load.js +0 -3
  84. package/src/models/README.md +0 -268
  85. /package/build/{models → builtins}/export-log.d.ts +0 -0
  86. /package/build/{models → builtins}/export-yaml.d.ts +0 -0
  87. /package/build/{models → builtins}/index.d.ts +0 -0
@@ -52,7 +52,7 @@ tree:
52
52
  group-by:
53
53
  group:
54
54
  - region
55
- - instance-type
55
+ - cloud/instance-type
56
56
  defaults:
57
57
  cpu/thermal-design-power: 100
58
58
  grid/carbon-intensity: 800
@@ -64,23 +64,23 @@ tree:
64
64
  functional-unit-time: "1 min"
65
65
  inputs:
66
66
  - timestamp: "2023-12-12T00:00:00.000Z"
67
- instance-type: A1
67
+ cloud/instance-type: A1
68
68
  region: uk-west
69
69
  duration: 1
70
70
  cpu/utilization: 10
71
71
  - timestamp: "2023-12-12T00:00:01.000Z"
72
72
  duration: 5
73
73
  cpu/utilization: 20
74
- instance-type: A1
74
+ cloud/instance-type: A1
75
75
  region: uk-west
76
76
  - timestamp: "2023-12-12T00:00:06.000Z"
77
77
  duration: 7
78
78
  cpu/utilization: 15
79
- instance-type: A1
79
+ cloud/instance-type: A1
80
80
  region: uk-west
81
81
  - timestamp: "2023-12-12T00:00:13.000Z"
82
82
  duration: 30
83
- instance-type: A1
83
+ cloud/instance-type: A1
84
84
  region: uk-west
85
85
  cpu/utilization: 15
86
86
  child-2:
@@ -95,7 +95,7 @@ tree:
95
95
  group-by:
96
96
  group:
97
97
  - region
98
- - instance-type
98
+ - cloud/instance-type
99
99
  defaults:
100
100
  cpu/thermal-design-power: 100
101
101
  grid/carbon-intensity: 800
@@ -109,20 +109,20 @@ tree:
109
109
  - timestamp: "2023-12-12T00:00:00.000Z"
110
110
  duration: 1
111
111
  cpu/utilization: 30
112
- instance-type: A1
112
+ cloud/instance-type: A1
113
113
  region: uk-west
114
114
  - timestamp: "2023-12-12T00:00:01.000Z"
115
115
  duration: 5
116
116
  cpu/utilization: 28
117
- instance-type: A1
117
+ cloud/instance-type: A1
118
118
  region: uk-west
119
119
  - timestamp: "2023-12-12T00:00:06.000Z"
120
120
  duration: 7
121
121
  cpu/utilization: 40
122
- instance-type: A1
122
+ cloud/instance-type: A1
123
123
  region: uk-west
124
124
  - timestamp: "2023-12-12T00:00:13.000Z"
125
125
  duration: 30
126
126
  cpu/utilization: 33
127
- instance-type: A1
127
+ cloud/instance-type: A1
128
128
  region: uk-west
@@ -57,7 +57,7 @@ tree:
57
57
  resources-total: 8
58
58
  inputs:
59
59
  - timestamp: "2023-12-12T00:00:00.000Z"
60
- instance-type: A1
60
+ cloud/instance-type: A1
61
61
  region: uk-west
62
62
  duration: 1
63
63
  cpu/utilization: 50
@@ -65,18 +65,18 @@ tree:
65
65
  - timestamp: "2023-12-12T00:00:01.000Z"
66
66
  duration: 5
67
67
  cpu/utilization: 20
68
- instance-type: A1
68
+ cloud/instance-type: A1
69
69
  region: uk-west
70
70
  network/energy: 0.000001
71
71
  - timestamp: "2023-12-12T00:00:06.000Z"
72
72
  duration: 7
73
73
  cpu/utilization: 15
74
- instance-type: A1
74
+ cloud/instance-type: A1
75
75
  region: uk-west
76
76
  network/energy: 0.000001
77
77
  - timestamp: "2023-12-12T00:00:13.000Z"
78
78
  duration: 30
79
- instance-type: A1
79
+ cloud/instance-type: A1
80
80
  region: uk-west
81
81
  cpu/utilization: 15
82
82
  network/energy: 0.000001
@@ -70,7 +70,7 @@ tree:
70
70
  functional-unit-time: "1 min"
71
71
  inputs:
72
72
  - timestamp: "2023-12-12T00:00:00.000Z"
73
- instance-type: A1
73
+ cloud/instance-type: A1
74
74
  region: uk-west
75
75
  duration: 1
76
76
  cpu/utilization: 50
@@ -79,20 +79,20 @@ tree:
79
79
  - timestamp: "2023-12-12T00:00:01.000Z"
80
80
  duration: 5
81
81
  cpu/utilization: 20
82
- instance-type: A1
82
+ cloud/instance-type: A1
83
83
  region: uk-west
84
84
  network/energy: 10
85
85
  energy: 5
86
86
  - timestamp: "2023-12-12T00:00:06.000Z"
87
87
  duration: 7
88
88
  cpu/utilization: 15
89
- instance-type: A1
89
+ cloud/instance-type: A1
90
90
  region: uk-west
91
91
  network/energy: 10
92
92
  energy: 5
93
93
  - timestamp: "2023-12-12T00:00:13.000Z"
94
94
  duration: 30
95
- instance-type: A1
95
+ cloud/instance-type: A1
96
96
  region: uk-west
97
97
  cpu/utilization: 15
98
98
  network/energy: 10
@@ -120,28 +120,28 @@ tree:
120
120
  - timestamp: "2023-12-12T00:00:00.000Z"
121
121
  duration: 1
122
122
  cpu/utilization: 30
123
- instance-type: A1
123
+ cloud/instance-type: A1
124
124
  region: uk-west
125
125
  network/energy: 10
126
126
  energy: 5
127
127
  - timestamp: "2023-12-12T00:00:01.000Z"
128
128
  duration: 5
129
129
  cpu/utilization: 28
130
- instance-type: A1
130
+ cloud/instance-type: A1
131
131
  region: uk-west
132
132
  network/energy: 10
133
133
  energy: 5
134
134
  - timestamp: "2023-12-12T00:00:06.000Z"
135
135
  duration: 7
136
136
  cpu/utilization: 40
137
- instance-type: A1
137
+ cloud/instance-type: A1
138
138
  region: uk-west
139
139
  network/energy: 10
140
140
  energy: 5
141
141
  - timestamp: "2023-12-12T00:00:13.000Z"
142
142
  duration: 30
143
143
  cpu/utilization: 33
144
- instance-type: A1
144
+ cloud/instance-type: A1
145
145
  region: uk-west
146
146
  network/energy: 10
147
147
  energy: 5
@@ -16,7 +16,7 @@ initialize:
16
16
  timestamp-to: 2023-07-06T00:10
17
17
  duration: 60
18
18
  components:
19
- - instance-type: A1
19
+ - cloud/instance-type: A1
20
20
  generators:
21
21
  common:
22
22
  region: uk-west
@@ -82,23 +82,23 @@ tree:
82
82
  functional-unit-time: "1 min"
83
83
  inputs:
84
84
  - timestamp: "2023-12-12T00:00:00.000Z"
85
- instance-type: A1
85
+ cloud/instance-type: A1
86
86
  region: uk-west
87
87
  duration: 1
88
88
  cpu/utilization: 10
89
89
  - timestamp: "2023-12-12T00:00:01.000Z"
90
90
  duration: 5
91
91
  cpu/utilization: 20
92
- instance-type: A1
92
+ cloud/instance-type: A1
93
93
  region: uk-west
94
94
  - timestamp: "2023-12-12T00:00:06.000Z"
95
95
  duration: 7
96
96
  cpu/utilization: 15
97
- instance-type: A1
97
+ cloud/instance-type: A1
98
98
  region: uk-west
99
99
  - timestamp: "2023-12-12T00:00:13.000Z"
100
100
  duration: 30
101
- instance-type: A1
101
+ cloud/instance-type: A1
102
102
  region: uk-west
103
103
  cpu/utilization: 15
104
104
  child-2:
@@ -113,7 +113,7 @@ tree:
113
113
  group-by:
114
114
  group:
115
115
  - region
116
- - instance-type
116
+ - cloud/instance-type
117
117
  defaults:
118
118
  cpu/thermal-design-power: 100
119
119
  grid/carbon-intensity: 800
@@ -127,20 +127,20 @@ tree:
127
127
  - timestamp: "2023-12-12T00:00:00.000Z"
128
128
  duration: 1
129
129
  cpu/utilization: 30
130
- instance-type: A1
130
+ cloud/instance-type: A1
131
131
  region: uk-west
132
132
  - timestamp: "2023-12-12T00:00:01.000Z"
133
133
  duration: 5
134
134
  cpu/utilization: 28
135
- instance-type: A1
135
+ cloud/instance-type: A1
136
136
  region: uk-west
137
137
  - timestamp: "2023-12-12T00:00:06.000Z"
138
138
  duration: 7
139
139
  cpu/utilization: 40
140
- instance-type: A1
140
+ cloud/instance-type: A1
141
141
  region: uk-west
142
142
  - timestamp: "2023-12-12T00:00:13.000Z"
143
143
  duration: 30
144
144
  cpu/utilization: 33
145
- instance-type: A1
145
+ cloud/instance-type: A1
146
146
  region: uk-west
@@ -0,0 +1,23 @@
1
+ name: regex-demo
2
+ description:
3
+ tags:
4
+ initialize:
5
+ plugins:
6
+ regex:
7
+ method: Regex
8
+ path: "@grnsft/if-plugins"
9
+ global-config:
10
+ parameter: physical-processor
11
+ match: ^(.*),
12
+ output: cpu/name
13
+ tree:
14
+ children:
15
+ child:
16
+ pipeline:
17
+ - regex
18
+ config:
19
+ regex:
20
+ inputs:
21
+ - timestamp: 2023-08-06T00:00
22
+ duration: 3600
23
+ physical-processor: Intel® Xeon® Platinum 8272CL,Intel® Xeon® 8171M 2.1 GHz,Intel® Xeon® E5-2673 v4 2.3 GHz,Intel® Xeon® E5-2673 v3 2.4 GHz
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grnsft/if",
3
3
  "description": "Impact Framework",
4
- "version": "v0.2.1",
4
+ "version": "v0.3.0",
5
5
  "author": {
6
6
  "name": "Green Software Foundation",
7
7
  "email": "info@gsf.com"
@@ -15,6 +15,7 @@
15
15
  "dependencies": {
16
16
  "@commitlint/cli": "^18.6.0",
17
17
  "@commitlint/config-conventional": "^18.6.0",
18
+ "csv-stringify": "^6.4.6",
18
19
  "js-yaml": "^4.1.0",
19
20
  "luxon": "^3.4.4",
20
21
  "ts-command-line-args": "^2.5.1",
@@ -34,6 +35,7 @@
34
35
  "gts": "^5.0.0",
35
36
  "husky": "^8.0.0",
36
37
  "jest": "^29.6.1",
38
+ "rimraf": "^5.0.5",
37
39
  "ts-jest": "^29.1.1"
38
40
  },
39
41
  "engines": {
@@ -58,8 +60,9 @@
58
60
  "url": "https://github.com/Green-Software-Foundation/if"
59
61
  },
60
62
  "scripts": {
61
- "build": "rm -rf build && tsc --project tsconfig.build.json",
62
- "coverage": "jest --verbose --coverage",
63
+ "build": "npm run clean && tsc --project tsconfig.build.json",
64
+ "clean": "rimraf build/",
65
+ "coverage": "jest --verbose --coverage --testPathPattern=src/__tests__/unit",
63
66
  "fix": "gts fix",
64
67
  "fix:package": "fixpack",
65
68
  "ie": "npx ts-node src/index.ts",