UNPKG

2.74 kBJavaScriptView Raw
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 };
9 return function (d, b) {
10 if (typeof b !== "function" && b !== null)
11 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12 extendStatics(d, b);
13 function __() { this.constructor = d; }
14 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 };
16})();
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.CollectionField = void 0;
19var field_1 = require("./field");
20var complex_type_field_1 = require("./complex-type-field");
21/**
22 * Represents a field of an entity or a complex type, that can have a collection as value.
23 * @typeparam EntityT - Type of the entity the field belongs to.
24 * @typeparam CollectionFieldT - Type of of elements of the collection. This can either be an EDM type or complex type.
25 * @typeparam NullableT - Boolean type that represents whether the field is nullable.
26 * @typeparam SelectableT - Boolean type that represents whether the field is selectable.
27 */
28var CollectionField = /** @class */ (function (_super) {
29 __extends(CollectionField, _super);
30 /**
31 * Creates an instance of CollectionField.
32 * @param fieldName - Actual name of the field used in the OData request.
33 * @param _fieldOf - The constructor of the entity or the complex type field this field belongs to.
34 * @param _fieldType - Edm type of the field according to the metadata description.
35 * @param fieldOptions - Optional settings for this field.
36 */
37 function CollectionField(fieldName, _fieldOf, _fieldType, fieldOptions) {
38 var _this = _super.call(this, fieldName, complex_type_field_1.getEntityConstructor(_fieldOf), fieldOptions) || this;
39 _this._fieldOf = _fieldOf;
40 _this._fieldType = _fieldType;
41 return _this;
42 }
43 /**
44 * Gets the path to the complex type property represented by this.
45 * @returns The path to the complex type property.
46 */
47 CollectionField.prototype.fieldPath = function () {
48 return this._fieldOf instanceof complex_type_field_1.ComplexTypeField
49 ? this._fieldOf.fieldPath() + "/" + this._fieldName
50 : this._fieldName;
51 };
52 return CollectionField;
53}(field_1.Field));
54exports.CollectionField = CollectionField;
55//# sourceMappingURL=collection-field.js.map
\No newline at end of file