UNPKG

@odata2ts/odata-service

Version:

Main runtime dependency of odata2ts for generated odata client services

35 lines 1.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ServiceStateHelperV4 = void 0; const odata_query_builder_1 = require("@odata2ts/odata-query-builder"); const odata_query_objects_1 = require("@odata2ts/odata-query-objects"); const ServiceStateHelper_js_1 = require("../ServiceStateHelper.js"); class ServiceStateHelperV4 extends ServiceStateHelper_js_1.ServiceStateHelper { constructor(client, basePath, name, qModel, options) { super(client, basePath, name, options); this.qModel = qModel; this.applyQueryBuilder = (queryFn) => { if (queryFn) { const builder = (0, odata_query_builder_1.createQueryBuilderV4)(this.path, this.qModel, { unencoded: this.isUrlNotEncoded() }); queryFn(builder, this.qModel); return builder.build(); } return this.path; }; this.qResponseType = new odata_query_objects_1.QComplexParam("NONE", qModel); } evaluateSubtypeOptions(options) { const isSubtype = !!this.options.subtype; const dontUseCastPathSegment = isSubtype && !(options === null || options === void 0 ? void 0 : options.withCastPathSegment); return { dontUseCastPathSegment, useTypeCi: (isSubtype && dontUseCastPathSegment && (options === null || options === void 0 ? void 0 : options.withTypeControlInfo) !== false) || (isSubtype && (options === null || options === void 0 ? void 0 : options.withTypeControlInfo)), }; } addTypeControlInfo(model) { return Object.assign({ "@odata.type": `#${this.name}` }, model); } } exports.ServiceStateHelperV4 = ServiceStateHelperV4; //# sourceMappingURL=ServiceStateHelperV4.js.map