@sap-ux/store
Version:
NPM module for storing persistent data
109 lines • 3.9 kB
JavaScript
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);
};
import { getSensitiveDataProperties, sensitiveData, serializable } from '../decorators/index.js';
import { hasAnyValue } from '../utils/index.js';
export class BackendSystem {
name;
url;
client;
userDisplayName;
systemType;
connectionType;
authenticationType;
hasSensitiveData;
systemInfo;
serviceKeys;
refreshToken;
username;
password;
constructor({ name, url, client, systemType, serviceKeys, refreshToken, username, password, userDisplayName, authenticationType, connectionType, systemInfo }) {
this.name = name;
this.url = url;
this.client = client;
this.systemType = systemType;
this.serviceKeys = serviceKeys;
this.refreshToken = refreshToken;
this.username = username;
this.password = password;
this.userDisplayName = userDisplayName;
this.authenticationType = authenticationType;
this.connectionType = connectionType;
const sensitiveProps = getSensitiveDataProperties(this);
this.hasSensitiveData = hasAnyValue(this, sensitiveProps);
this.systemInfo = systemInfo;
}
}
__decorate([
serializable,
__metadata("design:type", String)
], BackendSystem.prototype, "name", void 0);
__decorate([
serializable,
__metadata("design:type", String)
], BackendSystem.prototype, "url", void 0);
__decorate([
serializable,
__metadata("design:type", String)
], BackendSystem.prototype, "client", void 0);
__decorate([
serializable,
__metadata("design:type", String)
], BackendSystem.prototype, "userDisplayName", void 0);
__decorate([
serializable,
__metadata("design:type", String)
], BackendSystem.prototype, "systemType", void 0);
__decorate([
serializable,
__metadata("design:type", String)
], BackendSystem.prototype, "connectionType", void 0);
__decorate([
serializable,
__metadata("design:type", String)
], BackendSystem.prototype, "authenticationType", void 0);
__decorate([
serializable,
__metadata("design:type", Boolean)
], BackendSystem.prototype, "hasSensitiveData", void 0);
__decorate([
serializable,
__metadata("design:type", Object)
], BackendSystem.prototype, "systemInfo", void 0);
__decorate([
sensitiveData,
__metadata("design:type", Object)
], BackendSystem.prototype, "serviceKeys", void 0);
__decorate([
sensitiveData,
__metadata("design:type", String)
], BackendSystem.prototype, "refreshToken", void 0);
__decorate([
sensitiveData,
__metadata("design:type", String)
], BackendSystem.prototype, "username", void 0);
__decorate([
sensitiveData,
__metadata("design:type", String)
], BackendSystem.prototype, "password", void 0);
export class BackendSystemKey {
url;
client;
static from(system) {
return new BackendSystemKey({ url: system.url, client: system.client });
}
constructor({ url, client }) {
this.url = url.trim().replace(/\/$/, '');
this.client = client?.trim();
}
getId() {
return this.url + `${this.client ? '/' + this.client : ''}`;
}
}
//# sourceMappingURL=backend-system.js.map