@smartdcc/duis-templates 0.2.1 → 0.4.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.
- package/README.md +131 -0
- package/dist/gbcs-mapping-table.json +828 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/load.d.ts +9 -0
- package/dist/load.d.ts.map +1 -1
- package/dist/load.js +9 -5
- package/dist/load.js.map +1 -1
- package/dist/search.d.ts +12 -2
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +33 -2
- package/dist/search.js.map +1 -1
- package/dist/tariff.d.ts +18 -0
- package/dist/tariff.d.ts.map +1 -0
- package/dist/tariff.dto.d.ts +124 -0
- package/dist/tariff.dto.d.ts.map +1 -0
- package/dist/tariff.dto.js +35 -0
- package/dist/tariff.dto.js.map +1 -0
- package/dist/tariff.is.d.ts +27 -0
- package/dist/tariff.is.d.ts.map +1 -0
- package/dist/tariff.is.js +228 -0
- package/dist/tariff.is.js.map +1 -0
- package/dist/tariff.js +178 -0
- package/dist/tariff.js.map +1 -0
- package/package.json +12 -9
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Created on Fri Aug 11 2023
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2023 Smart DCC Limited
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.isValidTariff = exports.isTariff = exports.isSpecialDays = exports.isSpecialDay = exports.isPricing = exports.isTOUs = exports.isBlocks = exports.isBlockAction = exports.isWeekProfiles = exports.isWeekProfile = exports.isDayProfileName = exports.isDayProfiles = exports.isDayProfile = exports.isProfileSchedule = exports.isNumberRange = exports.isSeasons = exports.isSeason = exports.isTupleMinMax = exports.isTuple = void 0;
|
|
22
|
+
function isTuple(x, n, isT) {
|
|
23
|
+
const y = x;
|
|
24
|
+
if (y === null || y === undefined || !Array.isArray(y) || y.length !== n) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return y.every(isT);
|
|
28
|
+
}
|
|
29
|
+
exports.isTuple = isTuple;
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
function isTupleMinMax(x, min, max, isT) {
|
|
33
|
+
const y = x;
|
|
34
|
+
if (y === null ||
|
|
35
|
+
y === undefined ||
|
|
36
|
+
!Array.isArray(y) ||
|
|
37
|
+
y.length < min ||
|
|
38
|
+
y.length > max) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return y.every(isT);
|
|
42
|
+
}
|
|
43
|
+
exports.isTupleMinMax = isTupleMinMax;
|
|
44
|
+
function isSeason(x) {
|
|
45
|
+
const y = x;
|
|
46
|
+
return (y !== null &&
|
|
47
|
+
y !== undefined &&
|
|
48
|
+
typeof y === 'object' &&
|
|
49
|
+
typeof y.name === 'string' &&
|
|
50
|
+
typeof y.weekProfile === 'number' &&
|
|
51
|
+
['undefined', 'number'].includes(typeof y.year) &&
|
|
52
|
+
['undefined', 'number'].includes(typeof y.month) &&
|
|
53
|
+
['undefined', 'number'].includes(typeof y.dayOfMonth) &&
|
|
54
|
+
['undefined', 'number'].includes(typeof y.dayOfWeek));
|
|
55
|
+
}
|
|
56
|
+
exports.isSeason = isSeason;
|
|
57
|
+
const isSeasons = (x) => isTupleMinMax(x, 1, 4, isSeason);
|
|
58
|
+
exports.isSeasons = isSeasons;
|
|
59
|
+
function isNumberRange(x, n) {
|
|
60
|
+
return typeof x === 'number' && Number.isInteger(x) && x > 0 && x <= n;
|
|
61
|
+
}
|
|
62
|
+
exports.isNumberRange = isNumberRange;
|
|
63
|
+
function isProfileSchedule(x) {
|
|
64
|
+
const y = x;
|
|
65
|
+
if (y === null ||
|
|
66
|
+
y === undefined ||
|
|
67
|
+
typeof y !== 'object' ||
|
|
68
|
+
!['tou', 'block'].includes(y.mode) ||
|
|
69
|
+
typeof y.startTime !== 'number') {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return ((y.mode === 'tou' && isNumberRange(y.action, 48)) ||
|
|
73
|
+
(y.mode === 'block' && isNumberRange(y.action, 8)));
|
|
74
|
+
}
|
|
75
|
+
exports.isProfileSchedule = isProfileSchedule;
|
|
76
|
+
const isDayProfile = (x) => isTupleMinMax(x, 1, 48, isProfileSchedule);
|
|
77
|
+
exports.isDayProfile = isDayProfile;
|
|
78
|
+
const isDayProfiles = (x) => isTupleMinMax(x, 1, 16, exports.isDayProfile);
|
|
79
|
+
exports.isDayProfiles = isDayProfiles;
|
|
80
|
+
const isDayProfileName = (x) => isNumberRange(x, 16);
|
|
81
|
+
exports.isDayProfileName = isDayProfileName;
|
|
82
|
+
const isWeekProfile = (x) => isTuple(x, 7, exports.isDayProfileName);
|
|
83
|
+
exports.isWeekProfile = isWeekProfile;
|
|
84
|
+
const isWeekProfiles = (x) => isTupleMinMax(x, 1, 4, exports.isWeekProfile);
|
|
85
|
+
exports.isWeekProfiles = isWeekProfiles;
|
|
86
|
+
function isBlockAction(x) {
|
|
87
|
+
const y = x;
|
|
88
|
+
return (y !== null &&
|
|
89
|
+
y !== undefined &&
|
|
90
|
+
typeof y === 'object' &&
|
|
91
|
+
Array.isArray(y.prices) &&
|
|
92
|
+
Array.isArray(y.thresholds) &&
|
|
93
|
+
y.prices.every((p) => typeof p === 'number') &&
|
|
94
|
+
y.thresholds.every((t) => typeof t === 'number') &&
|
|
95
|
+
((y.thresholds.length === 1 && y.prices.length === 2) ||
|
|
96
|
+
(y.thresholds.length === 2 && y.prices.length === 3) ||
|
|
97
|
+
(y.thresholds.length === 3 && y.prices.length === 4)));
|
|
98
|
+
}
|
|
99
|
+
exports.isBlockAction = isBlockAction;
|
|
100
|
+
const isBlocks = (x) => isTuple(x, 8, isBlockAction);
|
|
101
|
+
exports.isBlocks = isBlocks;
|
|
102
|
+
const isTOUs = (x) => isTupleMinMax(x, 0, 48, (n) => typeof n === 'number');
|
|
103
|
+
exports.isTOUs = isTOUs;
|
|
104
|
+
function isPricing(x) {
|
|
105
|
+
const y = x;
|
|
106
|
+
return (y !== null &&
|
|
107
|
+
y !== undefined &&
|
|
108
|
+
typeof y === 'object' &&
|
|
109
|
+
typeof y.priceScale === 'number' &&
|
|
110
|
+
typeof y.standingCharge === 'number' &&
|
|
111
|
+
typeof y.standingChargeScale === 'number');
|
|
112
|
+
}
|
|
113
|
+
exports.isPricing = isPricing;
|
|
114
|
+
function isSpecialDay(x) {
|
|
115
|
+
const y = x;
|
|
116
|
+
return (y !== null &&
|
|
117
|
+
y !== undefined &&
|
|
118
|
+
typeof y === 'object' &&
|
|
119
|
+
typeof y.dayProfile === 'number' &&
|
|
120
|
+
['undefined', 'number'].includes(typeof y.year) &&
|
|
121
|
+
['undefined', 'number'].includes(typeof y.month) &&
|
|
122
|
+
['undefined', 'number'].includes(typeof y.dayOfMonth) &&
|
|
123
|
+
['undefined', 'number'].includes(typeof y.dayOfWeek));
|
|
124
|
+
}
|
|
125
|
+
exports.isSpecialDay = isSpecialDay;
|
|
126
|
+
const isSpecialDays = (x) => Array.isArray(x) && x.every(isSpecialDay);
|
|
127
|
+
exports.isSpecialDays = isSpecialDays;
|
|
128
|
+
function isTariff(x) {
|
|
129
|
+
const y = x;
|
|
130
|
+
return (y !== null &&
|
|
131
|
+
y !== undefined &&
|
|
132
|
+
typeof y === 'object' &&
|
|
133
|
+
(0, exports.isSeasons)(y.seasons) &&
|
|
134
|
+
(0, exports.isWeekProfiles)(y.weekProfiles) &&
|
|
135
|
+
(0, exports.isDayProfiles)(y.dayProfiles) &&
|
|
136
|
+
(0, exports.isSpecialDays)(y.specialDays) &&
|
|
137
|
+
(0, exports.isBlocks)(y.blocks) &&
|
|
138
|
+
(0, exports.isTOUs)(y.tous) &&
|
|
139
|
+
isPricing(y.pricing));
|
|
140
|
+
}
|
|
141
|
+
exports.isTariff = isTariff;
|
|
142
|
+
/**
|
|
143
|
+
* Determine if parameter is a valid tariff. This is a restriction on isTariff
|
|
144
|
+
* by also checking items which are not enforced by the type system.
|
|
145
|
+
*
|
|
146
|
+
* @param x a Tariff object
|
|
147
|
+
*/
|
|
148
|
+
function isValidTariff(x) {
|
|
149
|
+
if (isTariff(x)) {
|
|
150
|
+
/*
|
|
151
|
+
well-formedness check on day profiles:
|
|
152
|
+
each day profile starts at 0
|
|
153
|
+
each day profile start time is monotonic
|
|
154
|
+
largest profile schedule is < full day
|
|
155
|
+
*/
|
|
156
|
+
if (!x.dayProfiles.every((dp) => dp[0].startTime === 0 &&
|
|
157
|
+
dp.reduce((acc, x) => [
|
|
158
|
+
acc[0] && x.startTime > acc[1] && Number.isInteger(x.startTime),
|
|
159
|
+
x.startTime,
|
|
160
|
+
], [true, -1])[0] &&
|
|
161
|
+
dp[dp.length - 1].startTime < 60 * 60 * 24)) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
/*
|
|
165
|
+
well-formedness check on week profiles:
|
|
166
|
+
each week profile only references defined day profiles
|
|
167
|
+
*/
|
|
168
|
+
if (!x.weekProfiles.every((wp) => wp.every((dpname) => dpname - 1 < x.dayProfiles.length))) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
/*
|
|
172
|
+
well-formdness check on seasons:
|
|
173
|
+
each season only references defined week profiles
|
|
174
|
+
each year (if not wildcard) is >= 2014
|
|
175
|
+
each month (if not wildcard) is 1..12
|
|
176
|
+
each day of month (if not wildcard) is 1..31
|
|
177
|
+
each day of week (if not wildcard) is 1..7
|
|
178
|
+
*/
|
|
179
|
+
if (!x.seasons.every((s) => s.weekProfile - 1 < x.weekProfiles.length &&
|
|
180
|
+
Number.isInteger(s.year ?? 2014) &&
|
|
181
|
+
(s.year ?? 2014) >= 2014 &&
|
|
182
|
+
Number.isInteger(s.month ?? 1) &&
|
|
183
|
+
(s.month ?? 1) >= 1 &&
|
|
184
|
+
(s.month ?? 1) <= 12 &&
|
|
185
|
+
Number.isInteger(s.dayOfMonth ?? 1) &&
|
|
186
|
+
(s.dayOfMonth ?? 1) >= 1 &&
|
|
187
|
+
(s.dayOfMonth ?? 1) <= 31 &&
|
|
188
|
+
Number.isInteger(s.dayOfWeek ?? 1) &&
|
|
189
|
+
(s.dayOfWeek ?? 1) >= 1 &&
|
|
190
|
+
(s.dayOfWeek ?? 1) <= 7 &&
|
|
191
|
+
(s.year === undefined ||
|
|
192
|
+
s.month === undefined ||
|
|
193
|
+
s.dayOfMonth === undefined ||
|
|
194
|
+
s.dayOfWeek === undefined))) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
/*
|
|
198
|
+
well-formdness check on special days:
|
|
199
|
+
each special day only references defined day profiles
|
|
200
|
+
each year (if not wildcard) is >= 2014
|
|
201
|
+
each month (if not wildcard) is 1..12
|
|
202
|
+
each day of month (if not wildcard) is 1..31
|
|
203
|
+
each day of week (if not wildcard) is 1..7
|
|
204
|
+
*/
|
|
205
|
+
if (!x.specialDays.every((sd) => sd.dayProfile - 1 < x.dayProfiles.length &&
|
|
206
|
+
Number.isInteger(sd.year ?? 2014) &&
|
|
207
|
+
(sd.year ?? 2014) >= 2014 &&
|
|
208
|
+
Number.isInteger(sd.month ?? 1) &&
|
|
209
|
+
(sd.month ?? 1) >= 1 &&
|
|
210
|
+
(sd.month ?? 1) <= 12 &&
|
|
211
|
+
Number.isInteger(sd.dayOfMonth ?? 1) &&
|
|
212
|
+
(sd.dayOfMonth ?? 1) >= 1 &&
|
|
213
|
+
(sd.dayOfMonth ?? 1) <= 31 &&
|
|
214
|
+
Number.isInteger(sd.dayOfWeek ?? 1) &&
|
|
215
|
+
(sd.dayOfWeek ?? 1) >= 1 &&
|
|
216
|
+
(sd.dayOfWeek ?? 1) <= 7 &&
|
|
217
|
+
(sd.year === undefined ||
|
|
218
|
+
sd.month === undefined ||
|
|
219
|
+
sd.dayOfMonth === undefined ||
|
|
220
|
+
sd.dayOfWeek === undefined))) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
exports.isValidTariff = isValidTariff;
|
|
228
|
+
//# sourceMappingURL=tariff.is.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tariff.is.js","sourceRoot":"","sources":["../src/tariff.is.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAuBH,SAAgB,OAAO,CACrB,CAAU,EACV,CAAI,EACJ,GAA2B;IAE3B,MAAM,CAAC,GAAG,CAAa,CAAA;IACvB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QACxE,OAAO,KAAK,CAAA;KACb;IACD,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AACrB,CAAC;AAVD,0BAUC;AAED,6DAA6D;AAC7D,aAAa;AACb,SAAgB,aAAa,CAM3B,CAAU,EACV,GAAQ,EACR,GAAQ,EACR,GAA2B;IAE3B,MAAM,CAAC,GAAG,CAAa,CAAA;IACvB,IACE,CAAC,KAAK,IAA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you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.buildUpdateImportTariff_PrimaryElement = exports.buildDate = exports.singlify = void 0;
|
|
22
|
+
const duis_parser_1 = require("@smartdcc/duis-parser");
|
|
23
|
+
function singlify(d) {
|
|
24
|
+
if (d.length === 1) {
|
|
25
|
+
return d[0];
|
|
26
|
+
}
|
|
27
|
+
return d;
|
|
28
|
+
}
|
|
29
|
+
exports.singlify = singlify;
|
|
30
|
+
function buildDate(d) {
|
|
31
|
+
return {
|
|
32
|
+
Year: d.year === undefined
|
|
33
|
+
? { NonSpecifiedYear: '' }
|
|
34
|
+
: { SpecifiedYear: `${d.year}` },
|
|
35
|
+
Month: d.month === undefined
|
|
36
|
+
? { NonSpecifiedMonth: '' }
|
|
37
|
+
: d.month === 0xfd
|
|
38
|
+
? { SecondLastDayOfMonth: '' }
|
|
39
|
+
: d.month === 0xfe
|
|
40
|
+
? { LastDayOfMonth: '' }
|
|
41
|
+
: { SpecifiedMonth: `${d.month}` },
|
|
42
|
+
DayOfMonth: d.dayOfMonth === undefined
|
|
43
|
+
? { NonSpecifiedDayOfMonth: '' }
|
|
44
|
+
: { SpecifiedDayOfMonth: `${d.dayOfMonth}` },
|
|
45
|
+
DayOfWeek: d.dayOfWeek === undefined
|
|
46
|
+
? { NonSpecifiedDayOfWeek: '' }
|
|
47
|
+
: { SpecifiedDayOfWeek: `${d.dayOfWeek}` },
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
exports.buildDate = buildDate;
|
|
51
|
+
/**
|
|
52
|
+
* Builds SRV 1.1.1 from a Tariff object
|
|
53
|
+
*
|
|
54
|
+
* @param t Tariff object
|
|
55
|
+
* @param requestId
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
function buildUpdateImportTariff_PrimaryElement(t, requestId) {
|
|
59
|
+
const serviceReferenceVariant = (0, duis_parser_1.lookupSRV)('1.1.1');
|
|
60
|
+
if (serviceReferenceVariant === undefined) {
|
|
61
|
+
throw new Error('unable to lookup srv 1.1.1');
|
|
62
|
+
}
|
|
63
|
+
const Seasons = {
|
|
64
|
+
Season: singlify(t.seasons.map((season) => ({
|
|
65
|
+
SeasonName: season.name,
|
|
66
|
+
SeasonStartDate: buildDate(season),
|
|
67
|
+
ReferencedWeekName: `${season.weekProfile}`,
|
|
68
|
+
}))),
|
|
69
|
+
};
|
|
70
|
+
const WeekProfiles = {
|
|
71
|
+
WeekProfile: singlify(t.weekProfiles.map((weekProfile, i) => ({
|
|
72
|
+
WeekName: `${i + 1}`,
|
|
73
|
+
ReferencedDayName: singlify(weekProfile.map((dayName, i) => ({
|
|
74
|
+
'#text': `${dayName}`,
|
|
75
|
+
'@_index': `${i + 1}`,
|
|
76
|
+
}))),
|
|
77
|
+
}))),
|
|
78
|
+
};
|
|
79
|
+
const DayProfiles = {
|
|
80
|
+
DayProfile: singlify(t.dayProfiles.map((dayProfile, i) => ({
|
|
81
|
+
DayName: `${i + 1}`,
|
|
82
|
+
ProfileSchedule: singlify(dayProfile.map((action) => {
|
|
83
|
+
const d = new Date(action.startTime * 1000);
|
|
84
|
+
return {
|
|
85
|
+
StartTime: `${`00${d.getUTCHours()}`.slice(-2)}:${`00${d.getUTCMinutes()}`.slice(-2)}:${`00${d.getUTCSeconds()}`.slice(-2)}.00Z`,
|
|
86
|
+
[action.mode === 'block'
|
|
87
|
+
? 'BlockTariffAction'
|
|
88
|
+
: 'TOUTariffAction']: `${action.action}`,
|
|
89
|
+
};
|
|
90
|
+
})),
|
|
91
|
+
}))),
|
|
92
|
+
};
|
|
93
|
+
const SpecialDay = t.specialDays.map((specialDay) => ({
|
|
94
|
+
Date: buildDate(specialDay),
|
|
95
|
+
ReferencedDayName: `${specialDay.dayProfile}`,
|
|
96
|
+
}));
|
|
97
|
+
let SpecialDays = '';
|
|
98
|
+
if (SpecialDay.length >= 1) {
|
|
99
|
+
SpecialDays = { SpecialDay: singlify(SpecialDay) };
|
|
100
|
+
}
|
|
101
|
+
const ThresholdMatrix = {
|
|
102
|
+
Thresholds: t.blocks.map((block, i) => ({
|
|
103
|
+
BlockThreshold: singlify(block.thresholds.map((threshold, i) => ({
|
|
104
|
+
'#text': `${threshold}`,
|
|
105
|
+
'@_index': `${i + 1}`,
|
|
106
|
+
}))),
|
|
107
|
+
'@_index': `${i + 1}`,
|
|
108
|
+
})),
|
|
109
|
+
};
|
|
110
|
+
const TOUTariff = {
|
|
111
|
+
TOUPrice: singlify(t.tous
|
|
112
|
+
.map((price, i) => ({
|
|
113
|
+
'#text': `${price}`,
|
|
114
|
+
'@_index': `${i + 1}`,
|
|
115
|
+
}))
|
|
116
|
+
.filter((x) => x['#text'] !== '0')),
|
|
117
|
+
};
|
|
118
|
+
const BlockPrices = t.blocks
|
|
119
|
+
.map((block, i) => ({
|
|
120
|
+
BlockPrice: singlify(block.prices
|
|
121
|
+
.map((price, i) => ({
|
|
122
|
+
'#text': `${price}`,
|
|
123
|
+
'@_index': `${i + 1}`,
|
|
124
|
+
}))
|
|
125
|
+
.filter((x) => x['#text'] !== '0')),
|
|
126
|
+
'@_index': `${i + 1}`,
|
|
127
|
+
}))
|
|
128
|
+
.filter((block) => t.dayProfiles.some((dayProfile) => dayProfile.some((profileSchedule) => profileSchedule.mode === 'block' &&
|
|
129
|
+
profileSchedule.action === Number(block['@_index']))));
|
|
130
|
+
const BlockTariff = {
|
|
131
|
+
BlockPrices: BlockPrices.length === 1 ? BlockPrices[0] : BlockPrices,
|
|
132
|
+
};
|
|
133
|
+
const isTOU = t.dayProfiles.some((dayProfile) => dayProfile.some((profileSchedule) => profileSchedule.mode === 'tou'));
|
|
134
|
+
const isBlock = t.dayProfiles.some((dayProfile) => dayProfile.some((profileSchedule) => profileSchedule.mode === 'block'));
|
|
135
|
+
let pricing;
|
|
136
|
+
if (isTOU && isBlock) {
|
|
137
|
+
pricing = { HybridTariff: { ...BlockTariff, ...TOUTariff } };
|
|
138
|
+
}
|
|
139
|
+
else if (isTOU) {
|
|
140
|
+
pricing = { TOUTariff };
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
pricing = { BlockTariff };
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
header: {
|
|
147
|
+
type: 'request',
|
|
148
|
+
commandVariant: (0, duis_parser_1.lookupCV)(4),
|
|
149
|
+
serviceReference: '1.1',
|
|
150
|
+
serviceReferenceVariant,
|
|
151
|
+
requestId,
|
|
152
|
+
},
|
|
153
|
+
body: {
|
|
154
|
+
UpdateImportTariffPrimaryElement: {
|
|
155
|
+
ElecTariffElements: {
|
|
156
|
+
CurrencyUnits: 'GBP',
|
|
157
|
+
SwitchingTable: {
|
|
158
|
+
DayProfiles,
|
|
159
|
+
WeekProfiles,
|
|
160
|
+
Seasons,
|
|
161
|
+
},
|
|
162
|
+
SpecialDays,
|
|
163
|
+
ThresholdMatrix,
|
|
164
|
+
},
|
|
165
|
+
PriceElements: {
|
|
166
|
+
ElectricityPriceElements: {
|
|
167
|
+
StandingCharge: `${t.pricing.standingCharge}`,
|
|
168
|
+
StandingChargeScale: `${t.pricing.standingChargeScale}`,
|
|
169
|
+
PriceScale: `${t.pricing.priceScale}`,
|
|
170
|
+
...pricing,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
exports.buildUpdateImportTariff_PrimaryElement = buildUpdateImportTariff_PrimaryElement;
|
|
178
|
+
//# sourceMappingURL=tariff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tariff.js","sourceRoot":"","sources":["../src/tariff.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,uDAM8B;AAG9B,SAAgB,QAAQ,CAAC,CAAY;IACnC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QAClB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;KACZ;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AALD,4BAKC;AAED,SAAgB,SAAS,CAAC,CAKzB;IACC,OAAO;QACL,IAAI,EACF,CAAC,CAAC,IAAI,KAAK,SAAS;YAClB,CAAC,CAAC,EAAE,gBAAgB,EAAE,EAAE,EAAE;YAC1B,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACpC,KAAK,EACH,CAAC,CAAC,KAAK,KAAK,SAAS;YACnB,CAAC,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE;YAC3B,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI;gBAClB,CAAC,CAAC,EAAE,oBAAoB,EAAE,EAAE,EAAE;gBAC9B,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI;oBAClB,CAAC,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE;oBACxB,CAAC,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACtC,UAAU,EACR,CAAC,CAAC,UAAU,KAAK,SAAS;YACxB,CAAC,CAAC,EAAE,sBAAsB,EAAE,EAAE,EAAE;YAChC,CAAC,CAAC,EAAE,mBAAmB,EAAE,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;QAChD,SAAS,EACP,CAAC,CAAC,SAAS,KAAK,SAAS;YACvB,CAAC,CA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wBACd,WAAW;wBACX,YAAY;wBACZ,OAAO;qBACR;oBACD,WAAW;oBACX,eAAe;iBAChB;gBACD,aAAa,EAAE;oBACb,wBAAwB,EAAE;wBACxB,cAAc,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE;wBAC7C,mBAAmB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE;wBACvD,UAAU,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE;wBACrC,GAAG,OAAO;qBACX;iBACF;aACF;SACF;KACF,CAAA;AACH,CAAC;AAzLD,wFAyLC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartdcc/duis-templates",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Collection of DUIS templates from RTDS along with utility functions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,23 +38,26 @@
|
|
|
38
38
|
},
|
|
39
39
|
"license": "GPL-3.0-or-later",
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@
|
|
41
|
+
"@smartdcc/duis-sign-wrap": "^0.1.2",
|
|
42
|
+
"@tsconfig/node16": "^16.1.1",
|
|
42
43
|
"@types/glob": "^8.0.0",
|
|
43
44
|
"@types/jest": "^29.0.0",
|
|
44
|
-
"@types/node": "^
|
|
45
|
-
"@
|
|
46
|
-
"@typescript-eslint/
|
|
45
|
+
"@types/node": "^20.1.0",
|
|
46
|
+
"@types/ungap__structured-clone": "^0.3.0",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
|
48
|
+
"@typescript-eslint/parser": "^6.1.0",
|
|
49
|
+
"@ungap/structured-clone": "^1.2.0",
|
|
47
50
|
"del-cli": "^5.0.0",
|
|
48
51
|
"eslint": "^8.23.0",
|
|
49
|
-
"eslint-config-prettier": "^
|
|
50
|
-
"prettier": "^
|
|
52
|
+
"eslint-config-prettier": "^9.0.0",
|
|
53
|
+
"prettier": "^3.0.0",
|
|
51
54
|
"ts-jest": "^29.0.0",
|
|
52
|
-
"typescript": "^
|
|
55
|
+
"typescript": "^5.0.2"
|
|
53
56
|
},
|
|
54
57
|
"dependencies": {
|
|
55
58
|
"@smartdcc/duis-parser": "^0.4.0",
|
|
56
59
|
"fuse.js": "^6.6.2",
|
|
57
|
-
"glob": "^
|
|
60
|
+
"glob": "^10.1.0"
|
|
58
61
|
},
|
|
59
62
|
"keywords": [
|
|
60
63
|
"duis",
|