|
55 | 55 | * @property {TraceResultVariables} variables - The variables used to calculate the CO2 estimate
|
56 | 56 | *
|
57 | 57 | * @typedef CO2EstimateTraceResultPerVisit
|
58 |
| - * @property {number | AdjustedCO2ByComponentWithTotal} co2 - The CO2 estimate in grams/kilowatt-hour |
| 58 | + * @property {number | CO2ByComponentAndVisitWithTotal} co2 - The CO2 estimate in grams/kilowatt-hour |
59 | 59 | * @property {boolean} green - Whether the domain is green or not
|
60 | 60 | * @property {TraceResultVariables} variables - The variables used to calculate the CO2 estimate
|
61 | 61 | *
|
|
81 | 81 | * @property {number} productionEnergy
|
82 | 82 | * @property {number} dataCenterEnergy
|
83 | 83 | *
|
84 |
| - * @typedef {Object} AdjustedEnergyByComponent |
85 |
| - * @type {{ |
86 |
| - * [K in keyof EnergyByComponent as `${K} - first`]: EnergyByComponent[K] |
87 |
| - * } & { |
88 |
| - * [K in keyof EnergyByComponent as `${K} - subsequest`]: EnergyByComponent[K] |
89 |
| - * }} |
| 84 | + * @typedef EnergyByComponentAndVisit |
| 85 | + * @type {SegmentedByVisit<EnergyByComponent>} |
90 | 86 | *
|
91 | 87 | * @typedef CO2ByComponent
|
92 | 88 | * @property {number} consumerDeviceCO2
|
93 | 89 | * @property {number} networkCO2
|
94 | 90 | * @property {number} productionCO2
|
95 | 91 | * @property {number} dataCenterCO2
|
96 | 92 | *
|
97 |
| - * @typedef {Object} AdjustedCO2ByComponent |
98 |
| - * @type {{ |
99 |
| - * [K in keyof CO2ByComponent as `${K} - first`]: CO2ByComponent[K] |
100 |
| - * } & { |
101 |
| - * [K in keyof CO2ByComponent as `${K} - subsequest`]: CO2ByComponent[K] |
102 |
| - * }} |
| 93 | + * @typedef CO2ByComponentAndVisit |
| 94 | + * @type {SegmentedByVisit<CO2ByComponent>} |
103 | 95 | *
|
104 | 96 | * @typedef CO2ByComponentWithTotal
|
105 | 97 | * @property {number} consumerDeviceCO2
|
|
108 | 100 | * @property {number} dataCenterCO2
|
109 | 101 | * @property {number} total
|
110 | 102 | *
|
111 |
| - * @typedef {Object} AdjustedCO2ByComponentWithTotal |
112 |
| - * @type {AdjustedCO2ByComponent & { total: number }} |
| 103 | + * @typedef CO2ByComponentAndVisitWithTotal |
| 104 | + * @type {CO2ByComponentAndVisit & { total: number }} |
113 | 105 | *
|
114 | 106 | * @typedef PageXRayDomain
|
115 | 107 | * @property {number} transferSize
|
|
146 | 138 | * @typedef MultiDomainCheckResponse
|
147 | 139 | * @type {Record<string, PerDomainCheckResponse>}
|
148 | 140 | */
|
| 141 | + |
| 142 | +/** |
| 143 | + * @template {Record<string, unknown>} Object |
| 144 | + * @typedef {{ |
| 145 | + * [K in Exclude<keyof Object, symbol> as `${K} - first`]: Object[K] |
| 146 | + * } & { |
| 147 | + * [K in Exclude<keyof Object, symbol> as `${K} - subsequest`]: Object[K] |
| 148 | + * }} SegmentedByVisit |
| 149 | + */ |
| 150 | + |
| 151 | +/** |
| 152 | + * @template {Record<string, unknown>} Object |
| 153 | + * @typedef {{ |
| 154 | + * [K in Extract<keyof Object, string> as import('type-fest').Replace<K, 'Energy', 'CO2'>]: Object[K] |
| 155 | + * }} MapEnergyToCO2 |
| 156 | + */ |
0 commit comments