angular-odata
Version:
Client side OData typescript library for Angular
63 lines • 3.81 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CsdlSchema = void 0;
const csdl_annotation_1 = require("./csdl-annotation");
const csdl_type_definition_1 = require("./csdl-type-definition");
const csdl_enum_type_1 = require("./csdl-enum-type");
const csdl_structured_type_1 = require("./csdl-structured-type");
const csdl_function_action_1 = require("./csdl-function-action");
const csdl_entity_container_1 = require("./csdl-entity-container");
class CsdlSchema {
constructor({ Namespace, Alias, EnumType, ComplexType, EntityType, Function, Action, EntityContainer, TypeDefinition, Term, Annotations, }) {
this.Namespace = Namespace;
this.Alias = Alias;
this.EnumType = EnumType === null || EnumType === void 0 ? void 0 : EnumType.map((e) => new csdl_enum_type_1.CsdlEnumType(this, e));
this.ComplexType = ComplexType === null || ComplexType === void 0 ? void 0 : ComplexType.map((c) => new csdl_structured_type_1.CsdlComplexType(this, c));
this.EntityType = EntityType === null || EntityType === void 0 ? void 0 : EntityType.map((e) => new csdl_structured_type_1.CsdlEntityType(this, e));
this.Function = Function === null || Function === void 0 ? void 0 : Function.map((f) => new csdl_function_action_1.CsdlFunction(this, f));
this.Action = Action === null || Action === void 0 ? void 0 : Action.map((a) => new csdl_function_action_1.CsdlAction(this, a));
this.EntityContainer = EntityContainer === null || EntityContainer === void 0 ? void 0 : EntityContainer.map((e) => new csdl_entity_container_1.CsdlEntityContainer(this, e));
this.TypeDefinition = TypeDefinition === null || TypeDefinition === void 0 ? void 0 : TypeDefinition.map((t) => new csdl_type_definition_1.CsdlTypeDefinition(this, t));
this.Term = Term === null || Term === void 0 ? void 0 : Term.map((t) => new csdl_annotation_1.CsdlTerm(this, t));
this.Annotations = Annotations === null || Annotations === void 0 ? void 0 : Annotations.map((a) => new csdl_annotation_1.CsdlAnnotations(this, a));
}
toJson() {
const json = {
Namespace: this.Namespace,
};
if (this.Alias !== undefined) {
json['Alias'] = this.Alias;
}
if (Array.isArray(this.EntityContainer) &&
this.EntityContainer.length > 0) {
json['EntityContainer'] = this.EntityContainer.map((a) => a.toJson());
}
if (Array.isArray(this.EntityType) && this.EntityType.length > 0) {
json['EntityType'] = this.EntityType.map((a) => a.toJson());
}
if (Array.isArray(this.ComplexType) && this.ComplexType.length > 0) {
json['ComplexType'] = this.ComplexType.map((a) => a.toJson());
}
if (Array.isArray(this.EnumType) && this.EnumType.length > 0) {
json['EnumType'] = this.EnumType.map((a) => a.toJson());
}
if (Array.isArray(this.TypeDefinition) && this.TypeDefinition.length > 0) {
json['TypeDefinition'] = this.TypeDefinition.map((a) => a.toJson());
}
if (Array.isArray(this.Term) && this.Term.length > 0) {
json['Term'] = this.Term.map((a) => a.toJson());
}
if (Array.isArray(this.Annotations) && this.Annotations.length > 0) {
json['Annotations'] = this.Annotations.map((a) => a.toJson());
}
if (Array.isArray(this.Action) && this.Action.length > 0) {
json['Action'] = this.Action.map((a) => a.toJson());
}
if (Array.isArray(this.Function) && this.Function.length > 0) {
json['Function'] = this.Function.map((a) => a.toJson());
}
return json;
}
}
exports.CsdlSchema = CsdlSchema;
//# sourceMappingURL=csdl-schema.js.map