@citrineos/data
Version:
The OCPP data module which includes all persistence layer implementation.
90 lines • 5.51 kB
JavaScript
;
// Copyright (c) 2023 S44, LLC
// Copyright Contributors to the CitrineOS Project
//
// SPDX-License-Identifier: Apache 2.0
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SendLocalList = void 0;
const base_1 = require("@citrineos/base");
const sequelize_typescript_1 = require("sequelize-typescript");
const SendLocalListAuthorization_1 = require("./SendLocalListAuthorization");
const LocalListAuthorization_1 = require("./LocalListAuthorization");
const BaseModelWithTenant_1 = require("../BaseModelWithTenant");
let SendLocalList = class SendLocalList extends BaseModelWithTenant_1.BaseModelWithTenant {
toSendLocalListRequest() {
return {
versionNumber: this.versionNumber,
updateType: this.updateType,
localAuthorizationList: !(this.localAuthorizationList && this.localAuthorizationList[0])
? null
: this.localAuthorizationList.map((localListAuth) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
return {
idToken: {
idToken: localListAuth.idToken.idToken,
type: localListAuth.idToken.type,
additionalInfo: (_a = localListAuth.idToken.additionalInfo) === null || _a === void 0 ? void 0 : _a.map((additionalInfo) => {
return {
additionalIdToken: additionalInfo.additionalIdToken,
type: additionalInfo.type,
};
}),
},
idTokenInfo: {
status: (_b = localListAuth.idTokenInfo) === null || _b === void 0 ? void 0 : _b.status,
cacheExpiryDateTime: (_c = localListAuth.idTokenInfo) === null || _c === void 0 ? void 0 : _c.cacheExpiryDateTime,
chargingPriority: (_d = localListAuth.idTokenInfo) === null || _d === void 0 ? void 0 : _d.chargingPriority,
language1: (_e = localListAuth.idTokenInfo) === null || _e === void 0 ? void 0 : _e.language1,
groupIdToken: {
idToken: (_g = (_f = localListAuth.idTokenInfo) === null || _f === void 0 ? void 0 : _f.groupIdToken) === null || _g === void 0 ? void 0 : _g.idToken,
type: (_j = (_h = localListAuth.idTokenInfo) === null || _h === void 0 ? void 0 : _h.groupIdToken) === null || _j === void 0 ? void 0 : _j.type,
additionalInfo: (_m = (_l = (_k = localListAuth.idTokenInfo) === null || _k === void 0 ? void 0 : _k.groupIdToken) === null || _l === void 0 ? void 0 : _l.additionalInfo) === null || _m === void 0 ? void 0 : _m.map((additionalInfo) => {
return {
additionalIdToken: additionalInfo.additionalIdToken,
type: additionalInfo.type,
};
}),
},
language2: (_o = localListAuth.idTokenInfo) === null || _o === void 0 ? void 0 : _o.language2,
personalMessage: (_p = localListAuth.idTokenInfo) === null || _p === void 0 ? void 0 : _p.personalMessage,
},
};
}),
};
}
};
exports.SendLocalList = SendLocalList;
SendLocalList.MODEL_NAME = base_1.OCPP2_0_1_Namespace.SendLocalListRequest;
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], SendLocalList.prototype, "stationId", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], SendLocalList.prototype, "correlationId", void 0);
__decorate([
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.INTEGER),
__metadata("design:type", Number)
], SendLocalList.prototype, "versionNumber", void 0);
__decorate([
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.STRING),
__metadata("design:type", String)
], SendLocalList.prototype, "updateType", void 0);
__decorate([
(0, sequelize_typescript_1.BelongsToMany)(() => LocalListAuthorization_1.LocalListAuthorization, () => SendLocalListAuthorization_1.SendLocalListAuthorization),
__metadata("design:type", Object)
], SendLocalList.prototype, "localAuthorizationList", void 0);
exports.SendLocalList = SendLocalList = __decorate([
sequelize_typescript_1.Table
], SendLocalList);
//# sourceMappingURL=SendLocalList.js.map