@chix/flow
Version:
92 lines • 3.2 kB
JavaScript
;
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("../util");
function $Identity(Base) {
return (function (_super) {
__extends(Identity$, _super);
function Identity$() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var _this = _super.apply(this, __spread(args)) || this;
_this.provider = '';
_this.ns = '';
_this.name = '';
_this.type = 'Undefined';
var _a = util_1.getNodeArgument(args), id = _a.id, node = _a.node;
if (!id) {
throw Error("Node id is required.");
}
if (!node.ns) {
throw Error("Node ns is required.");
}
if (!node.name) {
throw Error("Node name is required.");
}
if (!node.type) {
throw Error("Node type is required.");
}
_this.id = id;
_this.name = node.name;
_this.ns = node.ns;
_this.type = node.type;
if (node.provider) {
_this.provider = node.provider;
}
return _this;
}
Object.defineProperty(Identity$.prototype, "identifier", {
get: function () {
return this._identifier || this.ns + ":" + this.name;
},
set: function (value) {
this._identifier = value;
},
enumerable: true,
configurable: true
});
return Identity$;
}(Base));
}
exports.$Identity = $Identity;
(function ($Identity) {
function create(Base) {
return util_1.mixin($Identity)(Base);
}
$Identity.create = create;
})($Identity = exports.$Identity || (exports.$Identity = {}));
//# sourceMappingURL=identity.js.map