UNPKG

unifi-client

Version:

NodeJs client for Unifi products (https://www.ui.com/)

89 lines (88 loc) 3.68 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); exports._ObjectSubSite = void 0; var _ObjectSubController_1 = require("./_ObjectSubController"); var Errors_1 = require("../Errors"); var util_1 = require("../util"); var _ObjectSubSite = /** @class */ (function (_super) { __extends(_ObjectSubSite, _super); function _ObjectSubSite(config) { var _a; var _this = _super.call(this, __assign(__assign({}, config), { instance: (_a = config === null || config === void 0 ? void 0 : config.controller) === null || _a === void 0 ? void 0 : _a.controllerInstance })) || this; if (!config.site) { throw new Errors_1.ClientError('ObjectSubSite not correctly initialized'); } _this.site = config.site; _this.debug = (0, util_1.createDebugger)('_ObjectSubSite'); return _this; } Object.defineProperty(_ObjectSubSite.prototype, "instance", { get: function () { return this.site.getInstance(); }, enumerable: false, configurable: true }); Object.defineProperty(_ObjectSubSite.prototype, "config", { // this functions are here to delete this value from rest(...) or JSON get: function () { return this.getPrivate('config'); }, set: function (value) { this.setPrivate('config', value); }, enumerable: false, configurable: true }); // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-unused-vars _ObjectSubSite.prototype.import = function (props) { return this; }; // toJSON(): Record<string, any> { // const obj = { ...this }; // //remove circular known parts // delete obj._site; // delete obj._instance; // delete obj._controller; // delete obj._config; // // return obj; // } // /** * @param constructor - the construtor to map the object * @param object - the properties passed to the constructor if defined */ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types _ObjectSubSite.prototype.mapObject = function (constructor, object) { return !object ? object : new constructor(this.config, object); }; return _ObjectSubSite; }(_ObjectSubController_1._ObjectSubController)); exports._ObjectSubSite = _ObjectSubSite;