UNPKG

angular-odata

Version:

Client side OData typescript library for Angular

36 lines 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ODataMetadata = void 0; const csdl_reference_1 = require("./csdl/csdl-reference"); const csdl_schema_1 = require("./csdl/csdl-schema"); class ODataMetadata { constructor(Version, References, Schemas) { this.Version = Version; this.References = References === null || References === void 0 ? void 0 : References.map((r) => new csdl_reference_1.CsdlReference(r)); this.Schemas = Schemas === null || Schemas === void 0 ? void 0 : Schemas.map((s) => new csdl_schema_1.CsdlSchema(s)); } toJson() { return { Version: this.Version, References: this.References.map((r) => r.toJson()), Schemas: this.Schemas.map((s) => s.toJson()), }; } functions() { return this.Schemas.reduce((acc, s) => { var _a; return [...acc, ...((_a = s.Function) !== null && _a !== void 0 ? _a : [])]; }, []); } actions() { return this.Schemas.reduce((acc, s) => { var _a; return [...acc, ...((_a = s.Action) !== null && _a !== void 0 ? _a : [])]; }, []); } static fromJson(json) { return new ODataMetadata(json.Version, json.References, json.Schemas); } } exports.ODataMetadata = ODataMetadata; //# sourceMappingURL=metadata.js.map