spotcharge-types 1.0.475 → 1.0.476
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/dist/utils/connector-standard.util.d.ts +26 -0
- package/dist/utils/connector-standard.util.d.ts.map +1 -0
- package/dist/utils/connector-standard.util.js +72 -0
- package/dist/utils/connector-standard.util.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +7 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +2 -2
- package/src/utils/connector-standard.util.ts +84 -0
- package/src/utils/index.ts +8 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConnectorType } from '../enum/connector-type.enum';
|
|
2
|
+
/**
|
|
3
|
+
* One chip, two stored names. Partner plugs keep the OCPI standard.
|
|
4
|
+
* Owned connectors keep ConnectorType. This map is the only translation.
|
|
5
|
+
*/
|
|
6
|
+
export interface ConnectorStandardPair {
|
|
7
|
+
/** OCPI connector.standard. This is the chip value. */
|
|
8
|
+
standard: string;
|
|
9
|
+
/** Driver-facing label. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Owned infrastructure.connectors.connector_type, when we install this plug. */
|
|
12
|
+
ownedType: ConnectorType | null;
|
|
13
|
+
}
|
|
14
|
+
export declare const CONNECTOR_STANDARD_PAIRS: readonly ConnectorStandardPair[];
|
|
15
|
+
export declare function connectorStandardLabel(standard: string | null | undefined): string;
|
|
16
|
+
export declare function ocpiStandardForOwnedType(ownedType: string | null | undefined): string | null;
|
|
17
|
+
export declare function ownedTypeForOcpiStandard(standard: string | null | undefined): ConnectorType | null;
|
|
18
|
+
/**
|
|
19
|
+
* Standards a chip matches on partner plugs, plus the owned connector type
|
|
20
|
+
* when we install that plug. A CCS 2 chip matches IEC_62196_T2_COMBO and CCS2.
|
|
21
|
+
*/
|
|
22
|
+
export declare function plugMatchForStandard(standard: string): {
|
|
23
|
+
standards: string[];
|
|
24
|
+
ownedType: ConnectorType | null;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=connector-standard.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-standard.util.d.ts","sourceRoot":"","sources":["../../src/utils/connector-standard.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;CACjC;AAED,eAAO,MAAM,wBAAwB,EAAE,SAAS,qBAAqB,EAWpE,CAAC;AAOF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAUlF;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAM5F;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAMlG;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG;IACtD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;CACjC,CAUA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.plugMatchForStandard = exports.ownedTypeForOcpiStandard = exports.ocpiStandardForOwnedType = exports.connectorStandardLabel = exports.CONNECTOR_STANDARD_PAIRS = void 0;
|
|
4
|
+
var connector_type_enum_1 = require("../enum/connector-type.enum");
|
|
5
|
+
exports.CONNECTOR_STANDARD_PAIRS = [
|
|
6
|
+
{ standard: 'IEC_62196_T2', label: 'Type 2', ownedType: connector_type_enum_1.ConnectorType.TYPE_2 },
|
|
7
|
+
{ standard: 'IEC_62196_T2_COMBO', label: 'CCS 2', ownedType: connector_type_enum_1.ConnectorType.CCS_2 },
|
|
8
|
+
{ standard: 'DOMESTIC_A', label: 'Smart plug', ownedType: connector_type_enum_1.ConnectorType.SMART_PLUG },
|
|
9
|
+
{ standard: 'IEC_62196_T1', label: 'Type 1', ownedType: null },
|
|
10
|
+
{ standard: 'IEC_62196_T1_COMBO', label: 'CCS 1', ownedType: null },
|
|
11
|
+
{ standard: 'CHADEMO', label: 'CHAdeMO', ownedType: null },
|
|
12
|
+
{ standard: 'GBT_AC', label: 'GB/T', ownedType: null },
|
|
13
|
+
{ standard: 'GBT_DC', label: 'GB/T', ownedType: null },
|
|
14
|
+
{ standard: 'TESLA_S', label: 'Tesla', ownedType: null },
|
|
15
|
+
{ standard: 'TESLA_R', label: 'Tesla', ownedType: null },
|
|
16
|
+
];
|
|
17
|
+
/** Partner screens sometimes send this non-OCPI spelling. */
|
|
18
|
+
var STANDARD_ALIASES = {
|
|
19
|
+
GB_T: 'GBT_DC',
|
|
20
|
+
};
|
|
21
|
+
function connectorStandardLabel(standard) {
|
|
22
|
+
if (!(standard === null || standard === void 0 ? void 0 : standard.trim())) {
|
|
23
|
+
return 'Connector';
|
|
24
|
+
}
|
|
25
|
+
var resolved = resolveConnectorStandard(standard);
|
|
26
|
+
var pair = exports.CONNECTOR_STANDARD_PAIRS.find(function (item) { return item.standard === resolved; });
|
|
27
|
+
if (pair) {
|
|
28
|
+
return pair.label;
|
|
29
|
+
}
|
|
30
|
+
return resolved.replace(/_/g, ' ');
|
|
31
|
+
}
|
|
32
|
+
exports.connectorStandardLabel = connectorStandardLabel;
|
|
33
|
+
function ocpiStandardForOwnedType(ownedType) {
|
|
34
|
+
var _a;
|
|
35
|
+
if (!ownedType) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
var pair = exports.CONNECTOR_STANDARD_PAIRS.find(function (item) { return item.ownedType === ownedType; });
|
|
39
|
+
return (_a = pair === null || pair === void 0 ? void 0 : pair.standard) !== null && _a !== void 0 ? _a : null;
|
|
40
|
+
}
|
|
41
|
+
exports.ocpiStandardForOwnedType = ocpiStandardForOwnedType;
|
|
42
|
+
function ownedTypeForOcpiStandard(standard) {
|
|
43
|
+
var _a;
|
|
44
|
+
if (!standard) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
var pair = exports.CONNECTOR_STANDARD_PAIRS.find(function (item) { return item.standard === resolveConnectorStandard(standard); });
|
|
48
|
+
return (_a = pair === null || pair === void 0 ? void 0 : pair.ownedType) !== null && _a !== void 0 ? _a : null;
|
|
49
|
+
}
|
|
50
|
+
exports.ownedTypeForOcpiStandard = ownedTypeForOcpiStandard;
|
|
51
|
+
/**
|
|
52
|
+
* Standards a chip matches on partner plugs, plus the owned connector type
|
|
53
|
+
* when we install that plug. A CCS 2 chip matches IEC_62196_T2_COMBO and CCS2.
|
|
54
|
+
*/
|
|
55
|
+
function plugMatchForStandard(standard) {
|
|
56
|
+
var resolved = resolveConnectorStandard(standard);
|
|
57
|
+
var pair = exports.CONNECTOR_STANDARD_PAIRS.find(function (item) { return item.standard === resolved; });
|
|
58
|
+
if (!pair) {
|
|
59
|
+
return { standards: [resolved], ownedType: null };
|
|
60
|
+
}
|
|
61
|
+
var standards = exports.CONNECTOR_STANDARD_PAIRS
|
|
62
|
+
.filter(function (item) { return item.label === pair.label; })
|
|
63
|
+
.map(function (item) { return item.standard; });
|
|
64
|
+
return { standards: standards, ownedType: pair.ownedType };
|
|
65
|
+
}
|
|
66
|
+
exports.plugMatchForStandard = plugMatchForStandard;
|
|
67
|
+
function resolveConnectorStandard(standard) {
|
|
68
|
+
var _a;
|
|
69
|
+
var trimmed = standard.trim();
|
|
70
|
+
return (_a = STANDARD_ALIASES[trimmed]) !== null && _a !== void 0 ? _a : trimmed;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=connector-standard.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-standard.util.js","sourceRoot":"","sources":["../../src/utils/connector-standard.util.ts"],"names":[],"mappings":"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"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { CONSUMER_STATION_ACCESS_TYPES, FLEET_STATION_ACCESS_TYPES, mapCapabilitiesAccessToAccessType, stationHasConsumerAccess, stationHasFleetAccess, } from './station-access.util';
|
|
2
2
|
export { CHARGE_CODE_LENGTH, isValidChargeCode } from './station-charge-code.util';
|
|
3
|
+
export { CONNECTOR_STANDARD_PAIRS, ConnectorStandardPair, connectorStandardLabel, ocpiStandardForOwnedType, ownedTypeForOcpiStandard, plugMatchForStandard, } from './connector-standard.util';
|
|
3
4
|
export { MAX_PARTNER_SHARE_PERCENT, PARTNER_SHARE_CAP_ERROR, PARTNER_SHARE_TARIFF_REQUIRED_ERROR, PLATFORM_MIN_SHARE_PERCENT, PartnershipShareInput, maxPartnerShareSumMinor, partnerShareSumMinorForRate, partnerShareSumMinorPercentOnly, platformKeepsPercentAtRate, remainingPartnerSharePercent, toShareMinorUnits, validatePartnerShareTotals, } from './station-partnership-share.util';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,iCAAiC,EACjC,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,mCAAmC,EACnC,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAC3B,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC5B,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,iCAAiC,EACjC,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,mCAAmC,EACnC,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAC3B,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC5B,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,kCAAkC,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validatePartnerShareTotals = exports.toShareMinorUnits = exports.remainingPartnerSharePercent = exports.platformKeepsPercentAtRate = exports.partnerShareSumMinorPercentOnly = exports.partnerShareSumMinorForRate = exports.maxPartnerShareSumMinor = exports.PLATFORM_MIN_SHARE_PERCENT = exports.PARTNER_SHARE_TARIFF_REQUIRED_ERROR = exports.PARTNER_SHARE_CAP_ERROR = exports.MAX_PARTNER_SHARE_PERCENT = exports.isValidChargeCode = exports.CHARGE_CODE_LENGTH = exports.stationHasFleetAccess = exports.stationHasConsumerAccess = exports.mapCapabilitiesAccessToAccessType = exports.FLEET_STATION_ACCESS_TYPES = exports.CONSUMER_STATION_ACCESS_TYPES = void 0;
|
|
3
|
+
exports.validatePartnerShareTotals = exports.toShareMinorUnits = exports.remainingPartnerSharePercent = exports.platformKeepsPercentAtRate = exports.partnerShareSumMinorPercentOnly = exports.partnerShareSumMinorForRate = exports.maxPartnerShareSumMinor = exports.PLATFORM_MIN_SHARE_PERCENT = exports.PARTNER_SHARE_TARIFF_REQUIRED_ERROR = exports.PARTNER_SHARE_CAP_ERROR = exports.MAX_PARTNER_SHARE_PERCENT = exports.plugMatchForStandard = exports.ownedTypeForOcpiStandard = exports.ocpiStandardForOwnedType = exports.connectorStandardLabel = exports.CONNECTOR_STANDARD_PAIRS = exports.isValidChargeCode = exports.CHARGE_CODE_LENGTH = exports.stationHasFleetAccess = exports.stationHasConsumerAccess = exports.mapCapabilitiesAccessToAccessType = exports.FLEET_STATION_ACCESS_TYPES = exports.CONSUMER_STATION_ACCESS_TYPES = void 0;
|
|
4
4
|
var station_access_util_1 = require("./station-access.util");
|
|
5
5
|
Object.defineProperty(exports, "CONSUMER_STATION_ACCESS_TYPES", { enumerable: true, get: function () { return station_access_util_1.CONSUMER_STATION_ACCESS_TYPES; } });
|
|
6
6
|
Object.defineProperty(exports, "FLEET_STATION_ACCESS_TYPES", { enumerable: true, get: function () { return station_access_util_1.FLEET_STATION_ACCESS_TYPES; } });
|
|
@@ -10,6 +10,12 @@ Object.defineProperty(exports, "stationHasFleetAccess", { enumerable: true, get:
|
|
|
10
10
|
var station_charge_code_util_1 = require("./station-charge-code.util");
|
|
11
11
|
Object.defineProperty(exports, "CHARGE_CODE_LENGTH", { enumerable: true, get: function () { return station_charge_code_util_1.CHARGE_CODE_LENGTH; } });
|
|
12
12
|
Object.defineProperty(exports, "isValidChargeCode", { enumerable: true, get: function () { return station_charge_code_util_1.isValidChargeCode; } });
|
|
13
|
+
var connector_standard_util_1 = require("./connector-standard.util");
|
|
14
|
+
Object.defineProperty(exports, "CONNECTOR_STANDARD_PAIRS", { enumerable: true, get: function () { return connector_standard_util_1.CONNECTOR_STANDARD_PAIRS; } });
|
|
15
|
+
Object.defineProperty(exports, "connectorStandardLabel", { enumerable: true, get: function () { return connector_standard_util_1.connectorStandardLabel; } });
|
|
16
|
+
Object.defineProperty(exports, "ocpiStandardForOwnedType", { enumerable: true, get: function () { return connector_standard_util_1.ocpiStandardForOwnedType; } });
|
|
17
|
+
Object.defineProperty(exports, "ownedTypeForOcpiStandard", { enumerable: true, get: function () { return connector_standard_util_1.ownedTypeForOcpiStandard; } });
|
|
18
|
+
Object.defineProperty(exports, "plugMatchForStandard", { enumerable: true, get: function () { return connector_standard_util_1.plugMatchForStandard; } });
|
|
13
19
|
var station_partnership_share_util_1 = require("./station-partnership-share.util");
|
|
14
20
|
Object.defineProperty(exports, "MAX_PARTNER_SHARE_PERCENT", { enumerable: true, get: function () { return station_partnership_share_util_1.MAX_PARTNER_SHARE_PERCENT; } });
|
|
15
21
|
Object.defineProperty(exports, "PARTNER_SHARE_CAP_ERROR", { enumerable: true, get: function () { return station_partnership_share_util_1.PARTNER_SHARE_CAP_ERROR; } });
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,6DAM+B;AAL7B,oIAAA,6BAA6B,OAAA;AAC7B,iIAAA,0BAA0B,OAAA;AAC1B,wIAAA,iCAAiC,OAAA;AACjC,+HAAA,wBAAwB,OAAA;AACxB,4HAAA,qBAAqB,OAAA;AAEvB,uEAAmF;AAA1E,8HAAA,kBAAkB,OAAA;AAAE,6HAAA,iBAAiB,OAAA;AAC9C,mFAa0C;AAZxC,2IAAA,yBAAyB,OAAA;AACzB,yIAAA,uBAAuB,OAAA;AACvB,qJAAA,mCAAmC,OAAA;AACnC,4IAAA,0BAA0B,OAAA;AAE1B,yIAAA,uBAAuB,OAAA;AACvB,6IAAA,2BAA2B,OAAA;AAC3B,iJAAA,+BAA+B,OAAA;AAC/B,4IAAA,0BAA0B,OAAA;AAC1B,8IAAA,4BAA4B,OAAA;AAC5B,mIAAA,iBAAiB,OAAA;AACjB,4IAAA,0BAA0B,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,6DAM+B;AAL7B,oIAAA,6BAA6B,OAAA;AAC7B,iIAAA,0BAA0B,OAAA;AAC1B,wIAAA,iCAAiC,OAAA;AACjC,+HAAA,wBAAwB,OAAA;AACxB,4HAAA,qBAAqB,OAAA;AAEvB,uEAAmF;AAA1E,8HAAA,kBAAkB,OAAA;AAAE,6HAAA,iBAAiB,OAAA;AAC9C,qEAOmC;AANjC,mIAAA,wBAAwB,OAAA;AAExB,iIAAA,sBAAsB,OAAA;AACtB,mIAAA,wBAAwB,OAAA;AACxB,mIAAA,wBAAwB,OAAA;AACxB,+HAAA,oBAAoB,OAAA;AAEtB,mFAa0C;AAZxC,2IAAA,yBAAyB,OAAA;AACzB,yIAAA,uBAAuB,OAAA;AACvB,qJAAA,mCAAmC,OAAA;AACnC,4IAAA,0BAA0B,OAAA;AAE1B,yIAAA,uBAAuB,OAAA;AACvB,6IAAA,2BAA2B,OAAA;AAC3B,iJAAA,+BAA+B,OAAA;AAC/B,4IAAA,0BAA0B,OAAA;AAC1B,8IAAA,4BAA4B,OAAA;AAC5B,mIAAA,iBAAiB,OAAA;AACjB,4IAAA,0BAA0B,OAAA"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ConnectorType } from '../enum/connector-type.enum';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One chip, two stored names. Partner plugs keep the OCPI standard.
|
|
5
|
+
* Owned connectors keep ConnectorType. This map is the only translation.
|
|
6
|
+
*/
|
|
7
|
+
export interface ConnectorStandardPair {
|
|
8
|
+
/** OCPI connector.standard. This is the chip value. */
|
|
9
|
+
standard: string;
|
|
10
|
+
/** Driver-facing label. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Owned infrastructure.connectors.connector_type, when we install this plug. */
|
|
13
|
+
ownedType: ConnectorType | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const CONNECTOR_STANDARD_PAIRS: readonly ConnectorStandardPair[] = [
|
|
17
|
+
{ standard: 'IEC_62196_T2', label: 'Type 2', ownedType: ConnectorType.TYPE_2 },
|
|
18
|
+
{ standard: 'IEC_62196_T2_COMBO', label: 'CCS 2', ownedType: ConnectorType.CCS_2 },
|
|
19
|
+
{ standard: 'DOMESTIC_A', label: 'Smart plug', ownedType: ConnectorType.SMART_PLUG },
|
|
20
|
+
{ standard: 'IEC_62196_T1', label: 'Type 1', ownedType: null },
|
|
21
|
+
{ standard: 'IEC_62196_T1_COMBO', label: 'CCS 1', ownedType: null },
|
|
22
|
+
{ standard: 'CHADEMO', label: 'CHAdeMO', ownedType: null },
|
|
23
|
+
{ standard: 'GBT_AC', label: 'GB/T', ownedType: null },
|
|
24
|
+
{ standard: 'GBT_DC', label: 'GB/T', ownedType: null },
|
|
25
|
+
{ standard: 'TESLA_S', label: 'Tesla', ownedType: null },
|
|
26
|
+
{ standard: 'TESLA_R', label: 'Tesla', ownedType: null },
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
/** Partner screens sometimes send this non-OCPI spelling. */
|
|
30
|
+
const STANDARD_ALIASES: Record<string, string> = {
|
|
31
|
+
GB_T: 'GBT_DC',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export function connectorStandardLabel(standard: string | null | undefined): string {
|
|
35
|
+
if (!standard?.trim()) {
|
|
36
|
+
return 'Connector';
|
|
37
|
+
}
|
|
38
|
+
const resolved = resolveConnectorStandard(standard);
|
|
39
|
+
const pair = CONNECTOR_STANDARD_PAIRS.find((item) => item.standard === resolved);
|
|
40
|
+
if (pair) {
|
|
41
|
+
return pair.label;
|
|
42
|
+
}
|
|
43
|
+
return resolved.replace(/_/g, ' ');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function ocpiStandardForOwnedType(ownedType: string | null | undefined): string | null {
|
|
47
|
+
if (!ownedType) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const pair = CONNECTOR_STANDARD_PAIRS.find((item) => item.ownedType === ownedType);
|
|
51
|
+
return pair?.standard ?? null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function ownedTypeForOcpiStandard(standard: string | null | undefined): ConnectorType | null {
|
|
55
|
+
if (!standard) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const pair = CONNECTOR_STANDARD_PAIRS.find((item) => item.standard === resolveConnectorStandard(standard));
|
|
59
|
+
return pair?.ownedType ?? null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Standards a chip matches on partner plugs, plus the owned connector type
|
|
64
|
+
* when we install that plug. A CCS 2 chip matches IEC_62196_T2_COMBO and CCS2.
|
|
65
|
+
*/
|
|
66
|
+
export function plugMatchForStandard(standard: string): {
|
|
67
|
+
standards: string[];
|
|
68
|
+
ownedType: ConnectorType | null;
|
|
69
|
+
} {
|
|
70
|
+
const resolved = resolveConnectorStandard(standard);
|
|
71
|
+
const pair = CONNECTOR_STANDARD_PAIRS.find((item) => item.standard === resolved);
|
|
72
|
+
if (!pair) {
|
|
73
|
+
return { standards: [resolved], ownedType: null };
|
|
74
|
+
}
|
|
75
|
+
const standards = CONNECTOR_STANDARD_PAIRS
|
|
76
|
+
.filter((item) => item.label === pair.label)
|
|
77
|
+
.map((item) => item.standard);
|
|
78
|
+
return { standards, ownedType: pair.ownedType };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function resolveConnectorStandard(standard: string): string {
|
|
82
|
+
const trimmed = standard.trim();
|
|
83
|
+
return STANDARD_ALIASES[trimmed] ?? trimmed;
|
|
84
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -6,6 +6,14 @@ export {
|
|
|
6
6
|
stationHasFleetAccess,
|
|
7
7
|
} from './station-access.util';
|
|
8
8
|
export { CHARGE_CODE_LENGTH, isValidChargeCode } from './station-charge-code.util';
|
|
9
|
+
export {
|
|
10
|
+
CONNECTOR_STANDARD_PAIRS,
|
|
11
|
+
ConnectorStandardPair,
|
|
12
|
+
connectorStandardLabel,
|
|
13
|
+
ocpiStandardForOwnedType,
|
|
14
|
+
ownedTypeForOcpiStandard,
|
|
15
|
+
plugMatchForStandard,
|
|
16
|
+
} from './connector-standard.util';
|
|
9
17
|
export {
|
|
10
18
|
MAX_PARTNER_SHARE_PERCENT,
|
|
11
19
|
PARTNER_SHARE_CAP_ERROR,
|