language
stringclasses 5
values | text
stringlengths 15
988k
|
---|---|
JavaScript | class Controller {
/**
* Constructor.
* @param {!angular.Scope} $scope
* @param {!angular.JQLite} $element
* @ngInject
*/
constructor($scope, $element) {
/**
* @type {string}
* @private
*/
this.appName_ = /** @type {string} */ (config.getAppName('the application'));
/**
* @type {ITreeNode}
* @protected
*/
this.root = this.initRoot();
/**
* @type {Delay}
* @private
*/
this.searchDelay_ = new Delay(this.onSearch_, 250, this);
/**
* @type {?angular.JQLite}
* @protected
*/
this.element = $element;
/**
* @type {?angular.Scope}
* @protected
*/
this.scope = $scope;
/**
* Filter function
* @type {?function(ITreeNode):boolean}
* @protected
*/
this.filterFunc = $scope['filter'] || null;
this['term'] = '';
this['views'] = this.getGroupBys();
var viewKey = /** @type {string} */ (Settings.getInstance().get(['addData', 'groupBy'], 'Source'));
this['view'] = this.getGroupBys()[viewKey];
/**
* @type {TreeSearch}
* @protected
*/
this.treeSearch = this.initTreeSearch();
this.treeSearch.setFilterFunction(this.filterFunc);
$scope.$on('$destroy', this.onDestroy.bind(this));
var timeout = /** @type {angular.$timeout} */ (ui.injector.get('$timeout'));
timeout(function() {
$element.find('.js-input-search').focus();
});
this.search();
}
/**
* Initializes the tree search.
*
* @return {!TreeSearch}
* @protected
*/
initTreeSearch() {
return new TreeSearch([], 'providers', this.scope);
}
/**
* Initializes the tree root node.
*
* @return {!ITreeNode}
* @protected
*/
initRoot() {
var root = DataManager.getInstance().getProviderRoot();
root.listen(GoogEventType.PROPERTYCHANGE, this.onChildrenChanged, false, this);
return root;
}
/**
* Apply a filter function and re-run search
*
* @param {?function(ITreeNode):boolean} filterFunc
*/
setFilterFunction(filterFunc) {
this.treeSearch.setFilterFunction(filterFunc);
this.search();
}
/**
* The view options for choosing layers
*
* @return {!Object<string, ?INodeGroupBy>}
*/
getGroupBys() {
return {};
}
/**
* on kaput
*
* @protected
*/
onDestroy() {
this.searchDelay_.dispose();
this.searchDelay_ = null;
this.root.unlisten(GoogEventType.PROPERTYCHANGE, this.onChildrenChanged, false, this);
this.root = null;
this.treeSearch = null;
this.scope = null;
this.element = null;
}
/**
* Close the window
*
* @export
*/
close() {
osWindow.close(this.element);
}
/**
* Check if the base tree is empty (no providers are present).
*
* @return {boolean}
* @export
*/
isTreeEmpty() {
return this.treeSearch.getSearch().length == 0;
}
/**
* Handles updates to the tree
*
* @param {PropertyChangeEvent} e
* @protected
*/
onChildrenChanged(e) {
if (e.getProperty() == 'children') {
this.search();
} else {
ui.apply(this.scope);
}
}
/**
* Starts a search
*
* @export
*/
search() {
if (this.root && this.treeSearch && this.searchDelay_) {
var list = this.root.getChildren() || [];
this.treeSearch.setSearch(/** @type {!Array<!SlickTreeNode>} */ (list.filter(
Controller.listFilter_)));
this.searchDelay_.start();
Metrics.getInstance().updateMetric(keys.AddData.SEARCH, 1);
}
}
/**
* Handles group by selection change
*
* @export
*/
onGroupByChanged() {
Metrics.getInstance().updateMetric(keys.AddData.GROUP_BY, 1);
this.search();
}
/**
* Clears the search
*
* @export
*/
clearSearch() {
this['term'] = '';
this.search();
this.element.find('.search').focus();
}
/**
* Handles the search timer
*
* @private
*/
onSearch_() {
var t = this['term'];
// save the view option
var views = this.getGroupBys();
for (var key in views) {
if (views[key] === this['view']) {
Settings.getInstance().set(['addData', 'groupBy'], key);
break;
}
}
// do the search
this.treeSearch.beginSearch(t, this['view'] == -1 ? null : this['view']);
ui.apply(this.scope);
}
/**
* Get the content for the info panel
*
* @return {string}
* @export
*/
getInfo() {
if (this.isTreeEmpty()) {
return 'No data available. Click the Import File/URL button above to import data into ' + this.appName_ + '.';
}
var node = this.scope['selected'];
if (Array.isArray(node) && node.length == 1) {
node = node[0];
}
if (node instanceof SlickTreeNode) {
var text = '';
if (node instanceof DescriptorNode) {
// descriptors provide an HTML description
var d = /** @type {DescriptorNode} */ (node).getDescriptor();
if (d) {
text += d.getHtmlDescription();
}
} else if (node instanceof BaseProvider) {
// providers can provide directives
// these strings should be provided entirely by us, and so therefore are NOT sanitized to allow compilation
return node.getInfo();
}
if (!text) {
// the fallback, just get the tooltip
text = node.getToolTip();
}
if (!text) {
text = 'No description provided.';
}
if (text) {
Metrics.getInstance().updateMetric(keys.AddData.GET_INFO, 1);
return ui.sanitize(googString.newLineToBr(text));
}
}
return 'Select an item on the left to see more information.';
}
/**
* @param {SlickTreeNode} item
* @param {number} i
* @param {Array} arr
* @return {boolean}
*/
static listFilter_(item, i, arr) {
if (item.getEnabled()) {
try {
// show providers that are in a loading state
if (osImplements(item, ILoadingProvider.ID)) {
/** @type {ILoadingProvider} */ (item).isLoading();
return true;
}
} catch (e) {
// not a loading provider
}
// exclude providers without children so users don't think they can do something with them (unless flagged)
if (Controller.itemHasChildren_(item)) {
return true;
} else {
return Controller.showWhenEmpty_(item);
}
}
return false;
}
/**
* Check if the item should be shown even if empty.
*
* @param {SlickTreeNode} item
* @return {boolean} if should be shown even when empty
*/
static showWhenEmpty_(item) {
if (osImplements(item, IDataProvider.ID)) {
var dataProviderItem = /** @type {IDataProvider} */ (item);
return dataProviderItem.getShowWhenEmpty();
}
return false;
}
/**
* Check if a tree node has child nodes.
*
* @param {SlickTreeNode} item
* @return {boolean}
*/
static itemHasChildren_(item) {
var children = item.getChildren();
return (!!children && children.length > 0);
}
} |
JavaScript | class FatSynthesisElement extends LitElement {
/**
* Store the tag name to make it easier to obtain directly.
* @notice function name must be here for tooling to operate correctly
*/
tag() {
return "fat-synthesis-element";
}
static get properties() {
return {
gsapCDN: { type: String, attribute: "gsap-cdn" }
};
}
// life cycle
constructor() {
super();
this.gsapCDN =
"https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js";
this.__tl = null;
this.__tl2 = null;
}
/**
* life cycle, element is afixed to the DOM
*/
connectedCallback() {
super.connectedCallback();
// Import cdn
}
firstUpdated() {
import(this.gsapCDN).then(() => {
var root = this;
var tl = new TimelineMax();
var svg = this.shadowRoot.querySelector("#elements");
var watertop = svg.getElementById("watertop");
var watermiddle = svg.getElementById("watermiddle");
var waterbottom = svg.getElementById("waterbottom");
var triacylglyceride = svg.getElementById("triacylglyceride");
var blocktop = svg.getElementById("blocktop");
var blockmiddle = svg.getElementById("blockmiddle");
var blockbottom = svg.getElementById("blockbottom");
var olinestop = svg.getElementById("olinestop");
var olinesmiddle = svg.getElementById("olinesmiddle");
var olinesbottom = svg.getElementById("olinesbottom");
var topoh = svg.getElementById("topoh");
var middleoh = svg.getElementById("middleoh");
var bottomoh = svg.getElementById("bottomoh");
var esterlinkage = svg.getElementById("esterlinkage");
var toph = svg.getElementById("toph");
var middleh = svg.getElementById("middleh");
var bottomh = svg.getElementById("bottomh");
var glycerol = svg.getElementById("glycerol");
var fattyacid = svg.getElementById("fattyacid");
var otop = svg.getElementById("otop");
var omiddle = svg.getElementById("omiddle");
var obottom = svg.getElementById("obottom");
// Set Animate
tl.set(
[watertop, watermiddle, waterbottom, triacylglyceride, esterlinkage],
{
alpha: 0
}
);
//Animate
tl.to(
[
topoh,
middleoh,
bottomoh,
blocktop,
blockmiddle,
blockbottom,
olinestop,
olinesmiddle,
olinesbottom
],
1,
{
x: "-=75",
ease: Power2.easeOut
}
);
tl.to([toph, middleh, bottomh], 1, {
y: "+=21"
});
tl.to([topoh, middleoh, bottomoh, toph, middleh, bottomh], 1, {
y: "+=70",
x: "+=80",
alpha: 0
});
tl.set([watertop, watermiddle, waterbottom], {
alpha: 1
});
tl.to([olinestop, olinesmiddle, olinesbottom], 1, {
rotation: "+=48",
y: "-=12",
x: "+=10"
});
tl.to(
[topoh, middleoh, bottomoh, blocktop, blockmiddle, blockbottom],
1,
{
x: "-=15",
ease: Power2.easeOut
}
);
tl.set([glycerol, fattyacid], {
alpha: 0
});
tl.set([triacylglyceride], {
alpha: 1
});
tl.to([esterlinkage], 1, {
x: "-=72",
alpha: 1
});
tl.pause();
this.__tl = tl;
});
}
renderSVG() {
return svg`
<svg id="elements" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 630.51 577.96">
<defs>
<clipPath id="clip-path">
<rect x="206.06" y="444.07" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-2">
<rect x="587.56" y="443.22" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-3">
<rect x="253.01" y="445.67" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-4">
<rect x="253.01" y="478.07" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-5">
<rect x="253.01" y="413.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-6">
<rect x="276.51" y="461.07" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-7">
<rect x="276.51" y="493.47" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-8">
<rect x="276.51" y="428.67" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-9">
<rect x="300.81" y="444.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-10">
<rect x="300.81" y="477.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-11">
<rect x="300.81" y="412.47" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-12">
<rect x="324.31" y="460.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-13">
<rect x="324.31" y="492.67" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-14">
<rect x="324.31" y="427.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-15">
<rect x="352.66" y="444.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-16">
<rect x="352.66" y="477.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-17">
<rect x="352.66" y="412.47" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-18">
<rect x="376.16" y="460.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-19">
<rect x="376.16" y="492.67" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-20">
<rect x="376.16" y="427.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-21">
<rect x="399.66" y="444.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-22">
<rect x="399.66" y="477.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-23">
<rect x="399.66" y="412.47" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-24">
<rect x="423.11" y="460.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-25">
<rect x="423.11" y="492.67" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-26">
<rect x="423.11" y="427.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-27">
<rect x="447.41" y="444.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-28">
<rect x="447.41" y="477.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-29">
<rect x="447.41" y="412.47" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-30">
<rect x="470.91" y="460.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-31">
<rect x="470.91" y="492.67" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-32">
<rect x="470.91" y="427.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-33">
<rect x="496.01" y="444.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-34">
<rect x="496.01" y="477.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-35">
<rect x="496.01" y="412.47" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-36">
<rect x="519.51" y="460.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-37">
<rect x="519.51" y="492.67" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-38">
<rect x="519.51" y="427.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-39">
<rect x="543.01" y="444.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-40">
<rect x="543.01" y="477.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-41">
<rect x="543.01" y="412.47" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-42">
<rect x="566.51" y="460.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-43">
<rect x="566.51" y="492.67" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-44">
<rect x="566.51" y="427.87" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-45">
<rect x="228.71" y="460.27" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-46">
<rect x="228.71" y="492.67" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-47">
<rect x="228.71" y="426.22" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-48">
<rect x="206.06" y="263.76" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-49">
<rect x="587.56" y="262.91" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-50">
<rect x="253.01" y="265.36" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-51">
<rect x="253.01" y="297.76" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-52">
<rect x="253.01" y="232.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-53">
<rect x="276.51" y="280.76" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-54">
<rect x="276.51" y="313.16" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-55">
<rect x="276.51" y="248.36" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-56">
<rect x="300.81" y="264.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-57">
<rect x="300.81" y="296.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-58">
<rect x="300.81" y="232.16" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-59">
<rect x="324.31" y="279.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-60">
<rect x="324.31" y="312.36" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-61">
<rect x="324.31" y="247.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-62">
<rect x="352.66" y="264.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-63">
<rect x="352.66" y="296.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-64">
<rect x="352.66" y="232.16" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-65">
<rect x="376.16" y="279.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-66">
<rect x="376.16" y="312.36" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-67">
<rect x="376.16" y="247.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-68">
<rect x="399.66" y="264.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-69">
<rect x="399.66" y="296.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-70">
<rect x="399.66" y="232.16" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-71">
<rect x="423.11" y="279.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-72">
<rect x="423.11" y="312.36" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-73">
<rect x="423.11" y="247.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-74">
<rect x="447.41" y="264.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-75">
<rect x="447.41" y="296.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-76">
<rect x="447.41" y="232.16" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-77">
<rect x="470.91" y="279.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-78">
<rect x="470.91" y="312.36" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-79">
<rect x="470.91" y="247.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-80">
<rect x="496.01" y="264.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-81">
<rect x="496.01" y="296.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-82">
<rect x="496.01" y="232.16" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-83">
<rect x="519.51" y="279.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-84">
<rect x="519.51" y="312.36" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-85">
<rect x="519.51" y="247.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-86">
<rect x="543.01" y="264.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-87">
<rect x="543.01" y="296.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-88">
<rect x="543.01" y="232.16" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-89">
<rect x="566.51" y="279.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-90">
<rect x="566.51" y="312.36" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-91">
<rect x="566.51" y="247.56" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-92">
<rect x="228.71" y="279.96" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-93">
<rect x="228.71" y="312.36" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-94">
<rect x="228.71" y="245.91" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-95">
<rect x="206.06" y="84.13" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-96">
<rect x="587.56" y="83.28" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-97">
<rect x="253.01" y="85.73" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-98">
<rect x="253.01" y="118.13" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-99">
<rect x="253.01" y="53.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-100">
<rect x="276.51" y="101.13" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-101">
<rect x="276.51" y="133.53" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-102">
<rect x="276.51" y="68.73" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-103">
<rect x="300.81" y="84.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-104">
<rect x="300.81" y="117.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-105">
<rect x="300.81" y="52.53" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-106">
<rect x="324.31" y="100.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-107">
<rect x="324.31" y="132.73" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-108">
<rect x="324.31" y="67.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-109">
<rect x="352.66" y="84.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-110">
<rect x="352.66" y="117.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-111">
<rect x="352.66" y="52.53" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-112">
<rect x="376.16" y="100.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-113">
<rect x="376.16" y="132.73" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-114">
<rect x="376.16" y="67.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-115">
<rect x="399.66" y="84.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-116">
<rect x="399.66" y="117.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-117">
<rect x="399.66" y="52.53" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-118">
<rect x="423.11" y="100.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-119">
<rect x="423.11" y="132.73" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-120">
<rect x="423.11" y="67.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-121">
<rect x="447.41" y="84.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-122">
<rect x="447.41" y="117.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-123">
<rect x="447.41" y="52.53" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-124">
<rect x="470.91" y="100.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-125">
<rect x="470.91" y="132.73" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-126">
<rect x="470.91" y="67.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-127">
<rect x="496.01" y="84.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-128">
<rect x="496.01" y="117.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-129">
<rect x="496.01" y="52.53" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-130">
<rect x="519.51" y="100.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-131">
<rect x="519.51" y="132.73" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-132">
<rect x="519.51" y="67.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-133">
<rect x="543.01" y="84.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-134">
<rect x="543.01" y="117.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-135">
<rect x="543.01" y="52.53" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-136">
<rect x="566.51" y="100.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-137">
<rect x="566.51" y="132.73" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-138">
<rect x="566.51" y="67.93" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-139">
<rect x="228.71" y="100.33" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-140">
<rect x="228.71" y="132.73" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-141">
<rect x="228.71" y="66.28" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-142">
<rect x="175.03" y="466.09" width="21.24" height="16.64" fill="none" />
</clipPath>
<clipPath id="clip-path-143">
<rect x="175.03" y="285.78" width="21.24" height="16.64" fill="none" />
</clipPath>
<clipPath id="clip-path-144">
<rect x="175.03" y="106.15" width="21.24" height="16.64" fill="none" />
</clipPath>
<clipPath id="clip-path-145">
<rect x="52.96" y="444.83" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-146">
<rect x="52.51" y="471.38" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-147">
<rect x="28.31" y="444.58" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-148">
<rect x="53.01" y="264.07" width="12.15" height="16.9" fill="none" />
</clipPath>
<clipPath id="clip-path-149">
<rect x="28.26" y="264.07" width="12.15" height="16.9" fill="none" />
</clipPath>
<clipPath id="clip-path-150">
<rect x="52.46" y="84.58" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-151">
<rect x="52.91" y="59.43" width="12.15" height="16.85" fill="none" />
</clipPath>
<clipPath id="clip-path-152">
<rect x="27.36" y="84.58" width="12.15" height="16.85" fill="none" />
</clipPath>
</defs>
<title>fat_synthesis-1</title>
<g id="blockbottom">
<path id="Symbol_12_0_Layer0_0_1_STROKES" data-name="Symbol 12 0 Layer0 0 1 STROKES" d="M406.13,445.69V427m47.8,18.65V427m48.6,18.65V427m47,18.65V427M573,494.29V475.64m-47,18.65V475.64m-48.6,18.65V475.64m-47.75,18.65V475.64m-7.3-10.55-9.7-8.9m-6.5,22.7V460.24m159.55,4.85-9.7-8.9m17,5.7V443.24m15.4,12.95-8.9,9.75m-94.8-.85,9.75-8.9m-17.05,5.7V443.24m-47.75,18.65V443.24m40.5,21.85-9.75-8.9m-24.3,8.9,9.75-8.9m8.1,22.7V460.24M526,461.89V443.24m5.7,21.85,9.7-8.9m-22.65,8.9-9.75-8.9m40.5,22.7V460.24m-47,18.65V460.24m-267.3-.8V440.79m24.3,5.7V427.84m47.8,17.85V427m23.45,34v-18.6m28.35,3.25V427m23.5,34v-18.6m0,51.85V475.64m-51.85,18.65V475.64M283,495.09V476.44m-47.8,17.85V475.64m54.25-10.55,9.75-8.9m42.1,8.9,9.7-8.9m-27.5,8.9-9.75-8.9m45.35,22.7V460.24m-51.8,18.65V460.24m81,4.85,9.7-8.9m-22.7,8.9-9.7-8.9m-147.4,0,8.9,9.75m55.9-4V443.24m-7.3,22.7L266,457m-24.3,8.95,9.75-8.95m8.1,22.7V461"
fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
<g clip-path="url(#clip-path)">
<g style="isolation:isolate">
<text transform="translate(207.68 456.71)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-2)">
<g style="isolation:isolate">
<text transform="translate(589.18 455.86)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-3)">
<g style="isolation:isolate">
<text transform="translate(254.63 458.31)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-4)">
<g style="isolation:isolate">
<text transform="translate(254.63 490.71)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-5)">
<g style="isolation:isolate">
<text transform="translate(254.63 425.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-6)">
<g style="isolation:isolate">
<text transform="translate(278.13 473.71)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-7)">
<g style="isolation:isolate">
<text transform="translate(278.13 506.11)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-8)">
<g style="isolation:isolate">
<text transform="translate(278.13 441.31)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-9)">
<g style="isolation:isolate">
<text transform="translate(302.43 457.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-10)">
<g style="isolation:isolate">
<text transform="translate(302.43 489.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-11)">
<g style="isolation:isolate">
<text transform="translate(302.43 425.11)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-12)">
<g style="isolation:isolate">
<text transform="translate(325.93 472.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-13)">
<g style="isolation:isolate">
<text transform="translate(325.93 505.31)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-14)">
<g style="isolation:isolate">
<text transform="translate(325.93 440.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-15)">
<g style="isolation:isolate">
<text transform="translate(354.28 457.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-16)">
<g style="isolation:isolate">
<text transform="translate(354.28 489.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-17)">
<g style="isolation:isolate">
<text transform="translate(354.28 425.11)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-18)">
<g style="isolation:isolate">
<text transform="translate(377.78 472.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-19)">
<g style="isolation:isolate">
<text transform="translate(377.78 505.31)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-20)">
<g style="isolation:isolate">
<text transform="translate(377.78 440.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-21)">
<g style="isolation:isolate">
<text transform="translate(401.28 457.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-22)">
<g style="isolation:isolate">
<text transform="translate(401.28 489.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-23)">
<g style="isolation:isolate">
<text transform="translate(401.28 425.11)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-24)">
<g style="isolation:isolate">
<text transform="translate(424.73 472.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-25)">
<g style="isolation:isolate">
<text transform="translate(424.73 505.31)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-26)">
<g style="isolation:isolate">
<text transform="translate(424.73 440.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-27)">
<g style="isolation:isolate">
<text transform="translate(449.03 457.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-28)">
<g style="isolation:isolate">
<text transform="translate(449.03 489.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-29)">
<g style="isolation:isolate">
<text transform="translate(449.03 425.11)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-30)">
<g style="isolation:isolate">
<text transform="translate(472.53 472.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-31)">
<g style="isolation:isolate">
<text transform="translate(472.53 505.31)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-32)">
<g style="isolation:isolate">
<text transform="translate(472.53 440.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-33)">
<g style="isolation:isolate">
<text transform="translate(497.63 457.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-34)">
<g style="isolation:isolate">
<text transform="translate(497.63 489.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-35)">
<g style="isolation:isolate">
<text transform="translate(497.63 425.11)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-36)">
<g style="isolation:isolate">
<text transform="translate(521.13 472.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-37)">
<g style="isolation:isolate">
<text transform="translate(521.13 505.31)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-38)">
<g style="isolation:isolate">
<text transform="translate(521.13 440.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-39)">
<g style="isolation:isolate">
<text transform="translate(544.63 457.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-40)">
<g style="isolation:isolate">
<text transform="translate(544.63 489.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-41)">
<g style="isolation:isolate">
<text transform="translate(544.63 425.11)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-42)">
<g style="isolation:isolate">
<text transform="translate(568.13 472.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-43)">
<g style="isolation:isolate">
<text transform="translate(568.13 505.31)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-44)">
<g style="isolation:isolate">
<text transform="translate(568.13 440.51)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-45)">
<g style="isolation:isolate">
<text transform="translate(230.33 472.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-46)">
<g style="isolation:isolate">
<text transform="translate(230.33 505.31)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-47)">
<g style="isolation:isolate">
<text transform="translate(230.33 438.86)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
</g>
<g id="blockmiddle">
<path id="Symbol_12_0_Layer0_0_1_STROKES-2" data-name="Symbol 12 0 Layer0 0 1 STROKES" d="M406.13,265.38V246.73m47.8,18.65V246.73m48.6,18.65V246.73m47,18.65V246.73M573,314V295.33M526,314V295.33M477.38,314V295.33M429.63,314V295.33m-7.3-10.55-9.7-8.9m-6.5,22.7V279.93m159.55,4.85-9.7-8.9m17,5.7V262.93m15.4,12.95-8.9,9.75m-94.8-.85,9.75-8.9m-17.05,5.7V262.93m-47.75,18.65V262.93m40.5,21.85-9.75-8.9m-24.3,8.9,9.75-8.9m8.1,22.7V279.93M526,281.58V262.93m5.7,21.85,9.7-8.9m-22.65,8.9-9.75-8.9m40.5,22.7V279.93m-47,18.65V279.93m-267.3-.8V260.48m24.3,5.7V247.53m47.8,17.85V246.73m23.45,34v-18.6m28.35,3.25V246.73m23.5,34v-18.6m0,51.85V295.33M330.78,314V295.33M283,314.78V296.13M235.23,314V295.33m54.25-10.55,9.75-8.9m42.1,8.9,9.7-8.9m-27.5,8.9-9.75-8.9m45.35,22.7V279.93m-51.8,18.65V279.93m81,4.85,9.7-8.9m-22.7,8.9-9.7-8.9m-147.4,0,8.9,9.75m55.9-4V262.93m-7.3,22.7L266,276.68m-24.3,8.95,9.75-8.95m8.1,22.7V280.73"
fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
<g clip-path="url(#clip-path-48)">
<g style="isolation:isolate">
<text transform="translate(207.68 276.39)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-49)">
<g style="isolation:isolate">
<text transform="translate(589.18 275.54)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-50)">
<g style="isolation:isolate">
<text transform="translate(254.63 277.99)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-51)">
<g style="isolation:isolate">
<text transform="translate(254.63 310.39)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-52)">
<g style="isolation:isolate">
<text transform="translate(254.63 245.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-53)">
<g style="isolation:isolate">
<text transform="translate(278.13 293.39)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-54)">
<g style="isolation:isolate">
<text transform="translate(278.13 325.79)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-55)">
<g style="isolation:isolate">
<text transform="translate(278.13 260.99)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-56)">
<g style="isolation:isolate">
<text transform="translate(302.43 277.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-57)">
<g style="isolation:isolate">
<text transform="translate(302.43 309.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-58)">
<g style="isolation:isolate">
<text transform="translate(302.43 244.79)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-59)">
<g style="isolation:isolate">
<text transform="translate(325.93 292.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-60)">
<g style="isolation:isolate">
<text transform="translate(325.93 324.99)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-61)">
<g style="isolation:isolate">
<text transform="translate(325.93 260.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-62)">
<g style="isolation:isolate">
<text transform="translate(354.28 277.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-63)">
<g style="isolation:isolate">
<text transform="translate(354.28 309.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-64)">
<g style="isolation:isolate">
<text transform="translate(354.28 244.79)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-65)">
<g style="isolation:isolate">
<text transform="translate(377.78 292.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-66)">
<g style="isolation:isolate">
<text transform="translate(377.78 324.99)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-67)">
<g style="isolation:isolate">
<text transform="translate(377.78 260.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-68)">
<g style="isolation:isolate">
<text transform="translate(401.28 277.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-69)">
<g style="isolation:isolate">
<text transform="translate(401.28 309.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-70)">
<g style="isolation:isolate">
<text transform="translate(401.28 244.79)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-71)">
<g style="isolation:isolate">
<text transform="translate(424.73 292.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-72)">
<g style="isolation:isolate">
<text transform="translate(424.73 324.99)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-73)">
<g style="isolation:isolate">
<text transform="translate(424.73 260.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-74)">
<g style="isolation:isolate">
<text transform="translate(449.03 277.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-75)">
<g style="isolation:isolate">
<text transform="translate(449.03 309.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-76)">
<g style="isolation:isolate">
<text transform="translate(449.03 244.79)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-77)">
<g style="isolation:isolate">
<text transform="translate(472.53 292.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-78)">
<g style="isolation:isolate">
<text transform="translate(472.53 324.99)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-79)">
<g style="isolation:isolate">
<text transform="translate(472.53 260.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-80)">
<g style="isolation:isolate">
<text transform="translate(497.63 277.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-81)">
<g style="isolation:isolate">
<text transform="translate(497.63 309.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-82)">
<g style="isolation:isolate">
<text transform="translate(497.63 244.79)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-83)">
<g style="isolation:isolate">
<text transform="translate(521.13 292.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-84)">
<g style="isolation:isolate">
<text transform="translate(521.13 324.99)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-85)">
<g style="isolation:isolate">
<text transform="translate(521.13 260.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-86)">
<g style="isolation:isolate">
<text transform="translate(544.63 277.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-87)">
<g style="isolation:isolate">
<text transform="translate(544.63 309.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-88)">
<g style="isolation:isolate">
<text transform="translate(544.63 244.79)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-89)">
<g style="isolation:isolate">
<text transform="translate(568.13 292.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-90)">
<g style="isolation:isolate">
<text transform="translate(568.13 324.99)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-91)">
<g style="isolation:isolate">
<text transform="translate(568.13 260.19)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-92)">
<g style="isolation:isolate">
<text transform="translate(230.33 292.59)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-93)">
<g style="isolation:isolate">
<text transform="translate(230.33 324.99)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-94)">
<g style="isolation:isolate">
<text transform="translate(230.33 258.54)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
</g>
<g id="blocktop">
<path id="Symbol_12_0_Layer0_0_1_STROKES-3" data-name="Symbol 12 0 Layer0 0 1 STROKES" d="M406.13,85.75V67.1m47.8,18.65V67.1m48.6,18.65V67.1m47,18.65V67.1M573,134.35V115.7m-47,18.65V115.7m-48.6,18.65V115.7m-47.75,18.65V115.7m-7.3-10.55-9.7-8.9m-6.5,22.7V100.3m159.55,4.85-9.7-8.9m17,5.7V83.3m15.4,12.95-8.9,9.75m-94.8-.85,9.75-8.9m-17.05,5.7V83.3m-47.75,18.65V83.3m40.5,21.85-9.75-8.9m-24.3,8.9,9.75-8.9m8.1,22.7V100.3M526,101.95V83.3m5.7,21.85,9.7-8.9m-22.65,8.9L509,96.25m40.5,22.7V100.3m-47,18.65V100.3m-267.3-.8V80.85m24.3,5.7V67.9m47.8,17.85V67.1m23.45,34V82.5m28.35,3.25V67.1m23.5,34V82.5m0,51.85V115.7m-51.85,18.65V115.7M283,135.15V116.5m-47.8,17.85V115.7m54.25-10.55,9.75-8.9m42.1,8.9,9.7-8.9m-27.5,8.9-9.75-8.9m45.35,22.7V100.3m-51.8,18.65V100.3m81,4.85,9.7-8.9m-22.7,8.9-9.7-8.9m-147.4,0,8.9,9.75m55.9-4V83.3m-7.3,22.7L266,97M241.68,106,251.43,97m8.1,22.7V101.1"
fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
<g clip-path="url(#clip-path-95)">
<g style="isolation:isolate">
<text transform="translate(207.68 96.76)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-96)">
<g style="isolation:isolate">
<text transform="translate(589.18 95.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-97)">
<g style="isolation:isolate">
<text transform="translate(254.63 98.36)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-98)">
<g style="isolation:isolate">
<text transform="translate(254.63 130.76)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-99)">
<g style="isolation:isolate">
<text transform="translate(254.63 65.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-100)">
<g style="isolation:isolate">
<text transform="translate(278.13 113.76)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-101)">
<g style="isolation:isolate">
<text transform="translate(278.13 146.16)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-102)">
<g style="isolation:isolate">
<text transform="translate(278.13 81.36)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-103)">
<g style="isolation:isolate">
<text transform="translate(302.43 97.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-104)">
<g style="isolation:isolate">
<text transform="translate(302.43 129.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-105)">
<g style="isolation:isolate">
<text transform="translate(302.43 65.16)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-106)">
<g style="isolation:isolate">
<text transform="translate(325.93 112.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-107)">
<g style="isolation:isolate">
<text transform="translate(325.93 145.36)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-108)">
<g style="isolation:isolate">
<text transform="translate(325.93 80.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-109)">
<g style="isolation:isolate">
<text transform="translate(354.28 97.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-110)">
<g style="isolation:isolate">
<text transform="translate(354.28 129.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-111)">
<g style="isolation:isolate">
<text transform="translate(354.28 65.16)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-112)">
<g style="isolation:isolate">
<text transform="translate(377.78 112.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-113)">
<g style="isolation:isolate">
<text transform="translate(377.78 145.36)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-114)">
<g style="isolation:isolate">
<text transform="translate(377.78 80.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-115)">
<g style="isolation:isolate">
<text transform="translate(401.28 97.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-116)">
<g style="isolation:isolate">
<text transform="translate(401.28 129.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-117)">
<g style="isolation:isolate">
<text transform="translate(401.28 65.16)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-118)">
<g style="isolation:isolate">
<text transform="translate(424.73 112.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-119)">
<g style="isolation:isolate">
<text transform="translate(424.73 145.36)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-120)">
<g style="isolation:isolate">
<text transform="translate(424.73 80.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-121)">
<g style="isolation:isolate">
<text transform="translate(449.03 97.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-122)">
<g style="isolation:isolate">
<text transform="translate(449.03 129.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-123)">
<g style="isolation:isolate">
<text transform="translate(449.03 65.16)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-124)">
<g style="isolation:isolate">
<text transform="translate(472.53 112.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-125)">
<g style="isolation:isolate">
<text transform="translate(472.53 145.36)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-126)">
<g style="isolation:isolate">
<text transform="translate(472.53 80.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-127)">
<g style="isolation:isolate">
<text transform="translate(497.63 97.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-128)">
<g style="isolation:isolate">
<text transform="translate(497.63 129.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-129)">
<g style="isolation:isolate">
<text transform="translate(497.63 65.16)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-130)">
<g style="isolation:isolate">
<text transform="translate(521.13 112.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-131)">
<g style="isolation:isolate">
<text transform="translate(521.13 145.36)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-132)">
<g style="isolation:isolate">
<text transform="translate(521.13 80.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-133)">
<g style="isolation:isolate">
<text transform="translate(544.63 97.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-134)">
<g style="isolation:isolate">
<text transform="translate(544.63 129.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-135)">
<g style="isolation:isolate">
<text transform="translate(544.63 65.16)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-136)">
<g style="isolation:isolate">
<text transform="translate(568.13 112.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-137)">
<g style="isolation:isolate">
<text transform="translate(568.13 145.36)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-138)">
<g style="isolation:isolate">
<text transform="translate(568.13 80.56)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-139)">
<g style="isolation:isolate">
<text transform="translate(230.33 112.96)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-140)">
<g style="isolation:isolate">
<text transform="translate(230.33 145.36)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-141)">
<g style="isolation:isolate">
<text transform="translate(230.33 78.91)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
</g>
<g id="glycerol">
<text transform="translate(33.44 538.53)" font-size="14" font-family="OpenSans, Open Sans">Glycerol</text>
</g>
<g id="fattyacid">
<text transform="translate(376.16 538.53)" font-size="14" font-family="OpenSans, Open Sans">Fatty Acid</text>
</g>
<g id="waterbottom">
<ellipse cx="206.85" cy="528.77" rx="31.34" ry="16.67" fill="#036" />
<text transform="translate(189.81 534.53)" font-size="19.81" fill="#fff" font-family="OpenSans-Semibold, Open Sans" font-weight="700">H
<tspan x="14.88" y="4" font-size="14">2</tspan>
<tspan x="22.87" y="0">0</tspan>
</text>
</g>
<g id="watermiddle">
<ellipse cx="206.85" cy="355.95" rx="31.34" ry="16.67" fill="#036" />
<text transform="translate(189.81 361.72)" font-size="19.81" fill="#fff" font-family="OpenSans-Semibold, Open Sans" font-weight="700">H
<tspan x="14.88" y="4" font-size="14">2</tspan>
<tspan x="22.87" y="0">0</tspan>
</text>
</g>
<g id="watertop">
<ellipse cx="206.85" cy="184.18" rx="31.34" ry="16.67" fill="#036" />
<text transform="translate(189.81 189.94)" font-size="19.81" fill="#fff" font-family="OpenSans-Semibold, Open Sans" font-weight="700">H
<tspan x="14.88" y="4" font-size="14">2</tspan>
<tspan x="22.87" y="0">0</tspan>
</text>
</g>
<g id="triacylglyceride">
<text transform="translate(324.52 538.53)" font-size="14" font-family="OpenSans, Open Sans">A Triacylglyceride</text>
</g>
<g id="olinesbottom">
<g id="obottom" style="isolation:isolate">
<text transform="translate(184.88 436.3)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">O</text>
</g>
<path id="Symbol_16_0_Layer0_0_2_STROKES" data-name="Symbol 16 0 Layer0 0 2 STROKES" d="M205.33,448.34l-11.65-10.5m14.75,7.2-11.65-10.5"
fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
<path id="Symbol_19_0_Layer0_0_1_STROKES" data-name="Symbol 19 0 Layer0 0 1 STROKES" d="M206.53,458.64l-8.9,9.7" fill="none"
stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
</g>
<g id="olinesmiddle">
<g id="omiddle" style="isolation:isolate">
<text transform="translate(184.88 255.98)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">O</text>
</g>
<path id="Symbol_16_0_Layer0_0_2_STROKES-2" data-name="Symbol 16 0 Layer0 0 2 STROKES" d="M205.33,268l-11.65-10.5m14.75,7.2-11.65-10.5"
fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
<path id="Symbol_19_0_Layer0_0_1_STROKES-2" data-name="Symbol 19 0 Layer0 0 1 STROKES" d="M206.53,278.33l-8.9,9.7" fill="none"
stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
</g>
<g id="olinestop">
<g id="otop" style="isolation:isolate">
<text transform="translate(184.88 76.35)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">O</text>
</g>
<path id="Symbol_16_0_Layer0_0_2_STROKES-3" data-name="Symbol 16 0 Layer0 0 2 STROKES" d="M205.33,88.4,193.68,77.9m14.75,7.2L196.78,74.6"
fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
<path id="Symbol_19_0_Layer0_0_1_STROKES-3" data-name="Symbol 19 0 Layer0 0 1 STROKES" d="M206.53,98.7l-8.9,9.7" fill="none"
stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
</g>
<g id="bottomoh">
<g clip-path="url(#clip-path-142)">
<g style="isolation:isolate">
<text transform="translate(176.63 478.57)" font-size="12" font-family="OpenSans, Open Sans" letter-spacing="0em" style="isolation:isolate">OH</text>
</g>
</g>
</g>
<g id="middleoh">
<g clip-path="url(#clip-path-143)">
<g style="isolation:isolate">
<text transform="translate(176.63 298.26)" font-size="12" font-family="OpenSans, Open Sans" letter-spacing="0em" style="isolation:isolate">OH</text>
</g>
</g>
</g>
<g id="topoh">
<g clip-path="url(#clip-path-144)">
<g style="isolation:isolate">
<text transform="translate(176.63 118.63)" font-size="12" font-family="OpenSans, Open Sans" letter-spacing="0em" style="isolation:isolate">OH</text>
</g>
</g>
</g>
<g id="bottomh" data-name="bottomh">
<g style="isolation:isolate">
<text transform="translate(90.43 457.4)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g id="middleh">
<g style="isolation:isolate">
<text transform="translate(90.43 276.73)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g id="toph">
<g style="isolation:isolate">
<text transform="translate(90.43 97.76)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g id="lettersleft">
<g style="isolation:isolate">
<text transform="translate(80.75 97.76)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">O</text>
</g>
<g style="isolation:isolate">
<text transform="translate(80.75 276.73)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">O</text>
</g>
<path id="Symbol_20_0_Layer1_0_2_STROKES" data-name="Symbol 20 0 Layer1 0 2 STROKES" d="M58.38,102.2l0,161.55m0,19,0,161.55"
fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
<path id="Symbol_20_0_Layer0_0_1_STROKES" data-name="Symbol 20 0 Layer0 0 1 STROKES" d="M40,452.7H52.18m13,0H77.28M58.68,461V473.2"
fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
<g clip-path="url(#clip-path-145)">
<g style="isolation:isolate">
<text transform="translate(54.58 457.46)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-146)">
<g style="isolation:isolate">
<text transform="translate(54.13 484.01)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-147)">
<g style="isolation:isolate">
<text transform="translate(29.93 457.21)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<path id="Symbol_21_0_Layer0_0_1_STROKES" data-name="Symbol 21 0 Layer0 0 1 STROKES" d="M65.18,272.3H77.33m-37.25,0H52.23"
fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
<g clip-path="url(#clip-path-148)">
<g style="isolation:isolate">
<text transform="translate(54.63 276.74)" font-size="12.19" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-149)">
<g style="isolation:isolate">
<text transform="translate(29.88 276.74)" font-size="12.19" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<path id="Symbol_22_0_Layer0_0_1_STROKES" data-name="Symbol 22 0 Layer0 0 1 STROKES" d="M64.63,92.65H76.78M58.63,74v11.3m-19.1,7.3H51.68"
fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" />
<g clip-path="url(#clip-path-150)">
<g style="isolation:isolate">
<text transform="translate(54.08 97.21)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">C</text>
</g>
</g>
<g clip-path="url(#clip-path-151)">
<g style="isolation:isolate">
<text transform="translate(54.53 72.06)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g clip-path="url(#clip-path-152)">
<g style="isolation:isolate">
<text transform="translate(28.98 97.21)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">H</text>
</g>
</g>
<g style="isolation:isolate">
<text transform="translate(80.75 457.4)" font-size="12.15" font-family="OpenSans, Open Sans" style="isolation:isolate">O</text>
</g>
</g>
<g id="esterlinkage">
<text transform="translate(132.43 38.43)" font-size="15.55" font-family="OpenSans, Open Sans">Ester Linkage</text>
<polyline points="201.59 101.08 201.59 104.08 198.59 104.08" fill="none" stroke="#000" stroke-miterlimit="10" />
<line x1="192.08" y1="104.08" x2="156.29" y2="104.08" fill="none" stroke="#000" stroke-miterlimit="10" stroke-dasharray="6.51 6.51"
/>
<polyline points="153.03 104.08 150.03 104.08 150.03 101.08" fill="none" stroke="#000" stroke-miterlimit="10" />
<line x1="150.03" y1="94.69" x2="150.03" y2="59.52" fill="none" stroke="#000" stroke-miterlimit="10" stroke-dasharray="6.39 6.39"
/>
<polyline points="150.03 56.33 150.03 53.33 153.03 53.33" fill="none" stroke="#000" stroke-miterlimit="10" />
<line x1="159.54" y1="53.33" x2="195.33" y2="53.33" fill="none" stroke="#000" stroke-miterlimit="10" stroke-dasharray="6.51 6.51"
/>
<polyline points="198.59 53.33 201.59 53.33 201.59 56.33" fill="none" stroke="#000" stroke-miterlimit="10" />
<line x1="201.59" y1="62.72" x2="201.59" y2="97.89" fill="none" stroke="#000" stroke-miterlimit="10" stroke-dasharray="6.39 6.39"
/>
<line x1="175.81" y1="46.9" x2="175.81" y2="53.33" fill="none" stroke="#000" stroke-miterlimit="10" />
</g>
</svg>
`;
}
render() {
return html`
<h1>Fat Synthesis</h1>
<eberlywc-animationctrl-button @click=${this.play}
>play</eberlywc-animationctrl-button
>
<eberlywc-animationctrl-button @click=${this.reset}
>reset</eberlywc-animationctrl-button
>
${this.renderSVG()}
`;
}
play() {
this.__tl.play();
}
reset() {
this.__tl.progress(0);
this.__tl.pause();
}
} |
JavaScript | class FormatError extends CashShuffleError {
/**
* Error type name.
*
* @constant {string}
* @default 'FormatError'
*/
get name () {
return 'FormatError'
}
} |
JavaScript | class DungeonScene extends Phaser.Scene {
constructor() {
super();
this.level = 0;
}
preload() {
this.load.image(
"tiles",
"../../../../examples/post-3/assets/tilesets/buch-tileset-48px-extruded.png"
);
this.load.spritesheet(
"characters",
"../../../../examples/post-3/assets/spritesheets/buch-characters-64px-extruded.png",
{
frameWidth: 64,
frameHeight: 64,
margin: 1,
spacing: 2
}
);
}
create() {
this.level++;
this.hasPlayerReachedStairs = false;
// Generate a random world with a few extra options:
// - Rooms should only have odd number dimensions so that they have a center tile.
// - Doors should be at least 2 tiles away from corners, so that we can place a corner tile on
// either side of the door location
this.dungeon = new Dungeon({
width: 50,
height: 50,
doorPadding: 2,
rooms: {
width: { min: 7, max: 15, onlyOdd: true },
height: { min: 7, max: 15, onlyOdd: true }
},
maxRooms: 10
});
// Creating a blank tilemap with dimensions matching the dungeon
const map = this.make.tilemap({
tileWidth: 48,
tileHeight: 48,
width: this.dungeon.width,
height: this.dungeon.height
});
const tileset = map.addTilesetImage("tiles", null, 48, 48, 1, 2); // 1px margin, 2px spacing
this.groundLayer = map.createBlankDynamicLayer("Ground", tileset);
this.stuffLayer = map.createBlankDynamicLayer("Stuff", tileset).setVisible(false);
this.shadowLayer = map.createBlankDynamicLayer("Shadow", tileset).setVisible(false);
// Fill the ground and shadow with black tiles
this.shadowLayer.fill(20);
// --- DEMO 1 ---
// Set all tiles in the ground layer with blank tiles (purple-black tile)
this.groundLayer.fill(20);
// Use the array of rooms generated to place tiles in the map
// Note: using an arrow function here so that "this" still refers to our scene
this.dungeon.rooms.forEach(room => {
// These room properties are all in grid units (not pixels units)
const { x, y, width, height, left, right, top, bottom } = room;
// Fill the entire room (minus the walls) with mostly clean floor tiles (90% of the time), but
// occasionally place a dirty tile (10% of the time).
this.groundLayer.weightedRandomize(x + 1, y + 1, width - 2, height - 2, [
{ index: 6, weight: 9 },
{ index: [7, 8, 26], weight: 1 }
]);
// Place the room corners tiles
this.groundLayer.putTileAt(3, left, top);
this.groundLayer.putTileAt(4, right, top);
this.groundLayer.putTileAt(23, right, bottom);
this.groundLayer.putTileAt(22, left, bottom);
// Place the non-corner wall tiles using fill with x, y, width, height parameters
this.groundLayer.fill(39, left + 1, top, width - 2, 1); // Top
this.groundLayer.fill(1, left + 1, bottom, width - 2, 1); // Bottom
this.groundLayer.fill(21, left, top + 1, 1, height - 2); // Left
this.groundLayer.fill(19, right, top + 1, 1, height - 2); // Right
});
// --- /DEMO 1 ---
// // Use the array of rooms generated to place tiles in the map
// // Note: using an arrow function here so that "this" still refers to our scene
// this.dungeon.rooms.forEach(room => {
// const { x, y, width, height, left, right, top, bottom } = room;
// // Fill the floor with mostly clean tiles, but occasionally place a dirty tile
// // See "Weighted Randomize" example for more information on how to use weightedRandomize.
// this.groundLayer.weightedRandomize(x, y, width, height, TILES.FLOOR);
// // Place the room corners tiles
// this.groundLayer.putTileAt(TILES.WALL.TOP_LEFT, left, top);
// this.groundLayer.putTileAt(TILES.WALL.TOP_RIGHT, right, top);
// this.groundLayer.putTileAt(TILES.WALL.BOTTOM_RIGHT, right, bottom);
// this.groundLayer.putTileAt(TILES.WALL.BOTTOM_LEFT, left, bottom);
// // Fill the walls with mostly clean tiles, but occasionally place a dirty tile
// this.groundLayer.weightedRandomize(left + 1, top, width - 2, 1, TILES.WALL.TOP);
// this.groundLayer.weightedRandomize(left + 1, bottom, width - 2, 1, TILES.WALL.BOTTOM);
// this.groundLayer.weightedRandomize(left, top + 1, 1, height - 2, TILES.WALL.LEFT);
// this.groundLayer.weightedRandomize(right, top + 1, 1, height - 2, TILES.WALL.RIGHT);
// // Dunegons have rooms that are connected with doors. Each door has an x & y relative to the
// // room's location
// var doors = room.getDoorLocations();
// for (var i = 0; i < doors.length; i++) {
// if (doors[i].y === 0) {
// this.groundLayer.putTilesAt(TILES.DOOR.TOP, x + doors[i].x - 1, y + doors[i].y);
// } else if (doors[i].y === room.height - 1) {
// this.groundLayer.putTilesAt(TILES.DOOR.BOTTOM, x + doors[i].x - 1, y + doors[i].y);
// } else if (doors[i].x === 0) {
// this.groundLayer.putTilesAt(TILES.DOOR.LEFT, x + doors[i].x, y + doors[i].y - 1);
// } else if (doors[i].x === room.width - 1) {
// this.groundLayer.putTilesAt(TILES.DOOR.RIGHT, x + doors[i].x, y + doors[i].y - 1);
// }
// }
// });
const rooms = this.dungeon.rooms.slice();
const startRoom = rooms.shift();
const endRoom = rooms[0]; //Phaser.Utils.Array.RemoveRandomElement(rooms);
const otherRooms = Phaser.Utils.Array.Shuffle(rooms).slice(0, rooms.length * 0.9);
this.stuffLayer.putTileAt(TILES.STAIRS, endRoom.centerX - 2, endRoom.centerY);
otherRooms.forEach(room => {
// Place some random stuff in rooms occasionally
var rand = Math.random();
if (rand <= 0.25) {
this.stuffLayer.putTileAt(TILES.CHEST, room.centerX, room.centerY);
} else if (rand <= 0.5) {
// Pick a spot in the room for the pot... except don't block a door!
const x = Phaser.Math.Between(room.left + 2, room.right - 2);
const y = Phaser.Math.Between(room.top + 2, room.bottom - 2);
this.stuffLayer.weightedRandomize(x, y, 1, 1, TILES.POT);
} else {
if (room.height >= 9) {
// We have room for 4 towers
this.stuffLayer.putTilesAt(TILES.TOWER, room.centerX - 1, room.centerY + 1);
this.stuffLayer.putTilesAt(TILES.TOWER, room.centerX + 1, room.centerY + 1);
this.stuffLayer.putTilesAt(TILES.TOWER, room.centerX - 1, room.centerY - 2);
this.stuffLayer.putTilesAt(TILES.TOWER, room.centerX + 1, room.centerY - 2);
} else {
this.stuffLayer.putTilesAt(TILES.TOWER, room.centerX - 1, room.centerY - 1);
this.stuffLayer.putTilesAt(TILES.TOWER, room.centerX + 1, room.centerY - 1);
}
}
});
// Not exactly correct for the tileset since there are more possible floor tiles, but this will
// do for the example.
this.groundLayer.setCollisionByExclusion([-1, 6, 7, 8, 26]);
this.stuffLayer.setCollisionByExclusion([-1, 6, 7, 8, 26]);
this.stuffLayer.setTileIndexCallback(TILES.STAIRS, () => {
this.stuffLayer.setTileIndexCallback(TILES.STAIRS, null);
const cam = this.cameras.main;
cam.fade(250, 0, 0, 0);
this.hasPlayerReachedStairs = true;
this.player.freeze();
cam.once("camerafadeoutcomplete", () => {
this.player.destroy();
this.scene.restart();
});
});
// Place the player in the first room
const playerRoom = this.dungeon.rooms[0];
const x = map.tileToWorldX(playerRoom.centerX + 1);
const y = map.tileToWorldY(playerRoom.centerY + 1);
this.player = new Player(this, x, y);
// Watch the player and worldLayer for collisions, for the duration of the scene:
this.physics.add.collider(this.player.sprite, this.groundLayer);
this.physics.add.collider(this.player.sprite, this.stuffLayer);
// Phaser supports multiple cameras, but you can access the default camera like this:
const camera = this.cameras.main;
// Constrain the camera so that it isn't allowed to move outside the width/height of tilemap
camera.setBounds(0, 0, map.widthInPixels, map.heightInPixels);
camera.startFollow(this.player.sprite);
this.shadowLayer.forEachTile(tile => (tile.alpha = 1));
this.setRoomAlpha(startRoom, 0);
this.activeRoom = startRoom;
// Help text that has a "fixed" position on the screen
this.add
.text(16, 16, `Find the stairs. Go deeper.\nCurrent level: ${this.level}`, {
font: "18px monospace",
fill: "#000000",
padding: { x: 20, y: 10 },
backgroundColor: "#ffffff"
})
.setScrollFactor(0)
.setVisible(false);
}
update(time, delta) {
if (this.hasPlayerReachedStairs) return;
this.player.update();
const playerTileX = this.groundLayer.worldToTileX(this.player.sprite.x);
const playerTileY = this.groundLayer.worldToTileY(this.player.sprite.y);
// Another helper method from the dungeon - dungeon XY (in tiles) -> room
const room = this.dungeon.getRoomAt(playerTileX, playerTileY);
// If the player has entered a new room, make it visible and dim the last room
if (this.activeRoom !== room) {
this.setRoomAlpha(room, 0);
if (this.activeRoom) this.setRoomAlpha(this.activeRoom, 0.5);
this.activeRoom = room;
}
}
setRoomAlpha(room, alpha) {
this.shadowLayer.forEachTile(
t => (t.alpha = alpha),
this,
room.x,
room.y,
room.width,
room.height
);
}
} |
JavaScript | class BelfioreConnector {
/**
*
* @param {Object} [param] Static json
* @param {Date} [param.activeDate] Target date to filter places active only for the given date
* @param {RegExp} [param.codeMatcher] Belfiore code matcher
* @param {string} [param.province] Province code
* @constructor
* @private
*/
constructor({ activeDate, codeMatcher, province } = {}) {
if (codeMatcher && province) {
throw new Error('Both codeMatcher and province were provided to Bolfiore, only one is allowed');
}
const hiddenValueConf = value => ({
value,
enumerable: false,
configurable: false,
writable: false
});
Object.defineProperties(this, {
_activeDate: hiddenValueConf(activeDate),
_codeMatcher: hiddenValueConf(codeMatcher),
_province: hiddenValueConf(province)
});
return new Proxy(this, this.constructor);
}
/**
* @async
* @returns {Array<Object>} List of places
* @public
*/
async toArray() {
return [];
}
/**
* Search places matching given name
* @async
* @param {null|string|RegExp} [name = null] Place name or name matcher
* @param {number} [limit=0] result limit
* @returns {Array<Object>} List of places
* @throws {Error} Missing or invalid provided name
* @public
*/
async searchByName(name = null, limit = 0) {
if (!(name === null || ['string', 'undefined'].includes(typeof name) || name instanceof RegExp)) {
throw new Error('Missing or invalid provided name, it must be a string, a RegExp, null or undefined');
}
if (typeof limit !== 'number') {
throw new Error('Invalid provided limit, must be a number');
}
if (limit < 0) {
throw new Error('Invalid provided limit, must be equal or greater than 0');
}
if (!name) {
const fullList = await this.toArray();
if (limit) {
return fullList.slice(0, limit);
}
return fullList;
}
return [];
}
/**
* Find place matching exactly given name; retuns place object if provided name match only 1 result
* @async
* @param {string|RegExp} name Place name or name matcher
* @returns {Object}
* @throws {Error} Missing or invalid provided name
* @public
*/
async findByName(name) {
if (!name) {
throw new Error('Missing or invalid provided name, it must be a string or a RegExp');
}
const result = await this.searchByName(name instanceof RegExp ? name : new RegExp(`^${name}$`, 'ui'), 1);
return result[0];
}
/**
* Returns current BelfioreConnector config
* @returns {Object} config object
* @memberof BelfioreConnector
*/
config() {
const conf = {};
const inheritAttrs = Object.getOwnPropertyNames(this)
.filter(key => (/^_[a-z]+/).test(key) && typeof this[key] !== 'function')
.map(key => ({[key.match(/^_(.+)$/i)[1]]: this[key]}));
inheritAttrs.forEach(attr => Object.assign(conf, attr));
return conf;
}
/**
* Returns a Proxied version of Belfiore which filters results by given date
* @param {string|Date|Array<number>} [date = new Date()] Target date to filter places active only for the given date
* @returns {BelfioreConnector} Belfiore instance filtered by active date
* @public
*/
active(date = new Date()) {
const conf = this.config();
conf.activeDate = date;
return new this.constructor(conf);
}
/**
* Returns a Belfiore instance filtered by the given province
* @param {string} code Province Code (2 A-Z char)
* @returns {BelfioreConnector} Belfiore instance filtered by province code
* @public
*/
byProvince(code) {
if (!(typeof code === 'string' && (/^[A-Z]{2}$/u).test(code))) {
return;
}
const conf = this.config();
conf.province = code;
return new this.constructor(conf);
}
/**
* Returns a Proxied version of Belfiore which filters results by place type
* @readonly
* @returns {BelfioreConnector} Belfiore instance filtered by cities
* @public
*/
get cities() {
const conf = this.config();
conf.codeMatcher = /^[A-Y]/u;
return new this.constructor(conf);
}
/**
* Returns a Proxied version of Belfiore which filters results by place type
* @readonly
* @returns {BelfioreConnector} Belfiore instance filtered by countries
* @public
*/
get countries() {
const conf = this.config();
conf.codeMatcher = /^Z/u;
return new this.constructor(conf);
}
/**
* Retrieve place matching given belfioreCode
* @async
* @param {string} belfioreCode Belfiore Code
* @returns {Object}
* @throws {Error} Missing or invalid provided name
* @public
*/
async getByCode(belfioreCode) {
if (!belfioreCode || typeof belfioreCode !== 'string') {
throw new Error('Missing or invalid provided code');
}
}
/**
* Get Proxy
* @param {Object} resource target resource
* @param {string|number|Symbol} paramName property name to proxy
* @returns {*} Proxied property
* @private
*/
static get (resource, paramName) {
if (typeof paramName === 'string' && (/^[A-Z]\d{3}$/u).test(paramName)){
return resource.getByCode(paramName);
}
if (
(resource._codeMatcher || resource._province) &&
['cities', 'countries'].includes(paramName) ||
paramName === 'byProvince' &&
(
resource._codeMatcher instanceof RegExp && resource._codeMatcher.test('Z000') ||
(/^[A-Z]{2}$/ui).test(resource._province)
)
) {
return;
}
return resource[paramName];
}
} |
JavaScript | class ReactorLog extends Entity {
static resourceFactory () {
return {
/**
* ReactorLog Entity resource. If using with Operator, app and project
* details are required.
*
* @param {string} projectId - Project ID, if using with Operator scope.
* @param {string} applicationId - Application ID, if using with Operator scope.
* @returns {Object}
*/
reactorLog (projectId, applicationId) {
if (isString(projectId) && !isString(applicationId)) {
throw new Error('When using with Operator, projectId and applicationId are required')
}
const useProjectId = projectId || this.project
const useApplicationId = applicationId || this.app
// Find the path to this application
const appPath = `/projects/${useProjectId}/applications/${useApplicationId}`
return Object.assign(Resource.factoryFor(ReactorLog, appPath + path).call(this), {
create (...args) {
return createLogs.call(this, ...args)
}
})
}
}
}
} |
JavaScript | class SdApi {
static tryInit(adapter) {
SdApi._adapter = adapter;
}
// -------------------------------
//
static log() {
switch (arguments.length) {
case 5: {
let source = arguments[0],
node = arguments[1],
url = arguments[2],
json = arguments[3],
tag = arguments[4];
this.log(source, node.name, 'tag=' + String(tag));
if (url == null) this.log(source, node.name, 'url=null');
else this.log(source, node.name, url);
if (json == null) this.log(source, node.name, 'json=null');
else this.log(source, node.name, json);
break;
}
case 3: {
if (arguments[2] == null || typeof arguments[2] == 'string') {
let source = arguments[0],
tag = arguments[1],
msg = arguments[2];
if (msg == null) {
msg = 'null';
}
try {
Log.v(tag, msg);
SdApi._adapter.log(source, tag, msg, null);
} catch (ex) {
console.trace(ex);
}
break;
} else if (
{}.toString.call(arguments[2]) == '[object Error]' ||
arguments[2] instanceof Error
) {
// java实参有声明类型让函数重载时检测,但js无,但arguments[2]一定不为null因为try后面的catch(error)里才调用本函数
let source = arguments[0],
tag = arguments[1],
tr = arguments[2];
try {
var msg = String(tr);
if (tr.message == '') {
msg = 'null';
}
Log.v(tag, msg);
SdApi._adapter.log(source, tag, msg, tr);
} catch (ex) {
console.trace(ex);
}
break;
}
}
}
}
static set(source, key, val) {
Log.v('SiteD.set:', key + '=' + val);
SdApi._adapter.set(source, key, val);
}
static get(source, key) {
var temp = SdApi._adapter.get(source, key);
Log.v('SiteD.get:', key + '=' + temp);
return temp;
}
// -------------
//
static cacheRoot() {
return SdApi._adapter.cacheRoot();
}
// -------------
//
static createNode(source, tagName) {
return SdApi._adapter.createNode(source, tagName);
}
static createNodeSet(source, tagName) {
return SdApi._adapter.createNodeSet(source, tagName);
}
static buildHttpHeader(cfg, url, header) {
SdApi._adapter.buildHttpHeader(cfg, url, header);
}
} |
JavaScript | class LocationService {
/** @constructor */
constructor(data) {
/**
* Property that indicates the location id
* @type {number}
*/
this.locationId = data.locationId;
/**
* Property that indicates the id of the service
* @type {number}
*/
this.serviceId = data.serviceId;
Object.keys(this).forEach((key) => {
if (this[key] === undefined) { delete this[key]; }
});
}
/**
* The function goes and searches the database
for the service to the database, if it finds it
returns the object
* @param {number, number}
* @return {object}
*/
static async get(locationId, serviceId) {
let locationServiceTbl = '';
try {
locationServiceTbl = await db.selectAll('location_service',
[{ col: 'locationId', oper: '=', val: locationId },
{
logic: 'AND', col: 'serviceId', oper: '=', val: serviceId,
}]);
} catch (e) {
return 0;
}
if (locationServiceTbl.length === 0) { return 0; }
const locationService = this.processResult(locationServiceTbl)[0];
return locationService;
}
/**
* Take the parameters and insert in
the database if the parameters are correct
* @param {number, number}
* @return {object}
*/
static async create({ locationId, serviceId }) {
const locationService = await this.get(locationId, serviceId);
if (locationService !== 0) {
return 1;
}
try {
await db.insert('location_service',
['locationId', 'serviceId'],
[locationId, serviceId]);
} catch (e) {
return 0;
}
return this.get(locationId, serviceId);
}
/**
* Take the parameters and remove
the indicated service from the database
* @param {number, number}
* @return {object}
*/
static async remove({ locationId, serviceId }) {
const locationService = await this.get(locationId, serviceId);
try {
await db.delete('location_service',
[{ col: 'locationId', oper: '=', val: locationId },
{
logic: 'AND', col: 'serviceId', oper: '=', val: serviceId,
}]);
} catch (e) {
return 0;
}
return locationService;
}
/**
* Process the result of a query by traversing the entire
instruction to generate the object and return it
* @param {string}
* @return {string}
*/
static processResult(data) {
this.result = [];
data.forEach((obj) => {
this.result.push(new LocationService(obj));
});
return this.result;
}
} |
JavaScript | class Config {
/**
* A special id that signifies all layers when querying a list of layers.
* @type {Symbol}
* @access public
*/
static All = All;
/**
* The id for the base layer.
* @type {Symbol}
* @access public
*/
static Base = Base;
/**
* A reference to the Joi schema library.
* @type {Object}
* @access public
*/
Joi = Joi;
/**
* Manages the list of layers.
* @type {LayerList}
* @access public
*/
layers = null;
/**
* Internal counter for change notifications.
* @type {Number}
*/
paused = 0;
/**
* A map of pending notifications by filter hash to `Map` instances. Each `Map` instance ties
* the handler to the watch filter and event arguments.
* @type {Object}
*/
pending = {};
/**
* Tracks the store types by file extension.
* @type {StoreRegistry}
* @access public
*/
stores = new StoreRegistry();
/**
* A lookup table of original watch handlers to their wrapped counterparts so that it can
* dedupe events.
* @type {Map}
*/
watcherMap = new Map();
/**
* Initializes the config object.
*
* @param {Object} [opts] - Various options.
* @param {Boolean} [opts.allowNulls] - Forces all nodes of a schema to allow nulls.
* @param {Boolean} [opts.allowUnknown=true] - Allows object values to contain unknown keys.
* @param {Boolean} [opts.applyOwner=true] - When `true`, determines the owner of the closest
* existing parent directory and apply the owner to the file and any newly created directories.
* @param {Object} [opts.data] - Data to initialize the base config layer with.
* @param {String} [opts.file] - The file to associate with the base layer.
* @param {Object|Layer|Array.<Object|Layer>} [opts.layers] - One or more layers to add in
* addition to the base layer.
* @param {Object} [opts.schema] - A Joi schema for the base layer.
* @param {Store|Function} [opts.store] - A store instance or store class to use for the base
* layer.
* @param {Function|Array.<Function>} [opts.stores] - A store class or array of store classes
* to register in addition to the built-in `JSStore` and `JSONStore`.
* @access public
*/
constructor(...opts) {
if (opts.length) {
for (const opt of opts) {
if (opt && typeof opt !== 'object') {
throw new TypeError('Expected config options to be an object');
}
}
opts = Object.assign({}, ...opts);
} else {
opts = {};
}
if (opts.data && typeof opts.data !== 'object') {
throw new TypeError('Expected config data to be an object');
}
this.stores.add(JSStore);
this.stores.add(JSONStore);
this.stores.add(XMLStore);
for (const store of arrayify(opts.stores)) {
this.stores.add(store);
}
let { store } = opts;
if (store) {
// if we have an explicit `store`, then register it's class
this.stores.add(store instanceof Store ? Object.getPrototypeOf(store).constructor : store);
} else if (opts.file) {
const StoreClass = this.stores.get(path.extname(opts.file));
store = new StoreClass();
}
this.layers = new LayerList({
allowNulls: opts.allowNulls,
allowUnknown: opts.allowUnknown !== false,
applyOwner: opts.applyOwner !== false,
data: opts.data,
file: opts.file,
schema: opts.schema,
store: opts.store
});
for (const layer of arrayify(opts.layers)) {
this.layers.add(layer);
}
}
/**
* Retrieves the data store for a specific layer.
*
* Note that not all stores expose their internal data structure. This method is leaky and
* probably should be removed someday.
*
* @param {String|Symbol} id - The layer id.
* @returns {Object}
* @access public
*/
data(id) {
return this.layers.get(id)?.store?.data;
}
/**
* Deletes a config value.
*
* @param {String|Array.<String>} key - The key to delete.
* @param {String|Symbol} id - A specific layer id to delete the value from.
* @returns {Boolean} Returns `true` if the value was deleted.
* @access public
*/
delete(key, id) {
key = splitKey(key);
let deleted = false;
this._pause();
for (const layer of this.layers.query(id)) {
if (layer) {
log(`Deleting ${highlight(key.join('.'))} on layer ${highlight(String(layer.id))}`);
deleted = layer.delete(key) || deleted;
}
}
this._resume();
return deleted;
}
/**
* Retrieves a value for the specified key.
*
* @param {String|Array.<String>} [key] - The key to get. When `undefined`, the entire config
* is returned.
* @param {*} [defaultValue] - A value to return if the key is not found.
* @param {String|Symbol|Array.<String|Symbol>} [id] - A specific id or ids to scan for the
* key. If not specified, then it scans all layers.
* @returns {*}
* @access public
*/
get(key, defaultValue, id) {
const origKey = key;
const replace = it => {
if (typeof it === 'string') {
return it.replace(/\{\{([^}]+)\}\}/g, (m, k) => {
const value = this.get(k);
if (value === undefined) {
throw new Error(`Config key "${origKey}" references undefined variable "${k}"`);
}
return value;
});
} else if (Array.isArray(it)) {
return it.map(i => replace(i));
} else if (it && typeof it === 'object') {
const obj = {};
for (const [ key, value ] of Object.entries(it)) {
obj[key] = replace(value);
}
return obj;
}
return it;
};
const merge = (src, dest) => {
for (const [ key, srcValue ] of Object.entries(src)) {
if (srcValue && typeof srcValue === 'object' && dest[key] && typeof dest[key] === 'object' && !Array.isArray(srcValue)) {
merge(srcValue, dest[key]);
} else {
dest[key] = srcValue;
}
}
};
key = splitKey(key);
let result;
const objects = [];
// loop through the layers in reverse until we hit a non-object value and accumulate
// object values for merging if no non-object found
for (const layer of this.layers.query(id, true)) {
const value = replace(layer.get(key));
if (value !== undefined) {
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
return value;
}
objects.unshift(value);
}
}
// merge all objects
if (objects.length) {
result = {};
for (const obj of objects) {
merge(obj, result);
}
}
if (result !== undefined) {
return result;
}
return defaultValue !== undefined || key.length ? replace(defaultValue) : {};
}
/**
* Determines if a key is set.
*
* @param {String|Array.<String>} [key] - The key to check.
* @param {String|Symbol|Array.<String|Symbol>} [id] - A specific layer id or ids to scan for
* the key. If not specified, then it scans all layers.
* @returns {Boolean}
* @access public
*/
has(key, id) {
key = splitKey(key);
for (const layer of this.layers.query(id, true)) {
if (layer.has(key)) {
return true;
}
}
return false;
}
/**
* Loads a config file. By default, it loads it into the config's default layer.
*
* @param {String} file - The path to the config file to load.
* @param {Object} [opts] - Various options.
* @param {Boolean} [opts.graceful=false] - When `true`, doesn't error if the config file does
* not exist.
* @param {Object} [opts.id] - The layer id to load the file into. If the layer id does not
* exist, it will create it.
* @param {String} [opts.namespace] - The name of the scope encompassing this layer's data and
* schema if not already defined.
* @param {Number} [opts.order=0] - The layer precedence.
* @param {Boolean} [opts.readonly] - Indicates if this layer's data can be changed.
* @param {Object|String} [opts.schema] - A Joi schema, object to compile into a Joi schema, or
* a path to a `.js` or `.json` file containing a Joi schema.
* @param {Boolean} [opts.static] - Indicates if this layer can be unloaded.
* @returns {Config}
* @access public
*/
load(file, opts = {}) {
if (!file || typeof file !== 'string') {
throw new TypeError('Expected config file to be a non-empty string');
}
if (opts && typeof opts === 'string') {
opts = { id: opts };
}
if (!opts || typeof opts !== 'object') {
throw new Error('Expected options to be an object');
}
const filename = path.basename(file);
const tags = filename.split('.').slice(1);
const ext = tags.pop();
const StoreClass = this.stores.get(`.${ext}`);
if (!StoreClass) {
throw new Error(`Unsupported file type "${ext ? `.${ext}` : filename}"`);
}
const layers = unique(opts.id || this.resolve({ action: 'load', tags }));
log(`Loading ${highlight(file)} into ${layers.map(s => highlight(String(s))).join(', ')}`);
for (const id of layers) {
const existing = this.layers.get(id);
const layer = this.layers.add({
...opts,
file,
graceful: !!opts.graceful,
id,
store: new StoreClass()
});
if (existing) {
// if we already have an existing layer, then this is considered a "reload" and we
// need to determine if the contents changed, specifically any filtered data
this._pause();
// we need to loop over the list of watchers that the `LayerList` has already
// copied from the existing layer to the new layer
// to optimize performance, both the value and hash for the existing and new
// layers is cached per filter
// if the values are objects, then compare hashes, otherwise compare values and if
// there's a discrepancy, queue the change notification
const existingHashes = {};
const existingValues = {};
const newHashes = {};
const newValues = {};
for (const { filter, filterHash, handler } of this.layers.watchers) {
let existingHash, existingValue, newHash, newValue;
if (Object.prototype.hasOwnProperty.call(existingHashes, filterHash)) {
existingValue = existingValues[filterHash];
existingHash = existingHashes[filterHash];
} else {
existingValue = existingValues[filterHash] = existing.get(filter);
existingHash = existingHashes[filterHash] = existingValue?.[Node.Meta]?.hash;
}
if (Object.prototype.hasOwnProperty.call(newHashes, filterHash)) {
newValue = newValues[filterHash];
newHash = newHashes[filterHash];
} else {
newValue = newValues[filterHash] = layer.get(filter);
newHash = newHashes[filterHash] = newValue?.[Node.Meta]?.hash;
}
// if there was an existing node and the hash of the existing layer and the new layer are
// different, then notify the handler immediately
if ((existingHash !== newHash) || ((existingHash === undefined || newHash === undefined) && existingValue !== newValue)) {
// hashes are different -or- value changed type and only one has a type, then compare values
if (!this.pending[filterHash]) {
this.pending[filterHash] = new Map();
}
log(`Detected change in loaded file${filter.length ? ` with filter "${filter.join('.')}"` : ''}`);
this.pending[filterHash].set(handler, { args: [ layer ], filter, value: newValue });
}
}
this._resume();
}
}
return this;
}
/**
* Deeply merges an object into a layer's store.
*
* @param {Object} data - The data to merge.
* @param {String|Symbol} [id] - A specific layer id or ids to merge the data into. If not
* specified, then it merges the data into the config's default layer.
* @returns {Config}
* @access public
*/
merge(data, id) {
if (data && typeof data === 'object' && !Array.isArray(data)) {
for (const layer of this.layers.query(id)) {
if (layer) {
layer.merge(data);
}
}
}
return this;
}
/**
* Internal helper for invoking mutator methods on the layer.
*
* @param {Object} opts - Various options.
* @param {String} opts.action - The action to perform. Must be 'set', 'push', 'pop', 'shift',
* or 'unshift'.
* @returns {*}
* @access private
*/
_mutate({ action, key, value, id }) {
key = splitKey(key);
if (!key || !key.length) {
throw new Error('Missing required config key');
}
let result;
let label = 'Setting';
if (arrayActionRE.test(action)) {
const existing = unique(this.get(key));
if (action === 'pop' || action === 'shift') {
label = action === 'pop' ? 'Popping' : 'Shifting';
result = existing[action]();
value = existing;
} else if (action === 'push') {
label = 'Pushing';
value = unique(Array.isArray(value) ? [ ...existing, ...value ] : [ ...existing, value ]);
} else {
label = 'Unshifting';
value = unique(Array.isArray(value) ? [ ...value, ...existing ] : [ value, ...existing ]);
}
}
this._pause();
for (const _id of unique(id || this.resolve({ action }))) {
const layer = this.layers.get(_id) || this.layers.add(_id);
const type = Array.isArray(value) ? 'array' : typeof value;
log(`${label} ${highlight(key.join('.'))} to a${type === 'array' || type === 'object' ? 'n' : ''} ${highlight(type)} on layer ${highlight(String(layer.id))}`);
layer.set(key, value, action);
}
this._resume();
return result;
}
/**
* Internal helper for dispatching change notifications.
*
* @access private
*/
_notify() {
const pending = Object.entries(this.pending);
if (pending.length) {
log(`Notifying ${pending.length} listener${pending.length !== 1 ? 's' : ''}`);
for (const [ filterHash, handlers ] of pending) {
delete this.pending[filterHash];
for (const [ handler, { args, filter, value } ] of handlers) {
handler(value !== undefined ? value : this.get(filter), ...args);
}
handlers.clear();
}
}
}
/**
* Increments the pause counter.
*
* @access private
*/
_pause() {
this.paused++;
}
/**
* Removes the last element from a array type config value.
*
* @param {String|Array.<String>} [key] - The config key.
* @param {String|Symbol} [id] - The id for a specific layer to save. If not specified, then it
* uses the config's default layer.
* @returns {*}
* @access public
*/
pop(key, id) {
return this._mutate({ id, key, action: 'pop' });
}
/**
* Adds an item to the end of an array type config value.
*
* @param {String|Array.<String>} key - The config key.
* @param {*} value - The value to add.
* @param {String|Symbol} [id] - The id for a specific layer to save. If not specified, then it
* uses the config's default layer.
* @returns {*}
* @access public
*/
push(key, value, id) {
this._mutate({ id, key, action: 'push', value });
return this;
}
/**
* Resolves a destination layer id based on tags extracted from the config filename. If a
* config doesn't care about tags, it can simply return the default config layer id. Custom
* config implementations are encouraged to override this method.
*
* @param {Object} [opts] - Various options.
* @param {String} [opts.action] - The action being performed.
* @param {Array.<String>} [opts.tags] - A list of tags parsed from the filename.
* @returns {String|Symbol|Array.<String|Symbol>}
* @access public
*/
resolve() {
return Config.Base;
}
/**
* ?
*
* @access private
*/
_resume() {
this.paused = Math.max(0, this.paused - 1);
if (!this.paused) {
this._notify();
}
}
/**
* Saves a specific layer's store to disk.
*
* @param {Object|String} optsOrFile - Various options or a file path.
* @param {String} [optsOrFile.file] - The file to write the layers store to. Defaults to the file
* loaded into the layer. If there is no filename, an error is thrown.
* @param {String|Symbol} [optsOrFile.id] - The id for a specific layer to save. If not specified,
* then it uses the config's default layer.
* @returns {Config}
* @access public
*/
save(optsOrFile) {
let file;
let id;
if (optsOrFile) {
if (typeof optsOrFile === 'object') {
({ file, id } = optsOrFile);
} else if (typeof optsOrFile === 'string') {
file = optsOrFile;
}
}
for (const _id of unique(id || this.resolve({ action: 'save' }))) {
const layer = this.layers.get(_id);
if (!layer) {
throw new Error(`Layer "${String(id)}" not found`);
}
layer.save(file);
}
return this;
}
/**
* Sets the value for a given config key.
*
* @param {String|Array.<String>} key - The key to set.
* @param {*} value - The value to set.
* @param {String|Symbol} [id] - The id for a specific layer to save. If not specified, then it
* uses the config's default layer.
* @return {Config}
* @access public
*/
set(key, value, id) {
this._mutate({ id, key, action: 'set', value });
return this;
}
/**
* Removes the first element from a array type config value.
*
* @param {String|Array.<String>} [key] - The config key.
* @param {String|Symbol} [id] - The id for a specific layer. If not specified, then it uses
* the config's default layer.
* @returns {*}
* @access public
*/
shift(key, id) {
return this._mutate({ id, key, action: 'shift' });
}
/**
* Returns a string prepresentation of the configuration.
*
* @param {Number} [indentation=2] The number of spaces to indent the JSON formatted output.
* @returns {String}
* @access public
*/
toString(indentation) {
return this.layers.toString(indentation);
}
/**
* Unloads a layer and its store by id. If the id does not exist, nothing happens.
*
* @param {String} id - The id name to unload.
* @returns {Boolean} Returns `true` if the id exists and was unloaded.
* @access public
*/
unload(id) {
if (!id) {
throw new TypeError('Missing required layer id to unload');
}
const layer = this.layers.get(id);
if (!layer) {
throw new Error(`Layer "${String(id)}" not found`);
}
return this.layers.remove(id);
}
/**
* Adds an item to the beginning of an array type config value.
*
* @param {String|Array.<String>} key - The config key.
* @param {*} value - The value to add.
* @param {String|Symbol} [id] - The id for a specific layer. If not specified, then it uses
* the config's default layer.
* @returns {Config}
* @access public
*/
unshift(key, value, id) {
this._mutate({ id, key, action: 'unshift', value });
return this;
}
/**
* Removes a watch handler.
*
* @param {Function} handler - A callback to fire when a change occurs.
* @returns {Config}
* @access public
*/
unwatch(handler) {
if (typeof handler !== 'function') {
throw new TypeError('Expected handler to be a function');
}
const handlers = this.watcherMap.get(handler);
if (handlers) {
for (const desc of handlers) {
this.layers.unwatch(desc.wrapped);
}
this.watcherMap.delete(handler);
}
return this;
}
/**
* Registers a watch handler.
*
* @param {String|Array.<String>} [filter] - A property name or array of nested properties to
* watch.
* @param {Function} handler - A callback to fire when a change occurs.
* @returns {Config}
* @access public
*/
watch(filter, handler) {
if (typeof filter === 'function') {
handler = filter;
filter = undefined;
}
if (typeof handler !== 'function') {
throw new TypeError('Expected handler to be a function');
}
filter = splitKey(filter);
let handlers = this.watcherMap.get(handler);
let desc = handlers?.find(desc => !(desc.filter < filter || desc.filter > filter));
// check if this handler is already registered
if (desc) {
return this;
}
if (!handlers) {
this.watcherMap.set(handler, handlers = []);
}
desc = {
filter,
wrapped: (...args) => {
const filterHash = hashValue(filter);
if (!this.pending[filterHash]) {
this.pending[filterHash] = new Map();
}
this.pending[filterHash].set(handler, { args, filter });
if (!this.paused) {
this._notify();
}
}
};
handlers.push(desc);
this.layers.watch(filter, desc.wrapped);
return this;
}
} |
JavaScript | class Module {
constructor (name, desc, author = 'unknown', commandsArray) {
this.name = name
this.description = desc
this.author = author
this.commands = commandsArray
}
} |
JavaScript | class InputIntention {
constructor(nodeActorID, nodeID, nodeType, nodeName) {
this.nodeActorID = nodeActorID; // parent actor id
this.nodeID = nodeID ;
this.nodeType = nodeType;
this.nodeName = nodeName;
}
} |
JavaScript | class BootstrapFormUtils {
/**
* Creates a bootstrap form group div element with given input parameters.
*
* @param {string} ID_ATTRIBUTE_VALUE - The id attribute value.
* @param {Object} LABEL_ELEMENT - The label element.
* @param {Object} INPUT_ELEMENT - The input element (Input or Select).
* @return {Object} The form group div element.
*/
static createFormGroupElement(ID_ATTRIBUTE_VALUE, LABEL_ELEMENT, INPUT_ELEMENT) {
const FORM_GROUP_ELEMENT = document.createElement('div');
FORM_GROUP_ELEMENT.setAttribute('id', ID_ATTRIBUTE_VALUE);
FORM_GROUP_ELEMENT.setAttribute('class', 'form-group');
FORM_GROUP_ELEMENT.appendChild(LABEL_ELEMENT);
FORM_GROUP_ELEMENT.appendChild(INPUT_ELEMENT);
return FORM_GROUP_ELEMENT;
}
/**
* Creates a bootstrap label element with given input parameters.
*
* @param {string} FOR_ATTRIBUTE_VALUE - The for attribute value.
* @param {string} NAME - The name of the label.
* @return {Object} The label element.
*/
static createLabelElement(FOR_ATTRIBUTE_VALUE, NAME) {
const LABEL_ELEMENT = document.createElement('label');
LABEL_ELEMENT.setAttribute('for', FOR_ATTRIBUTE_VALUE);
LABEL_ELEMENT.innerHTML = NAME;
return LABEL_ELEMENT;
}
/**
* Creates a bootstrap input element with given input parameters.
*
* @param {string} ID_ATTRIBUTE_VALUE - The id attribute value.
* @param {string} TYPE - The type.
* @param {boolean} REQUIRED - True if required.
* @param {string} TEXT - The text.
* @return {Object} The input element.
*/
static createInputElement(ID_ATTRIBUTE_VALUE, TYPE, REQUIRED) {
const INPUT_ELEMENT = document.createElement('input');
INPUT_ELEMENT.setAttribute('id', ID_ATTRIBUTE_VALUE);
INPUT_ELEMENT.setAttribute('type', TYPE || 'text');
INPUT_ELEMENT.setAttribute('class', 'form-control');
INPUT_ELEMENT.required = REQUIRED;
return INPUT_ELEMENT;
}
/**
* Creates a bootstrap select element with given input parameters.
*
* @param {string} ID_ATTRIBUTE_VALUE - The id attribute value.
* @param {Object[]} OPTIONS - The options for the select.
* @param {string} OPTIONS[].value - The value for a select option.
* @param {string} OPTIONS[].text - The text for a select option.
* @return {Object} The select element.
*/
static createSelectElement(ID_ATTRIBUTE_VALUE, OPTIONS) {
const SELECT_ELEMENT = document.createElement('select');
SELECT_ELEMENT.setAttribute('id', ID_ATTRIBUTE_VALUE);
SELECT_ELEMENT.setAttribute('class', 'form-control');
FormUtils.addOptionsToSelectElement(OPTIONS, SELECT_ELEMENT);
return SELECT_ELEMENT;
}
} |
JavaScript | class Inject {
constructor(){
// Injecting an encrypted stream into the
// web application.
const stream = new EncryptedStream(PairingTags.INJECTED, IdGenerator.text(64));
// Waiting for arkid to push itself onto the application
stream.listenWith(msg => {
if(msg && msg.hasOwnProperty('type') && msg.type === NetworkMessageTypes.PUSH_ARKID)
window.arkid = new ArkIddapp(stream, msg.payload);
});
// Syncing the streams between the
// extension and the web application
stream.sync(PairingTags.ARKID, stream.key);
}
} |
JavaScript | class GluonElement extends HTMLElement {
constructor() {
super();
this.renderRoot = this.createRenderRoot();
// This ensures that any properties that are set prior to upgrading this element
// have their instance setters called
Object.getOwnPropertyNames(this).forEach(property => {
const propertyValue = this[property];
delete this[property];
this[property] = propertyValue;
});
}
/**
* Returns an open shadowRoot as the default rendering root
*
* Override this method to provide an alternative rendering root
* For example, return `this` to render the template as childNodes
*/
createRenderRoot() {
return this.attachShadow({ mode: 'open' });
}
/**
* Returns the HTML tagname for elements of this class
*
* It defaults to the kebab-cased version of the class name. To override,
* defined a `static get is()` property on your custom element class, and return
* whatever string you want to use for the HTML tagname
*/
static get is() {
return (this.hasOwnProperty(TAG) && this[TAG]) || (this[TAG] = camelToKebab(this.name));
}
/**
* Called when an element is connected to the DOM
*
* When an element has a `template`, attach a shadowRoot to the element,
* and render the template. Once the template is rendered, creates an ID cache
* in the `$` property
*
* When adding a `connectedCallback` to your custom element, you should call
* `super.connectedCallback()` before doing anything other than actions
* that alter the result of the template rendering.
*/
connectedCallback() {
if ('template' in this) {
this.render({ sync: true });
createIdCache(this);
}
}
/**
* Renders the template for this element into the shadowRoot
*
* @param { sync }: perform a synchronous (blocking) render. The default render
* is asynchronous, and multiple calls to `render()` are batched by default
*
* @returns a Promise that resolves once template has been rendered
*/
async render({ sync = false } = {}) {
this[NEEDSRENDER] = true;
if (!sync) {
await 0;
}
if (this[NEEDSRENDER]) {
this[NEEDSRENDER] = false;
render(this.template, this.renderRoot, { scopeName: this.constructor.is, eventContext: this });
}
}
} |
JavaScript | class Bifunctor extends Functor {
/**
* @param value1 {*}
* @param value2 {*}
* @private
* @returns {Bifunctor}
*/
constructor(value1, value2) {
super(value1);
this.value2 = value2;
}
/**
* Returns wrapped 'second' value.
* @method module:functor.Bifunctor#value2Of
* @returns {*}
*/
value2Of() {
return this.value2;
}
/**
* Allows you to map over first 'contained' value.
* @method module:functor.Bifunctor#first
* @param fn {Function} - Unary operation.
* @returns {Bifunctor}
*/
first (fn) {
return new this.constructor(fn(this.valueOf()), this.value2Of());
}
/**
* Allows you to map over second 'contained' value.
* @method module:functor.Bifunctor#second
* @param fn {Function} - Unary operation.
* @returns {Bifunctor}
*/
second (fn) {
return new this.constructor(this.valueOf(), fn(this.value2Of()));
}
/**
* Allows you to map 2 functions over contained values - One function over each value.
* @method module:functor.Bifunctor#bimap
* @param fn1 {Function} - Unary op.
* @param fn2 {Function} - Unary op.
* @returns {Bifunctor}
*/
bimap (fn1, fn2) {
return new this.constructor(
fn1(this.valueOf()),
fn2(this.value2Of())
);
}
} |
JavaScript | class GridVisuals extends XSys {
/**
* create chart world
* @param {ECS} ecs
* @param {object} options
* options.chart: json chart section
* @param {array} json visuas configuration.
* @constructor GridVisuals */
constructor(ecs, options, json) {
super(ecs);
this.logged = false;
this.ecs = ecs;
this.cmd = [];
ecs.registerComponent('GridElem', GridElem);
if (!options.chart)
throw new XError('GridVisuals can only been created synchronously with json data (options.chart) for initializing');
/** @property {CoordsGrid} grid - grid space manager
* @member GridVisuals#grid
*/
if (!x.chart || !x.chart.grid) {
this.grid = new CoordsGrid(options.chart, json);
x.chart = Object.assign(x.chart || new Object(), {grid: this.grid});
}
else this.grid = x.chart.grid;
if (ecs) {
/** @property {object} elems - {xyzLine, xyzPlane, axisPlane}, where<br>
* xyzLine is a THREE.Object3D, with children of 3 vertical lines;<br>
* xyzPlane is a THREE.Object3D, with children of 3 vertical plane,
* can be used for highlight value grid;<br>
* axisPlane, {yz, zx, xy} is an array of 3 THREE.Object3D, with children of 3 vertical plane at axes plane;<br>
* @member GridVisuals#elems
*/
this.elems = this.visuals(ecs, options, json);
}
this.movePlane = true; // xyzPlane movable
}
/**
* @param {int} tick
* @param {array<Entity>} entites
* @member GridVisuals#update
* @function
*/
update(tick, entities) {
if (x.xview.flag > 0 && x.xview.picked && x.xview.picked.GridValue) {
var gridval = x.xview.picked.GridValue;
var y = this.grid.barHeight(gridval.val);
this.strechLines(gridval.gridx, [0, y, 0]);
if (this.movePlane) {
}
}
}
/** Generate chart visual elements.
* @param {ECS} ecs
* @param {object} options
* @param {object} json
* @member GridVisuals#visuals
* @function
*/
visuals(ecs, options, json) {
// var s = grid.space(vec3.add(options.chart.grid, 1));
var s = this.grid.space([1, 1, 1]);
// x, y, z line with value label
var idxline = options.lines;
var xyzLine = ecs.createEntity({
id: 'xyz-line',
Obj3: { geom: Obj3Type.PointSects,
box: [] },
Visual:{vtype: AssetType.DynaSects,
paras: {
// position updated with strechLines(), see update()
sects:[[[0, 0, 0], [0, 0, 0]],
[[0, 0, 0], [0, 0, 0]],
[[0, 0, 0], [0, 0, 0]]],
origin: [0, 0, 0],
scale: s,
color: idxline && idxline.color || 0xcc00ff } },
GridElem: {}
});
var bounds = this.grid.spaceBound();
var xPlane = ecs.createEntity({
id: 'x-plane',
Obj3: { geom: Obj3Type.PLANE,
transform: [{rotate: {deg: 90, axis: [0, 1, 0]}},
{translate: [0, bounds[1]/2, bounds[2]/2]}],
uniforms: {opacity: 0.5},
box: [bounds[2], bounds[1]] },
Visual:{vtype: AssetType.mesh_basic,
asset: options.planes.tex,
paras: {
blending: THREE.AdditiveBlending,
color: 0x770000 } },
GridElem: {}
});
var yPlane = ecs.createEntity({
id: 'y-plane',
Obj3: { geom: Obj3Type.PLANE,
transform: [{rotate: {deg: -90, axis: [1, 0, 0]}},
{translate: [bounds[0]/2, 0, bounds[2]/2]}],
uniforms: {opacity: 0.5},
box: [bounds[0], bounds[2]] },
Visual:{vtype: AssetType.mesh_basic,
asset: options.planes.tex,
paras: {
blending: THREE.AdditiveBlending,
color: 0x007700 } },
GridElem: {}
});
var zPlane = ecs.createEntity({
id: 'z-plane',
Obj3: { geom: Obj3Type.PLANE,
transform: [{translate: [bounds[0]/2, bounds[1]/2, 0]}],
uniforms: {opacity: 0.5},
box: bounds },
Visual:{vtype: AssetType.mesh_basic,
asset: options.planes.tex,
paras: {
blending: THREE.AdditiveBlending,
color: 0x000077 } },
GridElem: {}
});
return {xyzLine,
xyzPlane: {yz: xPlane, xz: yPlane, xy: zPlane} };
}
/**Set value indicating lines to grid, with offset in value range (befor scale
* to world).
*
* This method modifying the lines' vertices position buffer directly.
* @param {array<int>} gridIx
* @param {array<number>} [offset = [0, 0, 0]]
* @return {GridVisuals} this
* @member GridVisuals#strechLines
* @function
*/
strechLines (gridIx, offset = [0, 0, 0]) {
var p = this.grid.worldPos(this.xyzBuf, gridIx);
return this.strechLinesWorld(p, offset);
}
/**Set value indicating lines to position in world, with offset in world.
*
* This method modifying the lines' vertices position buffer directly.
* @param {array<int>} gridIx
* @param {array<number>} offset
* @return {GridVisuals} this
* @member GridVisuals#strechLines
* @function
*/
strechLinesWorld (p, offset) {
var s = this.elems.xyzLine.Obj3.mesh.geometry.attributes.position.array;
var x = 0;
s[x + 0] = p[0] + offset[0];
s[x + 1] = p[1] + offset[1];
s[x + 2] = p[2] + offset[2];
s[x + 4] = p[1] + offset[1];
s[x + 5] = p[2] + offset[2];
//
var y = 6;
s[y + 0] = p[0] + offset[0];
s[y + 1] = p[1] + offset[1];
s[y + 2] = p[2] + offset[2];
s[y + 3] = p[0] + offset[0];
s[y + 5] = p[2] + offset[2];
//
var z = 12;
s[z + 0] = p[0] + offset[0];
s[z + 1] = p[1] + offset[1];
s[z + 2] = p[2] + offset[2];
s[z + 3] = p[0] + offset[0];
s[z + 4] = p[1] + offset[1];
this.elems.xyzLine.Obj3.mesh.geometry.attributes.position.needsUpdate = true;
this.xyzBuf = p;
return this;
}
setPlanePos (gridIx) {
}
} |
JavaScript | class DesktopIconView {
constructor(wm) {
this.dialog = null;
this.$iconview = null;
this.$element = document.createElement('gui-icon-view');
this.$element.setAttribute('data-multiple', 'false');
//this.$element.setAttribute('no-selection', 'true');
this.$element.id = 'CoreWMDesktopIconView';
this.shortcutCache = [];
this.refreshTimeout = null;
GUI.createDroppable(this.$element, {
onOver: function(ev, el, args) {
wm.onDropOver(ev, el, args);
},
onLeave: function() {
wm.onDropLeave();
},
onDrop: function() {
wm.onDrop();
},
onItemDropped: function(ev, el, item, args) {
wm.onDropItem(ev, el, item, args);
},
onFilesDropped: function(ev, el, files, args) {
wm.onDropFile(ev, el, files, args);
}
});
this.$iconview = GUIElement.createFromNode(this.$element);
this.$iconview.build();
this.$iconview.on('select', () => {
if ( wm ) {
const win = wm.getCurrentWindow();
if ( win ) {
win._blur();
}
}
}).on('activate', (ev) => {
if ( ev && ev.detail ) {
ev.detail.entries.forEach((entry) => {
const item = entry.data;
const file = new FileMetadata(item);
Process.createFromFile(file, item.args);
});
}
}).on('contextmenu', (ev) => {
if ( ev && ev.detail && ev.detail.entries ) {
this.createContextMenu(ev.detail.entries[0], ev);
}
});
this._refresh();
}
destroy() {
DOM.$remove(this.$element);
this.refreshTimeout = clearTimeout(this.refreshTimeout);
this.$element = null;
this.$iconview = null;
if ( this.dialog ) {
this.dialog.destroy();
}
this.dialog = null;
this.shortcutCache = [];
}
blur() {
const cel = GUIElement.createFromNode(this.$element);
cel.set('value', null);
}
getRoot() {
return this.$element;
}
resize(wm) {
const el = this.getRoot();
const s = wm.getWindowSpace();
if ( el ) {
el.style.top = (s.top) + 'px';
el.style.left = (s.left) + 'px';
el.style.width = (s.width) + 'px';
el.style.height = (s.height) + 'px';
}
}
_refresh(wm) {
const desktopPath = WindowManager.instance.getSetting('desktopPath');
const shortcutPath = FS.pathJoin(desktopPath, '.shortcuts.json');
this.shortcutCache = [];
this.refreshTimeout = clearTimeout(this.refreshTimeout);
this.refreshTimeout = setTimeout(() => {
VFS.scandir(desktopPath, {backlink: false}).then((result) => {
if ( this.$iconview ) {
const entries = result.map((iter) => {
if ( iter.type === 'application' || iter.shortcut === true ) {
const niter = new FileMetadata(iter);
niter.shortcut = true;
const idx = this.shortcutCache.push(niter) - 1;
const file = new FileMetadata(iter);
file.__index = idx;
return {
_type: iter.type,
icon: Theme.getFileIcon(iter, '32x32'),
label: iter.filename,
value: file,
args: iter.args || {}
};
}
return {
_type: 'vfs',
icon: Theme.getFileIcon(iter, '32x32'),
label: iter.filename,
value: iter
};
}).filter(function(iter) {
return iter.value.path !== shortcutPath;
});
this.$iconview.clear().add(entries);
}
});
}, 150);
}
_save(refresh) {
const desktopPath = WindowManager.instance.getSetting('desktopPath');
const path = FS.pathJoin(desktopPath, '.shortcuts.json');
const cache = this.shortcutCache;
VFS.mkdir(FS.dirname(path)).finally(() => {
VFS.write(path, JSON.stringify(cache, null, 4)).then(() => {
if ( refresh ) { // Normally caught by VFS message in main.js
this._refresh();
}
});
});
}
updateShortcut(data, values) {
const o = this.shortcutCache[data.__index];
if ( o.path === data.path ) {
Object.keys(values).forEach(function(k) {
o[k] = values[k];
});
this._save(true);
}
}
getShortcutByPath(path) {
let found = null;
let index = -1;
this.shortcutCache.forEach(function(i, idx) {
if ( !found ) {
if ( i.type !== 'application' && i.path === path ) {
found = i;
index = idx;
}
}
});
return {item: found, index: index};
}
addShortcut(data, wm, save) {
(['icon']).forEach(function(k) {
if ( data[k] ) {
delete data[k];
}
});
if ( data.type === 'application' ) {
data.args = data.args || {};
}
data.shortcut = true;
this.shortcutCache.push(data);
this._save(true);
}
removeShortcut(data) {
const o = this.shortcutCache[data.__index];
if ( o && o.path === data.path ) {
this.shortcutCache.splice(data.__index, 1);
this._save(true);
}
}
_getContextMenu(item) {
const desktopPath = WindowManager.instance.getSetting('desktopPath');
const menu = [
{
title: _('LBL_UPLOAD'),
onClick: () => {
Dialog.create('FileUpload', {
dest: desktopPath
}, () => {
this._refresh();
});
}
},
{
title: _('LBL_CREATE'),
menu: [{
title: _('LBL_FILE'),
onClick: () => {
createCreateDialog('New file', desktopPath, (f) => {
VFS.write(f, '').catch((err) => {
OSjs.error('CoreWM', _('ERR_VFSMODULE_MKFILE'), err);
});
});
}
}, {
title: _('LBL_DIRECTORY'),
onClick: () => {
createCreateDialog('New directory', desktopPath, (f) => {
VFS.mkdir(f).catch((err) => {
OSjs.error('CoreWM', _('ERR_VFSMODULE_MKDIR'), err);
});
});
}
}]
}
];
if ( item && item.data ) {
const file = item.data;
if ( file.type === 'application' ) {
menu.push({
title: _('Edit shortcut'),
onClick: () => this.openShortcutEdit(file)
});
}
const m = MountManager.getModuleFromPath(file.path);
if ( !m || m.option('root') !== desktopPath ) {
menu.push({
title: _('Remove shortcut'),
onClick: () => this.removeShortcut(file)
});
} else {
menu.push({
title: _('LBL_DELETE'),
onClick: () =>VFS.unlink(file) // Caught by VFS message in main.js
});
}
}
return menu;
}
createContextMenu(item, ev) {
const wm = WindowManager.instance;
const menu = wm._getContextMenu(item);
Menu.create(menu, ev);
}
openShortcutEdit(item) {
if ( this.dialog ) {
this.dialog._close();
}
const wm = WindowManager.instance;
this.dialog = new IconViewShortcutDialog(item, wm._scheme, (button, values) => {
if ( button === 'ok' ) {
this.updateShortcut(item, values);
}
this.dialog = null;
});
wm.addWindow(this.dialog, true);
}
} |
JavaScript | class Fibonacci {
constructor(max) {
this.max = max;
}
[Symbol.iterator] () {
let num1 = 0;
let num2 = 1;
let count = 0;
const max = this.max;
return {
next() {
const val = num1 + num2;
num1 = num2;
num2 = val;
count++;
return {
value: val, done: count > max
}
}
}
}
} |
JavaScript | class Workflow extends AbstractModelType
{
/**
* Creates a new workflow
*
* @param {Object} inputData - the object received from Calling service, or null if constructing from scratch.
*/
constructor(inputData)
{
super();
this.links = null;
this.actions = null;
this.appState = null;
this.notificationSubscriptions = [ CallingModelEnums.NotificationType.CallStateChange ];
this.additionalData = null;
this.populatePlainInput(inputData, {
'links' : attrData => { return new CallBackLink(attrData); },
'actions' : attrData => { return Actions.instantiateAction(attrData); }});
}
/**
* validates the object instance
*
* @param context
* @returns {Array} - validation errors
*/
validate(context)
{
var errors = [];
errors = errors.concat(ModelValidation.validateOptionalTypedObject(context, this.links, CallBackLink, 'Workflow.links', 'CallBackLink'));
errors = errors.concat(ModelValidation.validateOptionalString(context, this.appState, 'Workflow.appState', false, CallingModelLimits.AppStateLength.Max));
errors = errors.concat(ModelValidation.validateEnumArray(context, this.notificationSubscriptions, CallingModelEnums.NotificationType, 'Workflow.notificationSubscriptions'));
if(Array.isArray(this.notificationSubscriptions) && this.notificationSubscriptions.indexOf(CallingModelEnums.NotificationType.CallStateChange) < 0)
{
errors.push('Workflow.notificationSubscriptions does not contain subscription to ' + CallingModelEnums.NotificationType.CallStateChange + ' notification as it should');
}
errors = errors.concat(ModelValidation.validateGenericObject(context, this.additionalData, 'Workflow.additionalData'));
errors = errors.concat(Actions.validateActionArray(context, this.actions, 'Workflow.actions'));
return errors;
}
} |
JavaScript | class Component {
/**
* @experimental
*/
constructor(project) {
this.project = project;
project._addComponent(this);
}
/**
* (experimental) Called before synthesis.
*
* @experimental
*/
preSynthesize() { }
/**
* (experimental) Synthesizes files to the project output directory.
*
* @experimental
*/
synthesize() { }
/**
* (experimental) Called after synthesis.
*
* Order is *not* guaranteed.
*
* @experimental
*/
postSynthesize() { }
} |
JavaScript | class ContactValidator {
/**
* Check contact fields
*
* @static
* @param {object} request - request object
* @param {object} response - response object
* @param {object} next - next object
* @returns {object} response object
* @memberof ContactValidator *
*/
static checkContactFields(request, response, next) {
const { name, password, phoneNumber } = request.body;
if ((!name || !name.replace(/\s/g, '').length) || (!password || !password.replace(/\s/g, '').length) || (!phoneNumber || !phoneNumber.replace(/\s/g, '').length)) {
CustomError.handleError('Invalid Payloads', 400, response);
}
else {
next();
}
}
/**
* Check Login fields
*
* @static
* @param {object} request - request object
* @param {object} response - response object
* @param {object} next - next object
* @returns {object} response object
* @memberof ContactValidator *
*/
static checkLoginFields(request, response, next) {
const { password, phoneNumber } = request.body;
if (!password.replace(/\s/g, '').length || !phoneNumber.replace(/\s/g, '').length) {
CustomError.handleError('Invalid Payloads', 400, response);
}
else {
next();
}
}
/**
* Check contact route params
*
* @static
* @param {object} request - request object
* @param {object} response - response object
* @param {object} next - next object
* @returns {object} response object
* @memberof ContactValidator *
*/
static checkParam(request, response, next) {
const { contactId } = request.params;
if (!Number(contactId)) {
CustomError.handleError('Invalid contact id parameter', 400, response);
}
else {
next();
}
}
} |
JavaScript | class Convolver extends ToneAudioNode {
constructor() {
super(optionsFromArguments(Convolver.getDefaults(), arguments, ["url", "onload"]));
this.name = "Convolver";
/**
* The native ConvolverNode
*/
this._convolver = this.context.createConvolver();
const options = optionsFromArguments(Convolver.getDefaults(), arguments, ["url", "onload"]);
this._buffer = new ToneAudioBuffer(options.url, buffer => {
this.buffer = buffer;
options.onload();
});
this.input = new Gain({ context: this.context });
this.output = new Gain({ context: this.context });
// set if it's already loaded, set it immediately
if (this._buffer.loaded) {
this.buffer = this._buffer;
}
// initially set normalization
this.normalize = options.normalize;
// connect it up
this.input.chain(this._convolver, this.output);
}
static getDefaults() {
return Object.assign(ToneAudioNode.getDefaults(), {
normalize: true,
onload: noOp,
});
}
/**
* Load an impulse response url as an audio buffer.
* Decodes the audio asynchronously and invokes
* the callback once the audio buffer loads.
* @param url The url of the buffer to load. filetype support depends on the browser.
*/
load(url) {
return __awaiter(this, void 0, void 0, function* () {
this.buffer = yield this._buffer.load(url);
});
}
/**
* The convolver's buffer
*/
get buffer() {
if (this._buffer.length) {
return this._buffer;
}
else {
return null;
}
}
set buffer(buffer) {
if (buffer) {
this._buffer.set(buffer);
}
// if it's already got a buffer, create a new one
if (this._convolver.buffer) {
// disconnect the old one
this.input.disconnect();
this._convolver.disconnect();
// create and connect a new one
this._convolver = this.context.createConvolver();
this.input.chain(this._convolver, this.output);
}
const buff = this._buffer.get();
this._convolver.buffer = buff ? buff : null;
}
/**
* The normalize property of the ConvolverNode interface is a boolean that
* controls whether the impulse response from the buffer will be scaled by
* an equal-power normalization when the buffer attribute is set, or not.
*/
get normalize() {
return this._convolver.normalize;
}
set normalize(norm) {
this._convolver.normalize = norm;
}
dispose() {
super.dispose();
this._buffer.dispose();
this._convolver.disconnect();
return this;
}
} |
JavaScript | class FsException {
constructor (message, innerException = null) {
this.message = message
this.name = 'FsException'
this.innerException = innerException
this.stack = (new Error()).stack
}
toString () {
return `${this.name}: "${this.message}"`
}
} |
JavaScript | class FsError extends Error {
constructor (message, innerException = null) {
super(message)
this.name = 'FsError'
this.innerException = innerException
this.stack = (new Error()).stack
}
toString () {
return `${this.name}: "${this.message}"`
}
} |
JavaScript | class Restaurant {
constructor(budget) {
this.budgetMoney = budget;
this.menu = {};
this.stockProducts = {};
this.history = [];
};
/**
*
* @param {Array<String>} products "{productName} {productQuantity} {productTotalPrice}"
*/
loadProducts(products) {
const result = [];
for (const product of products) {
let currentOperation = '';
let [productName, productQuantity, productTotalPrice] = product
.split(' ')
.map(x => x.trim())
.filter(x => x !== '');
productQuantity = Number(productQuantity);
productTotalPrice = Number(productTotalPrice);
if(productTotalPrice <= this.budgetMoney) {
this.budgetMoney -= productTotalPrice;
if(!this.stockProducts.hasOwnProperty(productName)) {
this.stockProducts[productName] = 0;
}
this.stockProducts[productName] += productQuantity;
currentOperation = `Successfully loaded ${productQuantity} ${productName}`;
} else {
currentOperation = `There was not enough money to load ${productQuantity} ${productName}`;
}
result.push(currentOperation);
this.history.push(currentOperation);
}
return result.join('\n')
};
/**
*
* @param {String} meal
* @param {Array<String>} neededProducts "{productName} {productQuantity}"
* @param {Number} price
*/
addToMenu(meal, neededProducts, price) {
if(this.menu.hasOwnProperty(meal)) {
return `The ${meal} is already in the our menu, try something different.`;
}
const products = neededProducts
.map(p => p.split(' '))
.reduce((a, v) => ({...a, [v[0]]: Number(v[1])}), {});
this.menu[meal] = {
price,
products
};
const menuItemsCount = Object.keys(this.menu).length;
if(menuItemsCount === 1) {
return `Great idea! Now with the ${meal} we have 1 meal in the menu, other ideas?`;
}
return `Great idea! Now with the ${meal} we have ${menuItemsCount} meals in the menu, other ideas?`
};
showTheMenu() {
const menuItemsCount = Object.keys(this.menu).length;
if(menuItemsCount <= 0) {
return 'Our menu is not ready yet, please come later...';
}
return Object
.keys(this.menu)
.map(k => `${k} - $ ${this.menu[k].price}`)
.join('\n');
};
/**
*
* @param {String} meal
*/
makeTheOrder(meal) {
if(!this.menu.hasOwnProperty(meal)){
return `There is not ${meal} yet in our menu, do you want to order something else?`;
}
const products = Object.keys(this.menu[meal].products);
if(products.some(p => !this.stockProducts.hasOwnProperty(p) || this.stockProducts[p] < this.menu[meal].products[p])){
return `For the time being, we cannot complete your order (${meal}), we are very sorry...`;
}
products.forEach(p => this.stockProducts[p] -= this.menu[meal].products[p]);
return `Your order (${meal}) will be completed in the next 30 minutes and will cost you ${this.menu[meal].price}.`;
};
} |
JavaScript | class ActionModel {
constructor() {
this._name = '';
this._options = {};
this._instance = null; //
}
/**
* Create a new instance from a json object
*
* @param object
*/
static fromJson(object) {
let trueOrError = ActionModel.validate(object);
if(trueOrError !== true) {
console.error(trueOrError);
return null;
}
let instance = new ActionModel();
instance._name = object.name;
instance._options = object.options;
return instance;
}
/**
* Returns true if the object has valid action data. And a string containing errors if not valid.
*
* @param object
*/
static validate(object) {
if (typeof object !== "object" || typeof object === "undefined") return "Action: The action was not valid. The options parameter must be an object";
if (!object.hasOwnProperty('name') || typeof object.name !== "string") return "Action: The action was not valid. It must contain a string property called name";
if (!object.hasOwnProperty('options') || typeof object.options !== "object") return "Action: The action was not valid. It must contain an object property called options";
return true;
}
/**
* @return {string}
*/
get name() {
return this._name;
}
/**
* @return {{}}
*/
get options() {
return this._options;
}
} |
JavaScript | class ToneOscillatorNode extends OneShotSource {
constructor() {
super(optionsFromArguments(ToneOscillatorNode.getDefaults(), arguments, ["frequency", "type"]));
this.name = "ToneOscillatorNode";
/**
* The oscillator
*/
this._oscillator = this.context.createOscillator();
this._internalChannels = [this._oscillator];
const options = optionsFromArguments(ToneOscillatorNode.getDefaults(), arguments, ["frequency", "type"]);
connect(this._oscillator, this._gainNode);
this.type = options.type;
this.frequency = new Param({
context: this.context,
param: this._oscillator.frequency,
units: "frequency",
value: options.frequency,
});
this.detune = new Param({
context: this.context,
param: this._oscillator.detune,
units: "cents",
value: options.detune,
});
readOnly(this, ["frequency", "detune"]);
}
static getDefaults() {
return Object.assign(OneShotSource.getDefaults(), {
detune: 0,
frequency: 440,
type: "sine",
});
}
/**
* Start the oscillator node at the given time
* @param time When to start the oscillator
*/
start(time) {
const computedTime = this.toSeconds(time);
this.log("start", computedTime);
this._startGain(computedTime);
this._oscillator.start(computedTime);
return this;
}
_stopSource(time) {
this._oscillator.stop(time);
}
/**
* Sets an arbitrary custom periodic waveform given a PeriodicWave.
* @param periodicWave PeriodicWave should be created with context.createPeriodicWave
*/
setPeriodicWave(periodicWave) {
this._oscillator.setPeriodicWave(periodicWave);
return this;
}
/**
* The oscillator type. Either 'sine', 'sawtooth', 'square', or 'triangle'
*/
get type() {
return this._oscillator.type;
}
set type(type) {
this._oscillator.type = type;
}
/**
* Clean up.
*/
dispose() {
super.dispose();
if (this.state === "started") {
this.stop();
}
this._oscillator.disconnect();
this.frequency.dispose();
this.detune.dispose();
return this;
}
} |
JavaScript | class MongoMemoryReplSet extends events_1.EventEmitter {
constructor(opts = {}) {
var _a;
super();
/**
* All servers this ReplSet instance manages
*/
this.servers = [];
this._state = MongoMemoryReplSetStates.stopped;
this._ranCreateAuth = false;
this.binaryOpts = Object.assign({}, opts.binary);
this.instanceOpts = (_a = opts.instanceOpts) !== null && _a !== void 0 ? _a : [];
this.replSetOpts = Object.assign({}, opts.replSet);
}
/**
* Change "this._state" to "newState" and emit "newState"
* @param newState The new State to set & emit
*/
stateChange(newState, ...args) {
this._state = newState;
this.emit(MongoMemoryReplSetEvents.stateChange, newState, ...args);
}
/**
* Create an instance of "MongoMemoryReplSet" and call start
* @param opts Options for the ReplSet
*/
static create(opts) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
log('create: Called .create() method');
const replSet = new this(Object.assign({}, opts));
yield replSet.start();
return replSet;
});
}
/**
* Get Current state of this class
*/
get state() {
return this._state;
}
/**
* Get & Set "instanceOpts"
* @throws if "state" is not "stopped"
*/
get instanceOpts() {
return this._instanceOpts;
}
set instanceOpts(val) {
assertionIsMMSRSState(MongoMemoryReplSetStates.stopped, this._state);
this._instanceOpts = val;
}
/**
* Get & Set "binaryOpts"
* @throws if "state" is not "stopped"
*/
get binaryOpts() {
return this._binaryOpts;
}
set binaryOpts(val) {
assertionIsMMSRSState(MongoMemoryReplSetStates.stopped, this._state);
this._binaryOpts = val;
}
/**
* Get & Set "replSetOpts"
* (Applies defaults)
* @throws if "state" is not "stopped"
*/
get replSetOpts() {
return this._replSetOpts;
}
set replSetOpts(val) {
assertionIsMMSRSState(MongoMemoryReplSetStates.stopped, this._state);
const defaults = {
auth: false,
args: [],
name: 'testset',
count: 1,
dbName: utils_1.generateDbName(),
ip: '127.0.0.1',
spawn: {},
storageEngine: 'ephemeralForTest',
configSettings: {},
};
this._replSetOpts = Object.assign(Object.assign({}, defaults), val);
utils_1.assertion(this._replSetOpts.count > 0, new Error('ReplSet Count needs to be 1 or higher!'));
if (typeof this._replSetOpts.auth === 'object') {
this._replSetOpts.auth = utils_1.authDefault(this._replSetOpts.auth);
}
}
/**
* Returns instance options suitable for a MongoMemoryServer.
* @param baseOpts Options to merge with
*/
getInstanceOpts(baseOpts = {}) {
const opts = {
// disable "auth" if replsetopts has an object-auth
auth: typeof this._replSetOpts.auth === 'object' && !this._ranCreateAuth
? false
: !!this._replSetOpts.auth,
args: this._replSetOpts.args,
dbName: this._replSetOpts.dbName,
ip: this._replSetOpts.ip,
replSet: this._replSetOpts.name,
storageEngine: this._replSetOpts.storageEngine,
};
if (baseOpts.args) {
opts.args = this._replSetOpts.args.concat(baseOpts.args);
}
if (baseOpts.port) {
opts.port = baseOpts.port;
}
if (baseOpts.dbPath) {
opts.dbPath = baseOpts.dbPath;
}
if (baseOpts.storageEngine) {
opts.storageEngine = baseOpts.storageEngine;
}
log('getInstanceOpts: instance opts:', opts);
return opts;
}
/**
* Returns an mongodb URI that is setup with all replSet servers
* @param otherDb add an database into the uri (in mongodb its the auth database, in mongoose its the default database for models)
* @throws if state is not "running"
* @throws if an server doesnt have "instanceInfo.port" defined
* @return an valid mongo URI, by the definition of https://docs.mongodb.com/manual/reference/connection-string/
*/
getUri(otherDb) {
log('getUri:', this.state);
switch (this.state) {
case MongoMemoryReplSetStates.running:
case MongoMemoryReplSetStates.init:
break;
case MongoMemoryReplSetStates.stopped:
default:
throw new errors_1.StateError([MongoMemoryReplSetStates.running, MongoMemoryReplSetStates.init], this.state);
}
const hosts = this.servers
.map((s) => {
var _a;
const port = (_a = s.instanceInfo) === null || _a === void 0 ? void 0 : _a.port;
utils_1.assertion(!utils_1.isNullOrUndefined(port), new Error('Instance Port is undefined!'));
return `127.0.0.1:${port}`;
})
.join(',');
return utils_1.uriTemplate(hosts, undefined, utils_1.generateDbName(otherDb), [
`replicaSet=${this._replSetOpts.name}`,
]);
}
/**
* Start underlying `mongod` instances.
* @throws if state is already "running"
*/
start() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
log('start:', this.state);
switch (this.state) {
case MongoMemoryReplSetStates.stopped:
break;
case MongoMemoryReplSetStates.running:
default:
throw new errors_1.StateError([MongoMemoryReplSetStates.stopped], this.state);
}
this.stateChange(MongoMemoryReplSetStates.init); // this needs to be executed before "setImmediate"
// check if an "beforeExit" listener for "this.cleanup" is already defined for this class, if not add one
if (process
.listeners('beforeExit')
.findIndex((f) => f === this.cleanup) <= -1) {
process.on('beforeExit', this.cleanup);
}
yield utils_1.ensureAsync()
.then(() => this.initAllServers())
.then(() => this._initReplSet())
.catch((err) => {
if (!debug_1.default.enabled('MongoMS:MongoMemoryReplSet')) {
console.warn('Starting the ReplSet failed, enable debug for more information');
}
this.stateChange(MongoMemoryReplSetStates.stopped);
throw err;
});
});
}
/**
* Initialize & start all servers in the replSet
*/
initAllServers() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
log('initAllServers');
this.stateChange(MongoMemoryReplSetStates.init);
if (this.servers.length > 0) {
log('initAllServers: lenght of "servers" is higher than 0, starting existing servers');
yield Promise.all(this.servers.map((s) => s.start(true)));
return;
}
// Any servers defined within `_instanceOpts` should be started first as
// the user could have specified a `dbPath` in which case we would want to perform
// the `replSetInitiate` command against that server.
this._instanceOpts.forEach((opts, index) => {
log(`initAllServers: starting special server "${index + 1}" of "${this._instanceOpts.length}" from instanceOpts (count: ${this.servers.length + 1}):`, opts);
this.servers.push(this._initServer(this.getInstanceOpts(opts)));
});
while (this.servers.length < this._replSetOpts.count) {
log(`initAllServers: starting extra server "${this.servers.length + 1}" of "${this._replSetOpts.count}" (count: ${this.servers.length + 1})`);
this.servers.push(this._initServer(this.getInstanceOpts()));
}
log('initAllServers: waiting for all servers to finish starting');
// ensures all servers are listening for connection
yield Promise.all(this.servers.map((s) => s.start()));
});
}
/**
* Stop the underlying `mongod` instance(s).
* @param runCleanup run "this.cleanup"? (remove dbPath & reset "instanceInfo")
*/
stop(runCleanup = true) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
log('stop' + utils_1.isNullOrUndefined(process.exitCode) ? '' : ': called by process-event');
if (this._state === MongoMemoryReplSetStates.stopped) {
return false;
}
const bool = yield Promise.all(this.servers.map((s) => s.stop(false)))
.then(() => {
this.stateChange(MongoMemoryReplSetStates.stopped);
return true;
})
.catch((err) => {
log('stop:', err);
this.stateChange(MongoMemoryReplSetStates.stopped, err);
return false;
});
// return early if the instances failed to stop
if (!bool) {
return bool;
}
if (runCleanup) {
yield this.cleanup(false);
}
return true;
});
}
/**
* Remove the defined dbPath's
* This function gets automatically called on process event "beforeExit" (with force being "false")
* @param force Remove the dbPath even if it is no "tmpDir" (and re-check if tmpDir actually removed it)
* @throws If "state" is not "stopped"
* @throws If "instanceInfo" is not defined
* @throws If an fs error occured
*/
cleanup(force = false) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
assertionIsMMSRSState(MongoMemoryReplSetStates.stopped, this._state);
log(`cleanup for "${this.servers.length}" servers`);
process.removeListener('beforeExit', this.cleanup);
yield Promise.all(this.servers.map((s) => s.cleanup(force)));
this.servers = [];
return;
});
}
/**
* Wait until all instances are running
* @throws if state is "stopped" (cannot wait on something that dosnt start)
*/
waitUntilRunning() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
yield utils_1.ensureAsync();
log('waitUntilRunning:', this._state);
switch (this._state) {
case MongoMemoryReplSetStates.running:
// just return immediatly if the replSet is already running
return;
case MongoMemoryReplSetStates.init:
// wait for event "running"
yield new Promise((res) => {
// the use of "this" here can be done because "on" either binds "this" or uses an arrow function
function waitRunning(state) {
// this is because other states can be emitted multiple times (like stopped & init for auth creation)
if (state === MongoMemoryReplSetStates.running) {
this.removeListener(MongoMemoryReplSetEvents.stateChange, waitRunning);
res();
}
}
this.on(MongoMemoryReplSetEvents.stateChange, waitRunning);
});
return;
case MongoMemoryReplSetStates.stopped:
default:
throw new errors_1.StateError([MongoMemoryReplSetStates.running, MongoMemoryReplSetStates.init], this.state);
}
});
}
/**
* Connects to the first server from the list of servers and issues the `replSetInitiate`
* command passing in a new replica set configuration object.
* @throws if state is not "init"
* @throws if "servers.length" is not 1 or above
* @throws if package "mongodb" is not installed
*/
_initReplSet() {
var _a;
return tslib_1.__awaiter(this, void 0, void 0, function* () {
log('_initReplSet');
assertionIsMMSRSState(MongoMemoryReplSetStates.init, this._state);
utils_1.assertion(this.servers.length > 0, new Error('One or more servers are required.'));
const uris = this.servers.map((server) => server.getUri());
let con = yield mongodb_1.MongoClient.connect(uris[0], {
useNewUrlParser: true,
useUnifiedTopology: true,
});
log('_initReplSet: connected');
// try-finally to close connection in any case
try {
let adminDb = con.db('admin');
const members = uris.map((uri, index) => ({ _id: index, host: utils_1.getHost(uri) }));
const rsConfig = {
_id: this._replSetOpts.name,
members,
settings: Object.assign({ electionTimeoutMillis: 500 }, this._replSetOpts.configSettings),
};
// try-catch because the first "command" can fail
try {
log('_initReplSet: trying "replSetInitiate"');
yield adminDb.command({ replSetInitiate: rsConfig });
if (typeof this._replSetOpts.auth === 'object') {
log('_initReplSet: "this._replSetOpts.auth" is an object');
yield this._waitForPrimary();
const primary = this.servers.find((server) => { var _a; return (_a = server.instanceInfo) === null || _a === void 0 ? void 0 : _a.instance.isInstancePrimary; });
utils_1.assertion(!utils_1.isNullOrUndefined(primary), new Error('No Primary found'));
utils_1.assertion(!utils_1.isNullOrUndefined(primary.instanceInfo), new Error('Primary dosnt have an "instanceInfo" defined'));
yield primary.createAuth(primary.instanceInfo);
this._ranCreateAuth = true;
if (((_a = primary.opts.instance) === null || _a === void 0 ? void 0 : _a.storageEngine) !== 'ephemeralForTest') {
log('_initReplSet: closing connection for restart');
yield con.close(); // close connection in preparation for "stop"
yield this.stop(false); // stop all servers for enabling auth
log('_initReplSet: starting all server again with auth');
yield this.initAllServers(); // start all servers again with "auth" enabled
con = yield mongodb_1.MongoClient.connect(this.getUri('admin'), {
useNewUrlParser: true,
useUnifiedTopology: true,
authSource: 'admin',
authMechanism: 'SCRAM-SHA-256',
auth: {
user: this._replSetOpts.auth.customRootName,
password: this._replSetOpts.auth.customRootPwd,
},
});
adminDb = con.db('admin');
log('_initReplSet: auth restart finished');
}
else {
console.warn('Not Restarting ReplSet for Auth\n' +
'Storage engine of current PRIMARY is ephemeralForTest, which does not write data on shutdown, and mongodb does not allow changing "auth" runtime');
}
}
}
catch (e) {
if (e instanceof mongodb_1.MongoError && e.errmsg == 'already initialized') {
log(`_initReplSet: "${e.errmsg}": trying to set old config`);
const { config: oldConfig } = yield adminDb.command({ replSetGetConfig: 1 });
log('_initReplSet: got old config:\n', oldConfig);
yield adminDb.command({
replSetReconfig: oldConfig,
force: true,
});
}
else {
throw e;
}
}
log('_initReplSet: ReplSet-reconfig finished');
yield this._waitForPrimary();
this.stateChange(MongoMemoryReplSetStates.running);
log('_initReplSet: running');
}
finally {
yield con.close();
}
});
}
/**
* Create the one Instance (without starting them)
* @param instanceOpts Instance Options to use for this instance
*/
_initServer(instanceOpts) {
const serverOpts = {
binary: this._binaryOpts,
instance: instanceOpts,
spawn: this._replSetOpts.spawn,
auth: typeof this.replSetOpts.auth === 'object' ? this.replSetOpts.auth : undefined,
};
const server = new MongoMemoryServer_1.MongoMemoryServer(serverOpts);
return server;
}
/**
* Wait until the replSet has elected an Primary
* @param timeout Timeout to not run infinitly
* @throws if timeout is reached
*/
_waitForPrimary(timeout = 30000) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
log('_waitForPrimary: Waiting for an Primary');
let timeoutId;
// "race" because not all servers will be an primary
yield Promise.race([
...this.servers.map((server) => new Promise((res, rej) => {
const instanceInfo = server.instanceInfo;
if (utils_1.isNullOrUndefined(instanceInfo)) {
return rej(new Error('_waitForPrimary - instanceInfo not present'));
}
instanceInfo.instance.once(MongoInstance_1.MongoInstanceEvents.instancePrimary, res);
if (instanceInfo.instance.isInstancePrimary) {
log('_waitForPrimary: found instance being already primary');
res();
}
})),
new Promise((_res, rej) => {
timeoutId = setTimeout(() => {
rej(new Error(`Timed out after ${timeout}ms while waiting for an Primary`));
}, timeout);
}),
]);
if (!utils_1.isNullOrUndefined(timeoutId)) {
clearTimeout(timeoutId);
}
log('_waitForPrimary: detected one primary instance ');
});
}
} |
JavaScript | class WritePostButton extends Component {
static propTypes = {
/**
* A call back function for opening the write post page
*/
openRequest: PropTypes.func
}
constructor(props) {
super(props)
}
render() {
let { name, avatar, openRequest } = this.props
return (
<TouchableOpacity activeOpacity={0.7} onPress={openRequest}>
<Card >
<View style={{ flexDirection: 'row', padding: 8 }}>
<Avatar size="30" name={name || ' '} fileName={avatar} />
<View style={{ display: 'flex', flex: 1, flexDirection: 'column', marginLeft: 10, paddingTop: 5, paddingBottom: 5 }}>
<Text style={{ fontWeight: '100', fontSize: 15, color: '#9e9e9e' }}>What is new with you?</Text>
</View>
<View style={{ backgroundColor: '#eeeeee', borderRadius: (33 * 0.5), width: 33, height: 33 }}>
<Icon name="photo-camera" size={20} style={{ color: '#757575', margin: 7, backgroundColor: "transparent" }} onPress={this.loginWithFacebook} />
</View>
</View>
</Card>
</TouchableOpacity>
)
}
} |
JavaScript | class Stack {
stack = [];
constructor(options) {
let { max_size, allowed_users } = options;
}
insert(obj) {
stack.push(obj);
}
get() {
return stack.pop();
}
} |
JavaScript | class CustomError extends Error {
constructor(name, message) {
super(message);
this.name = name;
}
} |
JavaScript | class Fractals {
constructor() {
this.fractals = [];
}
add(fractal) {
this.fractals.push(fractal);
}
length() {
return this.fractals.length;
}
setFilePath(path) {
this.fractals.forEach(fractal => fractal.setFilePath(path));
}
draw() {
this.fractals.forEach((fractal, i) => {
console.log("Drawing image nr." + (i + 1));
fractal.draw();
});
}
} |
JavaScript | class SCNCamera extends NSObject {
static get _propTypes() {
return {
name: 'string',
zNear: 'float',
zFar: 'float',
yFov: 'float',
xFov: 'float',
fov: ['float', null], // TODO: implement
automaticallyAdjustsZRange: 'boolean',
usesOrthographicProjection: 'boolean',
orthographicScale: 'float',
projectionDirection: 'integer',
categoryBitMask: 'integer',
focalDistance: 'float',
focalSize: 'float',
focalBlurRadius: 'float',
aperture: 'float',
motionBlurIntensity: 'float',
wantsHDR: 'boolean',
exposureOffset: 'float',
averageGray: 'float',
whitePoint: 'float',
minimumExposure: 'float',
maximumExposure: 'float',
wantsExposureAdaptation: 'boolean',
exposureAdaptationDarkeningSpeedFactor: 'float',
exposureAdaptationBrighteningSpeedFactor: 'float',
exposureAdaptationDuration: ['float', null],
exposureAdaptationHistogramRangeHighProbability: ['float', null],
exposureAdaptationHistogramRangeLowProbability: ['float', null],
exposureAdaptationMode: ['integer', null],
contrast: 'float',
saturation: 'float',
//_colorGrading: 'SCNMaterialProperty',
bloomIntensity: 'float',
bloomThreshold: 'float',
bloomBlurRadius: 'float',
colorFringeIntensity: 'float',
colorFringeStrength: 'float',
vignettingIntensity: 'float',
vignettingPower: 'float',
//projectionTransform: 'SCNMatrix4'
bladeCount: ['integer', 'apertureBladeCount'],
fStop: 'float',
focalBlurSampleCount: 'integer',
focusDistance: 'float',
screenSpaceAmbientOcclusionBias: 'float',
screenSpaceAmbientOcclusionDepthThreshold: 'float',
screenSpaceAmbientOcclusionIntensity: 'float',
screenSpaceAmbientOcclusionNormalThreshold: 'float',
screenSpaceAmbientOcclusionRadius: 'float',
sensorSize: ['float', 'sensorHeight'], // TODO: check if it is correct
entityID: ['string', '_entityID'],
screenSpaceAmbientOcclusionSampleCount: ['integer', null],
screenSpaceAmbientOcclusionDownSample: ['integer', null],
dofIntensity: ['float', null],
fillMode: ['integer', null]
}
}
/**
* constructor
* @access public
* @returns {void}
*/
constructor() {
super()
// Managing Camera Attributes
/**
* A name associated with the camera object.
* @type {?string}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436623-name
*/
this.name = null
// Adjusting Camera Perspective
/**
* The camera's near depth limit. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436592-znear
*/
this.zNear = 1.0
/**
* The camera’s far depth limit. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436596-zfar
*/
this.zFar = 100.0
/**
* The camera’s field of view, in degrees, on the vertical axis. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436598-yfov
*/
this.yFov = 0
/**
* The camera's field of view, in degrees, on the horizontal axis. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436608-xfov
*/
this.xFov = 0
/**
* A Boolean value that determines whether the camera automatically adjusts its zNear and zFar depth limits.
* @type {boolean}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436610-automaticallyadjustszrange
*/
this.automaticallyAdjustsZRange = false
// Managing the Camera Projection
/**
* A Boolean value that determines whether the camera uses an orthographic projection.
* @type {boolean}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436621-usesorthographicprojection
*/
this.usesOrthographicProjection = false
/**
* Specifies the camera’s magnification factor when using an orthographic projection.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436612-orthographicscale
*/
this.orthographicScale = 1.0
/**
*
* @type {SCNCameraProjectionDirection}
* @see
*/
this.projectionDirection = SCNCameraProjectionDirection.horizontal
// Choosing Nodes to Be Visible to the Camera
/**
* A mask that defines which categories this camera belongs to.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436625-categorybitmask
*/
this.categoryBitMask = -1
// Adding Depth of Field and Blur Effects
/**
* The distance from the camera at which objects appear in sharp focus. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436600-focaldistance
*/
this.focalDistance = 10.0
/**
* The width of the distance range at which objects appear in sharp focus. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436604-focalsize
*/
this.focalSize = 0.0
/**
* The maximum amount of blurring, in pixels, applied to areas outside the camera’s depth of field. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436606-focalblurradius
*/
this.focalBlurRadius = 0.0
/**
* A factor that determines the transition between in-focus and out-of-focus areas. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1436594-aperture
*/
this.aperture = 0.125
/**
* A factor that determines the intensity of motion blur effects. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644099-motionblurintensity
*/
this.motionBlurIntensity = 0.0
// Adding High Dynamic Range Effects
/**
* A Boolean value that determines whether SceneKit applies High Dynamic Range (HDR) postprocessing effects to a scene.
* @type {boolean}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644101-wantshdr
*/
this.wantsHDR = false
/**
* A logarithmic bias that adjusts the results of SceneKit’s tone mapping operation, brightening or darkening the visible scene.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644105-exposureoffset
*/
this.exposureOffset = 0
/**
* The luminance level to use as the midpoint of a tone mapping curve.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644097-averagegray
*/
this.averageGray = 0.18
/**
* The luminance level to use as the upper end of a tone mapping curve.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644110-whitepoint
*/
this.whitePoint = 1.0
/**
* The minimum exposure value to use in tone mapping.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644103-minimumexposure
*/
this.minimumExposure = -15.0
/**
* The minimum exposure value to use in tone mapping.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644120-maximumexposure
*/
this.maximumExposure = 15.0
// Adding Automatic HDR Exposure Adaptation
/**
* A Boolean value that determines whether SceneKit automatically adjusts the exposure level.
* @type {boolean}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644117-wantsexposureadaptation
*/
this.wantsExposureAdaptation = false
/**
* The relative duration of automatically animated exposure transitions from dark to bright areas.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644093-exposureadaptationbrighteningspe
*/
this.exposureAdaptationBrighteningSpeedFactor = 0.4
/**
* The relative duration of automatically animated exposure transitions from bright to dark areas.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644094-exposureadaptationdarkeningspeed
*/
this.exposureAdaptationDarkeningSpeedFactor = 0.6
// Adjusting Rendered Colors
/**
* An adjustment factor to apply to the overall visual contrast of the rendered scene.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644112-contrast
*/
this.contrast = 0.0
/**
* An adjustment factor to apply to the overall color saturation of the rendered scene.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644100-saturation
*/
this.saturation = 1.0
this._colorGrading = new SCNMaterialProperty()
// Adding Stylistic Visual Effects
/**
* The magnitude of bloom effect to apply to highlights in the rendered scene. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644104-bloomintensity
*/
this.bloomIntensity = 0.0
/**
* The brightness threshold at which to apply a bloom effect to highlights in the rendered scene. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644098-bloomthreshold
*/
this.bloomThreshold = 0.5
/**
* The radius, in pixels, for the blurring portion of the bloom effect applied to highlights in the rendered scene. Animatable.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644096-bloomblurradius
*/
this.bloomBlurRadius = 4.0
/**
* The blend factor for fading the color fringing effect applied to the rendered scene.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644108-colorfringeintensity
*/
this.colorFringeIntensity = 1.0
/**
* The magnitude of color fringing effect to apply to the rendered scene.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644113-colorfringestrength
*/
this.colorFringeStrength = 0.0
/**
* The magnitude of vignette (darkening around edges) effect to apply to the rendered scene.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644106-vignettingintensity
*/
this.vignettingIntensity = 1.0
/**
* The amount of the rendered scene to darken with a vignette effect.
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644118-vignettingpower
*/
this.vignettingPower = 0.0
// Instance Properties
/**
*
* @type {SCNMatrix4}
* @see https://developer.apple.com/documentation/scenekit/scncamera/1690501-projectiontransform
*/
this.projectionTransform = null
/**
* @access private
* @type {?string}
*/
this._entityID = null
/**
*
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/2867484-aperturebladecount
*/
this.apertureBladeCount = 0 // TODO: check the default value
/**
*
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/2867490-fstop
*/
this.fStop = 0.0 // TODO: check the default value
/**
*
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/2867510-fieldofview
*/
this.fieldOfView = 0.0 // TODO: check the default value
/**
*
* @type {number}
* @see https://developer.apple.com/documentation/scenekit/scncamera/2872999-focalblursamplecount
*/
this.focalBlurSampleCount = 0 // TODO: check the default value
/**
*
* @type {number}
* @see
*/
this.focalLength = 0.0 // TODO:
/**
*
* @type {number}
* @see
*/
this.focalDistance = 0.0 // TODO:
/**
*
* @type {number}
* @see
*/
this.screenSpaceAmbientOcclusionBias = 0.0 // TODO:
/**
*
* @type {number}
* @see
*/
this.screenSpaceAmbientOcclusionDepthThreshold = 0.0 // TODO:
/**
*
* @type {number}
* @see
*/
this.screenSpaceAmbientOcclusionIntensity = 0.0 // TODO:
/**
*
* @type {number}
* @see
*/
this.screenSpaceAmbientOcclusionNormalThreshold = 0.0 // TODO:
/**
*
* @type {number}
* @see
*/
this.screenSpaceAmbientOcclusionRadius = 0.0 // TODO:
/**
*
* @type {number}
* @see
*/
this.sensorHeight = 0.0 // TODO:
/**
*
* @type {boolean}
* @see
*/
this.wantsDepthOfField = false // TODO:
}
// Creating a Camera
/**
* Creates a camera from the specified Model I/O camera object.
* @access public
* @param {MDLCamera} mdlCamera - A Model I/O camera object.
* @returns {void}
* @desc The Model I/O framework provides universal support for import, export, description, and processing of several 3D asset file formats and related resources. (For details, see Model I/O.) The MDLCamera class is a generic description of a viewpoint on a scene, supporting a superset of the attributes described by the SCNCamera class.
* @see https://developer.apple.com/documentation/scenekit/scncamera/1419839-init
*/
init(mdlCamera) {
}
// Adjusting Rendered Colors
/**
* A texture for applying color grading effects to the entire rendered scene.
* @type {SCNMaterialProperty}
* @desc The contents value for this material property must be a 3D color lookup table, or a 2D texture image that represents such a table arranged in a horizontal strip. A lookup table is a cube of color values: the red, green, and blue components of an input color map to the x, y, and z coordinates of a location in that cube, and at that location in the cube is a corresponding output color. You can provide data in this cubic format as a Metal texture with the type3D texture type.The 2D representation of a 3D color cube is an arrangement of slices: for example, a 16 x 16 x 16 color cube becomes a horizontal strip of 16 squares, each 16 x 16 pixels (that is, a 256 x 16 image). Each square contains a gradation of red and green components, and together the 16 squares form a gradation for the blue component. To provide a 2D representation of a color cube, set this material property’s contents value to an image.By using a color table, you can easily create custom color effects that apply to an entire rendered scene:Create a basic color table image such as Figure 1, where the color value for each R, G, and B coordinate in the cube is the corresponding RGB color.Figure 1 Basic color table imageUse an image editor to create the color effect you want using some other image—such as a screenshot of your game. Apply only effects that affect pixel colors without modifying pixel positions. (For example, you can use hue/saturation, color curves, or color matrix filters, but not blur or distort filters.)Figure 2 Creating a color grading effectApply the same color effect you created in step 2 to your basic color table image. You can even perform these steps together: paste the basic color table into your game screenshot, apply an effect to the combined picture, then crop the picture to just the modified color table. Figure 2 shows an example effect.Assign your customized color table image (such as the example in Figure 3) to this property. When rendering, SceneKit looks up the RGB values for each pixel in the rendered scene, and displays the corresponding color values from the color table.Figure 3 Custom color table image for color gradingBasic color table imageCreating a color grading effectCustom color table image for color grading
* @see https://developer.apple.com/documentation/scenekit/scncamera/1644114-colorgrading
*/
get colorGrading() {
return this._colorGrading
}
/**
* @access private
* @param {CGRect} viewRect -
* @returns {void}
*/
_updateProjectionTransform(viewRect) {
const m = new SCNMatrix4()
const left = viewRect.minX
const right = viewRect.maxX
const top = viewRect.maxY
const bottom = viewRect.minY
const aspect = viewRect.size.width / viewRect.size.height
if(this.usesOrthographicProjection){
//this.orthographicScale
m.m11 = 2 / (right - left)
m.m12 = 0
m.m13 = 0
m.m14 = 0
m.m21 = 0
m.m22 = 2 / (top - bottom)
m.m23 = 0
m.m24 = 0
m.m31 = 0
m.m32 = 0
m.m33 = -2 / (this.zFar - this.zNear)
m.m34 = 0
m.m41 = -(right + left) / (right - left)
m.m42 = -(top + bottom) / (top - bottom)
m.m43 = -(this.zFar + this.zNear) / (this.zFar - this.zNear)
m.m44 = 1
}else{
// perspective
//this.yFov
//this.xFov
//this.automaticallyAdjustsZRange
let m11 = 1
let m22 = 1
if(this.yFov <= 0 && this.xFov <= 0){
const cot = 1.0 / Math.tan(Math.PI / 6.0)
m11 = cot / aspect
m22 = cot
}else if(this.yFov <= 0){
const cot = 1.0 / Math.tan(this.xFov * Math.PI / 360.0)
m11 = cot
m22 = cot * aspect
}else if(this.xFov <= 0){
const cot = 1.0 / Math.tan(this.yFov * Math.PI / 360.0)
m11 = cot / aspect
m22 = cot
}else{
// FIXME: compare xFov to yFov
const cot = 1.0 / Math.tan(this.yFov * Math.PI / 360.0)
m11 = cot / aspect
m22 = cot
}
m.m11 = m11
m.m12 = 0
m.m13 = 0
m.m14 = 0
m.m21 = 0
m.m22 = m22
m.m23 = 0
m.m24 = 0
m.m31 = 0
m.m32 = 0
m.m33 = -(this.zFar + this.zNear) / (this.zFar - this.zNear)
m.m34 = -1
m.m41 = 0
m.m42 = 0
m.m43 = -2 * this.zFar * this.zNear / (this.zFar - this.zNear)
m.m44 = 0
}
this.projectionTransform = m
}
} |
JavaScript | class HtmlBody {
/**
* @param {Object} log - logger instance
* @param {string} templatePath - path to the template
* @param {string} appPath - application path
* @param {string} installPath - generated splash.html path
* @param {string} title - title of the html
* @param {string} imagePath - path to the image
* @param {Object} style - styles to use instead of the defaults
*/
constructor({ log,
templatePath = path.join(__dirname, 'splash.html'),
appPath,
installPath,
title = '',
imagePath = 'splashScreen.png',
style = {}
}) {
this.log = log;
this.templatePath = templatePath;
this.installPath = installPath;
this.title = title;
this.imagePath = imagePath;
this.style = style;
let backgroundImageUrl = encodeURI(
path.join(appPath, 'desktop.asar', 'assets', this.imagePath).replace(/\\/gm, '/'));
if (process.env.ELECTRON_ENV === 'test' && process.env.SPLASH_SCREEN_TEST) {
backgroundImageUrl = encodeURI(
path.join(appPath, 'assets', this.imagePath).replace(/\\/gm, '/'));
}
this.defaultStyle = {
'background-image': `url('file:///${backgroundImageUrl}')`,
'background-size': 'contain',
'background-repeat': 'no-repeat',
'background-attachment': 'fixed',
'background-position': 'center center',
'background-color': 'rgba(0, 0, 0, 0)'
};
// Apply custom style.
Object.keys(this.style).forEach((rule) => {
this.defaultStyle[rule] = this.style[rule];
});
}
/**
* Returns the css string from the style object.
* @returns {string}
*/
getStylesAsString() {
return Object.keys(this.defaultStyle).reduce(
(str, rule) => `${str}\n${rule}: ${this.defaultStyle[rule]};`, ''
);
}
/**
* Prepares the splash screen html.
*/
prepare() {
let splashHTML;
this.log.info('preparing splash screen');
splashHTML = fs.readFileSync(this.templatePath, 'UTF-8');
splashHTML = splashHTML.replace('{title}', this.title);
splashHTML = splashHTML.replace('{style}', this.getStylesAsString());
fs.writeFileSync(this.installPath, splashHTML);
this.log.info('splash screen prepared');
}
/**
* Install path getter.
* @returns {string}
*/
getInstallPath() {
return this.installPath;
}
} |
JavaScript | class DateParser {
constructor(
monthNames=DEFAULT_MONTH_NAMES,
shortMonthNames=DEFAULT_SHORT_MONTH_NAMES,
preferPast=false
) {
// Set the month names used when formatting/parsing dates
this.monthNames = monthNames
this.shortMonthNames = shortMonthNames
// If `true` then the parser will prefer past dates when determining
// what century to generate (if not given).
this.preferPast = preferPast
}
// -- Getters & Setters ---
get monthNames() {
return this._monthNames.slice()
}
set monthNames(names) {
this._monthNames = names.slice()
this._monthNamesLower = names.map((v) => {
return v.toLowerCase()
})
}
get shortMonthNames() {
return this._shortMonthNames.slice()
}
set shortMonthNames(names) {
this._shortMonthNames = names.slice()
this._shortMonthNamesLower = names.map((v) => {
return v.toLowerCase()
})
}
// -- Public methods --
/**
* Format (and return) a date as a string using the named formatter.
*/
format(formatter, date) {
return this.constructor.formatters[formatter](this, date)
}
/**
* Return a full year (4-digit) from a partial year (2-digit).
*/
getFullYear(year) {
let currentYear = (new Date()).getYear()
let century = parseInt((new Date()).getFullYear() / 100, 10)
if (this.preferPast && (year + 100) > currentYear) {
century -= 1
}
return year + (century * 100)
}
/**
* Attempt to parse (and return) a string as a date using the list of
* named parsers.
*/
parse(parsers, s) {
let date = null
for (let parser of parsers) {
date = this.constructor.parsers[parser](this, s)
if (date !== null) {
break
}
}
return date
}
} |
JavaScript | class App {
/**
* Create Menu
* @param {Object} param contains HTML element
* @param {HTMLElement} param.el HTML element for new Menu
*/
constructor({el}) {
// Create Menu control
this.menu = new Menu({
el: el.querySelector('.js-menu'),
data: store
});
// Create Form control
this.form = new Form({
el: el.querySelector('.js-form'),
data: store
});
this.controls = [];
this.controls.push(this.menu);
this.controls.push(this.form);
this._initEvents(el);
this.controller = new Controller(store, this.controls);
// Run Rendering cycle
setInterval(this.render.bind(this), 50);
}
/**
* Add event handlers common for nested components
* @param {HTMLElement} el HTML element for event handling
* @private
*/
_initEvents(el) {
el.addEventListener('add_menu_item', this._onAddMenuItem.bind(this));
el.addEventListener('remove_menu_item',
this._onRemoveMenuItem.bind(this));
}
/**
* Custom event 'add_menu_item' handler
* @param {Event} event Custom event ('add_menu_item')
* @private
*/
_onAddMenuItem(event) {
this.controller.addMenuItem(event.detail.title);
// this.form.setOutdated();
// this.menu.setOutdated();
}
/**
* Custom event 'remove_menu_item' handler
* @param {Event} event Custom event ('remove_menu_item')
* @private
*/
_onRemoveMenuItem(event) {
this.controller.removeMenuItem(event.detail.index);
// this.menu.setOutdated();
}
/**
* Render all controls created in app.
* Only outdated cotrols will be rendered.
*/
render() {
this.controls.forEach((control) => control.render());
}
} |
JavaScript | class PartialUADataValues {
constructor() {
/** @type {string|undefined} */
this.platform;
/** @type {string|undefined} */
this.platformVersion;
/** @type {string|undefined} */
this.architecture;
/** @type {string|undefined} */
this.model;
/** @type {string|undefined} */
this.uaFullVersion;
/** @type {string|undefined} */
this.bitness;
/** @type {!Array<!NavigatorUABrandVersion>|undefined} */
this.fullVersionList;
}
} |
JavaScript | class ExternalFactor extends React.Component{
constructor(props){
super(props);
//inicjalizacja stanu komponentu
//TODO: przerobić tak by wykorzystać jeszcze do edycji istniejącego eksperymentu
//if (props.obj === undefined || props.obj === null){
this.state = {name:"", numberOfVal:1, unit:"", values:"", nameOld:props.name, metrics:[]
}
}
//komponent odpowiedzialny za usuwalną linijkę z metryką szczegółową
//props.obj - metryka szczegółowa do obskoczenia
// props.onButton - funkcja do wywołania dla przycisku usuń
Line = (props) => {
return(<div>
{props.obj['id']+":"+" type:"+props.obj['metric']+" number of repeats:"+props.obj['numberOfRepeat']}
<Button type="button" onClick={(e) => props.onButton(props.obj)}>
Usuń
</Button>
</div>)
}
componentDidUpdate = ()=>{
if (this.props.name!==this.state.nameOld){
axios.get("/api/experiment/ExternalFactor/"+this.props.name+"/").then((res)=>{
this.setState({
nameOld:this.props.name,
numberOfVal:res.data.numberOfValues,
unit:res.data.unit,
values:res.data.values
})
})
}
}
// /api/experiment/Experiment/
//name:null, numberOfVal:1, unit:null, values:null,
handleChangeName = (event) => { this.setState({name: event.target.value});}
handleChangeNumOfVal = (event) => { this.setState({numberOfVal: event.target.value});}
handleChangeUnit = (event) => { this.setState({unit: event.target.value});}
handleChangeValues = (event) => { this.setState({values: event.target.value});}
handleInsert =(e) =>{if (! ( this.state.numberOfVal<1 || this.state.name == "" || this.state.unit == "" || this.state.values == "")){
var split_str = this.state.values.split(",");
let result = true;
if(split_str.length != this.state.numberOfVal){
result = false;
alert("Niepoprawna liczba wartosci");
}
if(result == true){
//pobranie znacznika CSRF z ciasteczka
let token = getCSRFToken()
//stworzenie odpowiedniego nagłówka zapytania
const headers = {"X-CSRFTOKEN": token}
//obiekt z danymi do bazy
var exp_head = {
"name": this.state.name,
"numberOfValues": this.state.numberOfVal,
"unit": this.state.unit,
"values": this.state.values
}
axios.post("/api/experiment/ExternalFactor/",exp_head,{ headers:headers }).then((res)=>{
alert(res.statusText);
this.props.afterCreate(res.data)
}).catch(()=>{console.log("Something's wrong with inserting experiment");})
}
}else{
alert("Uzupełnij")
}
}
render(){
return(
<form id="externalFactorForm">
{(this.props.name!==undefined)?
<InputLabel className="line">
Stara nazwa:
<Input className="line" type="text" value={this.state.nameOld} readOnly />
</InputLabel>:<InputLabel className="line">
Nazwa nowego czynnika:
<Input className="line" type="text" value={this.state.name} onChange={this.handleChangeName} />
</InputLabel>}
<InputLabel className="line2">
Liczba Wartosci:
<Input className="line" type="text" value={this.state.numberOfVal} onChange={this.handleChangeNumOfVal} />
</InputLabel>
<InputLabel className="line2">
Jednostka:
<Input className="line" type="text" value={this.state.unit} onChange={this.handleChangeUnit} />
</InputLabel>
<InputLabel className="line2">
Wartosci:
<Input className="line" type="text" value={this.state.values} onChange={this.handleChangeValues}/>
</InputLabel>
<span className="line"></span>
<Button className="line" type="button" onClick={this.handleInsert}>Dodaj</Button>
</form>
)
}
} |
JavaScript | class EntityChildrenTree extends Entity {
constructor(name, game) {
super(name, game);
this.children = [];
this.parent = null;
}
get childCount() {return this.children.length;}
addChild(child) {
return this.addChildAt(child,this.children.length);
}
addChildAt(child,index) {
if(index >= 0 && index <= this.children.length)
{
if(child.parent)
{
child.parent.removeChild(child);
}
child.parent = this;
this.children.splice(index, 0, child);
this._changeDepth = true;
//if(this.stage)child.setStageReference(this.stage);
return child;
}
else
{
throw new Error(child + 'addChildAt: The index '+ index +' supplied is out of bounds ' + this.children.length);
}
}
removeChild(child)
{
var index = this.children.indexOf( child );
if(index === -1) return;
return this.removeChildAt( index );
}
removeChildAt(index)
{
var child = this.getChildAt( index );
child.parent = undefined;
this.children.splice( index, 1 );
return child;
}
getChildAt(index)
{
if (index < 0 || index >= this.children.length)
{
throw new Error('Hierarchy.getChildAt: Index '+ index +' does not exist in the child list');
}
return this.children[index];
}
} |
JavaScript | class C extends RenderingElement {
render() {
return html `
<assigned-nodes-el
><div id="div1">A</div>
<slot slot="footer"></slot
></assigned-nodes-el>
<assigned-nodes-el-2><div id="div2">B</div></assigned-nodes-el-2>
<assigned-nodes-el-symbol
><div id="div3">B</div></assigned-nodes-el-symbol
>
`;
}
firstUpdated() {
this.div = this.renderRoot.querySelector('#div1');
this.div2 = this.renderRoot.querySelector('#div2');
this.div3 = this.renderRoot.querySelector('#div3');
this.assignedNodesEl = this.renderRoot.querySelector('assigned-nodes-el');
this.assignedNodesEl2 = this.renderRoot.querySelector('assigned-nodes-el-2');
this.assignedNodesEl3 = this.renderRoot.querySelector('assigned-nodes-el-symbol');
}
} |
JavaScript | class Storage {
/**
* @param {string} name - storage name
*/
constructor( name ) {
if( !name ) {
throw new TypeError( `Expect a name for the storage, but a(n) ${name} is given.` );
}
this.name = `#\x01#JNN-STORAGE-V-1.0#${name}#`;
/**
* abstract methods
* all classes which inherits from this class should
*/
const abstracts = [ 'set', 'get', 'delete', 'clear', 'keys' ];
for( let method of abstracts ) {
if( !is.function( this[ method ] ) ) {
throw new TypeError( `Storage.prototype.${method} must be overridden in sub class.` );
}
}
}
/**
* To wrap the data with some properties for storage.
*
* @param {string|object} data - the data which will be stored. If it's not a string, it'll be converted to a string with JSON.stringify.
* @param {object} [options] - options for formating data.
* @param {string} [options.type=] - the type of data, such as js, css or any other types you want to set.
* @param {string} [options.mime=text/plain] - the MIME type of the source
* @param {number} [options.rank=50] - to specify a rank for the data.
* @param {number} [options.lifetime=0] - lifetime of the data, 0 means forever.
* @param {mixed} [options.extra] - any extra data that will be stored with the main data, and the extra data should be able to be JSON stringify.
* @param {boolean} [options.md5=false] - denoting if calculating and storing the md5 value.
* @param {boolean} [options.cookie=false] - denoting if the cookie value need to be stored.
*
* @return {{type: string, mime: string, rank: number, ctime: number, lifetime: number, fmt: string, data: string, extra: ?string, md5: ?string, cookie: ?string }} the wrapped object.
*/
wrap( data, options = {} ) {
const input = Object.assign( {
type : '',
mime : '',
rank : 50,
ctime : +new Date,
lifetime : 0
}, options );
/**
* supports {json} and {string}
*/
if( !is.string( data ) ) {
input.fmt = 'json';
data = JSON.stringify( data );
} else {
input.fmt = 'string';
}
input.data = data;
if( options.extra ) {
input.extra = JSON.stringify( options.extra );
}
/**
* if options.md5 is true, to store the md5 value of the serilized data.
*/
if( options.md5 ) {
input.md5 = md5( data );
}
/**
* to store the md5 value of the cookie string.
* the md5 value will be used for checking if the cookies has been changed while getting data.
*/
if( options.cookie ) {
input.cookie = md5( document.cookie );
}
return input;
}
/**
* To validate if a data item is valid.
*
* @param {Object} data - the data got from storage
* @param {Object} [options={}] - options
* @param {string} [options.md5] - the md5 value of the data for checking equivalent.
* @param {Function} [options.validate] - the customized validating function which will be executed at the end of the validation process. The function will get one argument which expresses the result of the validing process. To return a {boolean} value.
*
* @return {boolean}
*/
validate( data, options = {} ) {
let result = true;
if( data.lifetime && new Date - data.ctime >= data.lifetime ) {
result = false;
} else if( data.cookie && data.cookie !== md5( document.cookie ) ) {
result = false;
} else if( data.md5 && options.md5 ) {
if( data.md5 !== options.md5 ) {
result = false;
} else if( md5( data.data ) !== options.md5 ) {
// to calucate the MD5 value again, in case that the data is manipulated
result = false;
}
}
if( options.validate ) {
return options.validate( data, result );
}
return result;
}
/**
* To remove data which match the filter(check) function
*
* @param {Function} check - the checker which will be executed for each data item, returning a `true` means the data should be removed.
*
* @return {Promise}
*/
clean( check ) {
return this.keys().then( keys => {
const steps = []
for( let key of keys ) {
steps.push( () => {
return this.get( key ).then( data => {
if( check( data, key ) === true ) {
return this.delete( key );
}
} );
} );
}
return Sequence.chain( steps ).then( results => {
const removed = [];
for( let result of results ) {
if( result.status === Sequence.FAILURE ) {
removed.push( keys[ result.index ] );
}
}
return removed;
} );
} );
}
/**
* to unwrap(parse) the data
*/
unwrap( data, storage ) {
if( !storage ) {
throw new TypeError( 'Storage type is required' );
}
try {
if( data.fmt === 'json' ) {
data.data = JSON.parse( data.data );
}
if( data.extra ) {
data.extra = JSON.parse( data.extra );
}
data.storage = storage;
return data;
} catch( e ) {
console.warn( e );
return false;
}
}
/**
* set data into the storage engine
* @abstract
*
* @param {string} key - the key of the data.
* @param {string|Object} data - the data which will be stored.
* @param {Object} [options={}] - the options for storing, same as the options for Storage.prototype.wrap function.
*
* @return {Promise<string|Object, Error>}
*/
set( key, data, options = {} ) {} // eslint-disable-line
/**
* get data from the storage engine
* @abstract
*
* @param {string} key - the key of the data
* @param {Object} [options={}] - options for getting data, such as validation options.
* @param {boolean} [options.autodelete] - denoting if to delete the data if the data exists but it's invalid.
* @param {string} [options.md5] - the md5 value for validation, to see more information in Storage.prototype.validate.
* @param {Function} [options.validate] - function for validation, to see more information in Storage.prototype.validate.
*
* @return {Promise<mixed>}
*/
get( key, options = {} ) {} // eslint-disable-line
/**
* delete specified data from storage engine
* @abstract
*
* @param {string} key - the key of the data
*
* @return {Promise<undefined>}
*/
delete( key ) {} // eslint-disable-line
/**
* to delete all data from the storage engine.
* @abstract
*
* @return {Promise<undefined>}
*/
clear() {} // eslint-disable-line
/**
* get all keys of data that stored in the storage engine.
* @abstract
*
* @return {Promise<string[]>}
*/
keys() {} // eslint-disable-line
} |
JavaScript | class NonPDQLinkProcessor {
/**
* Creates an instance of NonPDQLinkProcessor.
*
* @param {any} linkdb A link database class instance (with data)
* @param {any} options Options for this processor (inputFile & outputFile)
*
* @memberOf NonPDQLinkProcessor
*/
constructor(linkdb, options) {
this.linkDB = linkdb;
this.inputFile = options.inputFile;
this.outputFile = options.outputFile;
}
/**
* Saves out a workbook with the enriched link info
*
* @param {any} data
* @param {any} cols
*
* @memberOf NonPDQLinkProcessor
*/
_saveWorkbook(data, cols) {
let wb = {};
wb.Sheets = {};
wb.SheetNames = [];
let ws_name = "Sheet1";
let ws = {};
let range = {s: {c:0, r:0}, e: {c:0, r:0 }};
for(let R = 0; R != data.length; ++R) {
if (range.e.r < R) range.e.r = R;
for(var C = 0; C != cols.length; ++C) {
if (range.e.c < C) range.e.c = C;
/* create cell object: .v is the actual data */
var cell = { v: data[R][cols[C]] };
if(cell.v == null) continue;
/* create the correct cell reference */
var cell_ref = XLSX.utils.encode_cell({c:C,r:R});
/* determine the cell type */
if(typeof cell.v === 'number') cell.t = 'n';
else if(typeof cell.v === 'boolean') cell.t = 'b';
else cell.t = 's';
/* add to structure */
ws[cell_ref] = cell;
}
}
ws['!ref'] = XLSX.utils.encode_range(range);
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
/* write file */
XLSX.writeFile(wb, this.outputFile);
}
/**
* Get a nice display label for the pattern
*
* @param {any} link
* @returns
*
* @memberOf NonPDQLinkProcessor
*/
_getPrettyPattern(link) {
let patternVal = link.search_def.getSearchPattern();
let patternCol = '';
if (patternVal != 'MANUAL') {
for (let i=0; i< PATTERNS.length; i++) {
//If this is one of the patterns, then add it to the string.
if (patternVal & Math.pow(2, i)) {
if (patternCol != '') { patternCol += '_' }
patternCol += PATTERNS[i];
}
}
} else { patternCol = 'MANUAL' }
return patternCol;
}
/**
* Process the input worksheet and enrich the link records outputting a
* new spreadsheet.
*
* @memberOf NonPDQLinkProcessor
*/
process() {
var workbook = XLSX.readFile(this.inputFile);
/* Get worksheet */
var worksheet = workbook.Sheets["CGOV"];
let sheetObj = XLSX.utils.sheet_to_json(worksheet);
//Convert each sheet row into a new object, which we will
//use to resave the worksheet.
let links = sheetObj.map( (item) => {
let linkRecord = {
url: item['bad link'],
new_url: item['NEW URL'],
comment: item['Comment'],
bp_text: item['Boiler Plate Text'],
ref_url: item['url used on'],
ref_contentid: item['contentid'],
ref_contentType: item['contenttypename'],
ref_title: item['title'],
ref_statename: item['statename'],
'By Cancer Type': item['By Cancer Type'],
'Stage Subtype': item['Stage Subtype'],
'By Trial Type': item['By Trial Type'],
'Trial Phase': item['Trial Phase'],
'Treatment / Intervention': item['Treatment / Intervention'],
'Lead Org': item['Lead Org'],
'Keywords / Phrases': item['Keywords / Phrases'],
'USA only': item['USA only'],
'No Results': item['No Results'],
'protocolsearchid': item['protocolsearchid'],
'IDstring': item['IDstring'],
'Type': item['Type']
};
//Add in info from linkDB
let link = this.linkDB.getLink(linkRecord.url);
if (!link) {
throw new Error(`No link found for ${linkRecord.url}`);
}
linkRecord['Pattern'] = this._getPrettyPattern(link);
linkRecord['cgov_trial_count'] = link.cgov_trial_count;
return linkRecord;
});
this._saveWorkbook(
links,
[
'url', 'Pattern', 'cgov_trial_count', 'new_url',
'comment', 'bp_text', 'ref_url', 'ref_contentid', 'ref_contentType',
'ref_title', 'ref_statename', 'By Cancer Type', 'Stage Subtype', 'By Trial Type',
'Trial Phase', 'Treatment / Intervention', 'Lead Org', 'Keywords / Phrases',
'USA only', 'No Results', 'protocolsearchid', 'IDstring', 'Type'
]
);
}
} |
JavaScript | class RecipesApi {
static getRecipes() {
const recipes = localStorage.getItem('recipes');
return JSON.parse(recipes);
}
static setRecipes(recipes) {
const recipesList = recipes || RECIPES;
return localStorage.setItem('recipes', JSON.stringify(recipesList));
}
static getAllRecipes() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(Object.assign([], this.getRecipes()));
}, DELAY);
});
}
static getRecipe(recipeId) {
return new Promise((resolve, reject) => {
setTimeout(() => {
const recipes = this.getRecipes() || [];
const recipe = recipes.filter(recipe => recipe.id === recipeId);
if (recipe.length) {
return resolve(Object.assign({}, recipe[0]));
}
return reject('Could not get recipe');
}, DELAY);
});
}
static saveRecipe(recipe) {
return new Promise((resolve, reject) => {
setTimeout(() => {
const recipes = this.getRecipes() || [];
if (recipe.id) {
const existingRecipeIndex = recipes.findIndex(
a => a.id === recipe.id
);
recipes.splice(existingRecipeIndex, 1, recipe);
} else {
//Just simulating creation here.
//The server would generate ids new recipes in a real app.
recipe.id = uuidv1();
recipes.push(recipe);
}
this.setRecipes(recipes);
resolve(Object.assign({}, recipe));
}, DELAY);
});
}
static deleteRecipe(recipeId) {
return new Promise((resolve, reject) => {
setTimeout(() => {
const recipes = this.getRecipes() || [];
const indexOfRecipeToDelete = recipes.findIndex(recipe => {
return recipe.id === recipeId;
});
recipes.splice(indexOfRecipeToDelete, 1);
this.setRecipes(recipes);
resolve();
}, DELAY);
});
}
} |
JavaScript | class CanvasEdgeStyle extends EdgeStyleBase {
/**
* Creates a new instance of this class.
* @param {Color} [color] The edge color.
* @param {Number} [thickness] The edge thickness
*/
constructor(color, thickness) {
super()
this.$color = typeof color !== 'undefined' ? color : Color.BLACK
this.$thickness = typeof thickness !== 'undefined' ? thickness : 1
}
/**
* Callback that creates the visual.
* This method is called in response to a {@link IVisualCreator#createVisual}
* call to the instance that has been queried from the {@link EdgeStyleBase#renderer}.
* @param {IRenderContext} context The render context.
* @param {IEdge} edge The edge to which this style instance is assigned.
* @return {Visual} The visual as required by the {@link IVisualCreator#createVisual}
* interface.
* @see {@link EdgeStyleBase#updateVisual}
*/
createVisual(context, edge) {
return new EdgeRenderVisual(
edge.bends,
edge.sourcePort.dynamicLocation,
edge.targetPort.dynamicLocation,
this.$color,
this.$thickness
)
}
/**
* Callback that updates the visual previously created by {@link EdgeStyleBase#createVisual}.
* This method is called in response to a {@link IVisualCreator#updateVisual}
* call to the instance that has been queried from the {@link EdgeStyleBase#renderer}.
* This implementation simply delegates to {@link EdgeStyleBase#createVisual} so subclasses
* should override to improve rendering performance.
* @param {IRenderContext} context The render context.
* @param {Visual} oldVisual The visual that has been created in the call to
* {@link EdgeStyleBase#createVisual}.
* @param {IEdge} edge The edge to which this style instance is assigned.
* @return {Visual} The visual as required by the {@link IVisualCreator#createVisual}
* interface.
* @see {@link EdgeStyleBase#createVisual}
*/
updateVisual(context, oldVisual, edge) {
return oldVisual
}
} |
JavaScript | class EdgeRenderVisual extends HtmlCanvasVisual {
/**
* Creates an edge render visual instance for an edge.
* @param {IListEnumerable.<IBend>} bends
* @param {IPoint} sourcePortLocation
* @param {IPoint} targetPortLocation
* @param {Color} color
* @param {number} thickness
*/
constructor(bends, sourcePortLocation, targetPortLocation, color, thickness) {
super()
this.bends = bends
this.sourcePortLocation = sourcePortLocation
this.targetPortLocation = targetPortLocation
this.color = `rgba(${color.r},${color.g},${color.b},${color.a})`
this.thickness = thickness
}
/**
* Paints onto the context using HTML5 Canvas operations.
* Implementations should not destroy the context's state, but should make sure to restore the state to the
* previously active state. This is especially true for the transformation and clip.
* @param {IRenderContext} context The render context of the {@link CanvasComponent}
* @param {CanvasRenderingContext2D} htmlCanvasContext The HTML5 Canvas context to use for rendering.
*/
paint(context, htmlCanvasContext) {
// simply draw a black line from the source port location via all bends to the target port location
htmlCanvasContext.strokeStyle = this.color
htmlCanvasContext.lineWidth = this.thickness
htmlCanvasContext.beginPath()
let location = this.sourcePortLocation
htmlCanvasContext.moveTo(location.x, location.y)
if (this.bends.size > 0) {
this.bends.forEach(bend => {
location = bend.location
htmlCanvasContext.lineTo(location.x, location.y)
})
}
location = this.targetPortLocation
htmlCanvasContext.lineTo(location.x, location.y)
htmlCanvasContext.stroke()
}
} |
JavaScript | class TopicDetail extends AbstractModel {
constructor(){
super();
/**
* Topic name
* @type {string || null}
*/
this.TopicName = null;
/**
* Topic ID
* @type {string || null}
*/
this.TopicId = null;
/**
* Number of partitions
* @type {number || null}
*/
this.PartitionNum = null;
/**
* Number of replicas
* @type {number || null}
*/
this.ReplicaNum = null;
/**
* Remarks
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Note = null;
/**
* Creation time
* @type {number || null}
*/
this.CreateTime = null;
/**
* Whether to enable IP authentication allowlist. true: yes, false: no
* @type {boolean || null}
*/
this.EnableWhiteList = null;
/**
* Number of IPs in IP allowlist
* @type {number || null}
*/
this.IpWhiteListCount = null;
/**
* COS bucket for data backup: address of the destination COS bucket
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.ForwardCosBucket = null;
/**
* Status of data backup to COS. 1: not enabled, 0: enabled
* @type {number || null}
*/
this.ForwardStatus = null;
/**
* Frequency of data backup to COS
* @type {number || null}
*/
this.ForwardInterval = null;
/**
* Advanced configuration
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Config || null}
*/
this.Config = null;
/**
* Message retention time configuration (for recording the latest retention time)
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {TopicRetentionTimeConfigRsp || null}
*/
this.RetentionTimeConfig = null;
/**
* `0`: normal, `1`: deleted, `2`: deleting
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.Status = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TopicName = 'TopicName' in params ? params.TopicName : null;
this.TopicId = 'TopicId' in params ? params.TopicId : null;
this.PartitionNum = 'PartitionNum' in params ? params.PartitionNum : null;
this.ReplicaNum = 'ReplicaNum' in params ? params.ReplicaNum : null;
this.Note = 'Note' in params ? params.Note : null;
this.CreateTime = 'CreateTime' in params ? params.CreateTime : null;
this.EnableWhiteList = 'EnableWhiteList' in params ? params.EnableWhiteList : null;
this.IpWhiteListCount = 'IpWhiteListCount' in params ? params.IpWhiteListCount : null;
this.ForwardCosBucket = 'ForwardCosBucket' in params ? params.ForwardCosBucket : null;
this.ForwardStatus = 'ForwardStatus' in params ? params.ForwardStatus : null;
this.ForwardInterval = 'ForwardInterval' in params ? params.ForwardInterval : null;
if (params.Config) {
let obj = new Config();
obj.deserialize(params.Config)
this.Config = obj;
}
if (params.RetentionTimeConfig) {
let obj = new TopicRetentionTimeConfigRsp();
obj.deserialize(params.RetentionTimeConfig)
this.RetentionTimeConfig = obj;
}
this.Status = 'Status' in params ? params.Status : null;
}
} |
JavaScript | class GroupInfoMember extends AbstractModel {
constructor(){
super();
/**
* Unique ID generated for consumer in consumer group by coordinator
* @type {string || null}
*/
this.MemberId = null;
/**
* `client.id` information by the client consumer SDK
* @type {string || null}
*/
this.ClientId = null;
/**
* Generally stores client IP address
* @type {string || null}
*/
this.ClientHost = null;
/**
* Stores the information of partition assigned to this consumer
* @type {Assignment || null}
*/
this.Assignment = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.MemberId = 'MemberId' in params ? params.MemberId : null;
this.ClientId = 'ClientId' in params ? params.ClientId : null;
this.ClientHost = 'ClientHost' in params ? params.ClientHost : null;
if (params.Assignment) {
let obj = new Assignment();
obj.deserialize(params.Assignment)
this.Assignment = obj;
}
}
} |
JavaScript | class PartitionOffset extends AbstractModel {
constructor(){
super();
/**
* Partition, such as "0" or "1"
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Partition = null;
/**
* Offset, such as 100
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.Offset = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Partition = 'Partition' in params ? params.Partition : null;
this.Offset = 'Offset' in params ? params.Offset : null;
}
} |
JavaScript | class ConsumerGroup extends AbstractModel {
constructor(){
super();
/**
* User group name
* @type {string || null}
*/
this.ConsumerGroupName = null;
/**
* Subscribed message entity
* @type {Array.<SubscribedInfo> || null}
*/
this.SubscribedInfo = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.ConsumerGroupName = 'ConsumerGroupName' in params ? params.ConsumerGroupName : null;
if (params.SubscribedInfo) {
this.SubscribedInfo = new Array();
for (let z in params.SubscribedInfo) {
let obj = new SubscribedInfo();
obj.deserialize(params.SubscribedInfo[z]);
this.SubscribedInfo.push(obj);
}
}
}
} |
JavaScript | class Assignment extends AbstractModel {
constructor(){
super();
/**
* Assignment version information
* @type {number || null}
*/
this.Version = null;
/**
* Topic information list
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<GroupInfoTopics> || null}
*/
this.Topics = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Version = 'Version' in params ? params.Version : null;
if (params.Topics) {
this.Topics = new Array();
for (let z in params.Topics) {
let obj = new GroupInfoTopics();
obj.deserialize(params.Topics[z]);
this.Topics.push(obj);
}
}
}
} |
JavaScript | class GroupInfoTopics extends AbstractModel {
constructor(){
super();
/**
* Name of assigned topics
* @type {string || null}
*/
this.Topic = null;
/**
* Information of assigned partition
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<number> || null}
*/
this.Partitions = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Topic = 'Topic' in params ? params.Topic : null;
this.Partitions = 'Partitions' in params ? params.Partitions : null;
}
} |
JavaScript | class TopicResult extends AbstractModel {
constructor(){
super();
/**
* List of returned topic information
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<Topic> || null}
*/
this.TopicList = null;
/**
* Number of eligible topics
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.TotalCount = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
if (params.TopicList) {
this.TopicList = new Array();
for (let z in params.TopicList) {
let obj = new Topic();
obj.deserialize(params.TopicList[z]);
this.TopicList.push(obj);
}
}
this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;
}
} |
JavaScript | class Region extends AbstractModel {
constructor(){
super();
/**
* Region ID
* @type {number || null}
*/
this.RegionId = null;
/**
* Region name
* @type {string || null}
*/
this.RegionName = null;
/**
* Area name
* @type {string || null}
*/
this.AreaName = null;
/**
* Region code
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.RegionCode = null;
/**
* Region code (v3)
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.RegionCodeV3 = null;
/**
* NONE: no special models are supported by default.\nCVM: the CVM type is supported.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Support = null;
/**
* Whether IPv6 is supported. `0` indicates no, and `1` indicates yes.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.Ipv6 = null;
/**
* Whether cross-AZ clusters are supported.`0` indicates no, and `1` indicates yes.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.MultiZone = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.RegionId = 'RegionId' in params ? params.RegionId : null;
this.RegionName = 'RegionName' in params ? params.RegionName : null;
this.AreaName = 'AreaName' in params ? params.AreaName : null;
this.RegionCode = 'RegionCode' in params ? params.RegionCode : null;
this.RegionCodeV3 = 'RegionCodeV3' in params ? params.RegionCodeV3 : null;
this.Support = 'Support' in params ? params.Support : null;
this.Ipv6 = 'Ipv6' in params ? params.Ipv6 : null;
this.MultiZone = 'MultiZone' in params ? params.MultiZone : null;
}
} |
JavaScript | class AclRule extends AbstractModel {
constructor(){
super();
/**
* ACL rule name.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.RuleName = null;
/**
* Instance ID.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.InstanceId = null;
/**
* Matching type. Currently, only prefix match is supported. Enumerated value list: PREFIXED
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.PatternType = null;
/**
* Prefix value for prefix match.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Pattern = null;
/**
* ACL resource type. Only “Topic” is supported. Enumerated value list: Topic.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.ResourceType = null;
/**
* ACL information contained in the rule.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.AclList = null;
/**
* Creation time of the rule.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.CreateTimeStamp = null;
/**
* A parameter used to specify whether the preset ACL rule is applied to new topics.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.IsApplied = null;
/**
* Rule update time.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.UpdateTimeStamp = null;
/**
* Remarks of the rule.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Comment = null;
/**
* One of the corresponding topic names that is displayed.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.TopicName = null;
/**
* The number of topics that apply this ACL rule.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.TopicCount = null;
/**
* Name of rule type.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.PatternTypeTitle = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.RuleName = 'RuleName' in params ? params.RuleName : null;
this.InstanceId = 'InstanceId' in params ? params.InstanceId : null;
this.PatternType = 'PatternType' in params ? params.PatternType : null;
this.Pattern = 'Pattern' in params ? params.Pattern : null;
this.ResourceType = 'ResourceType' in params ? params.ResourceType : null;
this.AclList = 'AclList' in params ? params.AclList : null;
this.CreateTimeStamp = 'CreateTimeStamp' in params ? params.CreateTimeStamp : null;
this.IsApplied = 'IsApplied' in params ? params.IsApplied : null;
this.UpdateTimeStamp = 'UpdateTimeStamp' in params ? params.UpdateTimeStamp : null;
this.Comment = 'Comment' in params ? params.Comment : null;
this.TopicName = 'TopicName' in params ? params.TopicName : null;
this.TopicCount = 'TopicCount' in params ? params.TopicCount : null;
this.PatternTypeTitle = 'PatternTypeTitle' in params ? params.PatternTypeTitle : null;
}
} |
JavaScript | class JgwOperateResponse extends AbstractModel {
constructor(){
super();
/**
* Returned code. 0: normal, other values: error
* @type {string || null}
*/
this.ReturnCode = null;
/**
* Success message
* @type {string || null}
*/
this.ReturnMessage = null;
/**
* Data returned by an operation, which may contain `flowId`, etc.
Note: this field may return null, indicating that no valid values can be obtained.
* @type {OperateResponseData || null}
*/
this.Data = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.ReturnCode = 'ReturnCode' in params ? params.ReturnCode : null;
this.ReturnMessage = 'ReturnMessage' in params ? params.ReturnMessage : null;
if (params.Data) {
let obj = new OperateResponseData();
obj.deserialize(params.Data)
this.Data = obj;
}
}
} |
JavaScript | class ZoneInfo extends AbstractModel {
constructor(){
super();
/**
* Zone ID
* @type {string || null}
*/
this.ZoneId = null;
/**
* Whether it is an internal application.
* @type {number || null}
*/
this.IsInternalApp = null;
/**
* Application ID
* @type {number || null}
*/
this.AppId = null;
/**
* Flag
* @type {boolean || null}
*/
this.Flag = null;
/**
* Zone name
* @type {string || null}
*/
this.ZoneName = null;
/**
* Zone status
* @type {number || null}
*/
this.ZoneStatus = null;
/**
* Extra flag
* @type {string || null}
*/
this.Exflag = null;
/**
* JSON object. The key is the model. The value `true` means “sold out”, and `false` means “not sold out”.
* @type {string || null}
*/
this.SoldOut = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.ZoneId = 'ZoneId' in params ? params.ZoneId : null;
this.IsInternalApp = 'IsInternalApp' in params ? params.IsInternalApp : null;
this.AppId = 'AppId' in params ? params.AppId : null;
this.Flag = 'Flag' in params ? params.Flag : null;
this.ZoneName = 'ZoneName' in params ? params.ZoneName : null;
this.ZoneStatus = 'ZoneStatus' in params ? params.ZoneStatus : null;
this.Exflag = 'Exflag' in params ? params.Exflag : null;
this.SoldOut = 'SoldOut' in params ? params.SoldOut : null;
}
} |
JavaScript | class Topic extends AbstractModel {
constructor(){
super();
/**
* Topic ID
* @type {string || null}
*/
this.TopicId = null;
/**
* Topic name
* @type {string || null}
*/
this.TopicName = null;
/**
* Remarks
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Note = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TopicId = 'TopicId' in params ? params.TopicId : null;
this.TopicName = 'TopicName' in params ? params.TopicName : null;
this.Note = 'Note' in params ? params.Note : null;
}
} |
JavaScript | class Tag extends AbstractModel {
constructor(){
super();
/**
* Tag key
* @type {string || null}
*/
this.TagKey = null;
/**
* Tag value
* @type {string || null}
*/
this.TagValue = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TagKey = 'TagKey' in params ? params.TagKey : null;
this.TagValue = 'TagValue' in params ? params.TagValue : null;
}
} |
JavaScript | class RouteResponse extends AbstractModel {
constructor(){
super();
/**
* Route information list
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<Route> || null}
*/
this.Routers = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
if (params.Routers) {
this.Routers = new Array();
for (let z in params.Routers) {
let obj = new Route();
obj.deserialize(params.Routers[z]);
this.Routers.push(obj);
}
}
}
} |
JavaScript | class ModifyInstanceAttributesConfig extends AbstractModel {
constructor(){
super();
/**
* Automatic creation. true: enabled, false: not enabled
* @type {boolean || null}
*/
this.AutoCreateTopicEnable = null;
/**
* Optional. If `auto.create.topic.enable` is set to `true` and this value is not set, 3 will be used by default
* @type {number || null}
*/
this.DefaultNumPartitions = null;
/**
* If `auto.create.topic.enable` is set to `true` but this value is not set, 2 will be used by default
* @type {number || null}
*/
this.DefaultReplicationFactor = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.AutoCreateTopicEnable = 'AutoCreateTopicEnable' in params ? params.AutoCreateTopicEnable : null;
this.DefaultNumPartitions = 'DefaultNumPartitions' in params ? params.DefaultNumPartitions : null;
this.DefaultReplicationFactor = 'DefaultReplicationFactor' in params ? params.DefaultReplicationFactor : null;
}
} |
JavaScript | class OperateResponseData extends AbstractModel {
constructor(){
super();
/**
* FlowId11
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.FlowId = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.FlowId = 'FlowId' in params ? params.FlowId : null;
}
} |
JavaScript | class ClusterInfo extends AbstractModel {
constructor(){
super();
/**
* Cluster ID
* @type {number || null}
*/
this.ClusterId = null;
/**
* Cluster name
* @type {string || null}
*/
this.ClusterName = null;
/**
* The cluster’s maximum disk capacity in GB
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.MaxDiskSize = null;
/**
* The cluster’s maximum bandwidth in MB/s
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.MaxBandWidth = null;
/**
* The cluster’s available disk capacity in GB
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.AvailableDiskSize = null;
/**
* The cluster’s available bandwidth in MB/s
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.AvailableBandWidth = null;
/**
* The AZ where the cluster resides
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.ZoneId = null;
/**
* The AZ where the cluster nodes reside. If the cluster is a multi-AZ cluster, this field means multiple AZs where the cluster nodes reside.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {Array.<number> || null}
*/
this.ZoneIds = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.ClusterId = 'ClusterId' in params ? params.ClusterId : null;
this.ClusterName = 'ClusterName' in params ? params.ClusterName : null;
this.MaxDiskSize = 'MaxDiskSize' in params ? params.MaxDiskSize : null;
this.MaxBandWidth = 'MaxBandWidth' in params ? params.MaxBandWidth : null;
this.AvailableDiskSize = 'AvailableDiskSize' in params ? params.AvailableDiskSize : null;
this.AvailableBandWidth = 'AvailableBandWidth' in params ? params.AvailableBandWidth : null;
this.ZoneId = 'ZoneId' in params ? params.ZoneId : null;
this.ZoneIds = 'ZoneIds' in params ? params.ZoneIds : null;
}
} |
JavaScript | class ConsumerGroupResponse extends AbstractModel {
constructor(){
super();
/**
* Number of eligible consumer groups
* @type {number || null}
*/
this.TotalCount = null;
/**
* Topic list
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<ConsumerGroupTopic> || null}
*/
this.TopicList = null;
/**
* Consumer group list
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<ConsumerGroup> || null}
*/
this.GroupList = null;
/**
* Total number of partitions
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.TotalPartition = null;
/**
* List of monitored partitions
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<Partition> || null}
*/
this.PartitionListForMonitor = null;
/**
* Total number of topics
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.TotalTopic = null;
/**
* List of monitored topics
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<ConsumerGroupTopic> || null}
*/
this.TopicListForMonitor = null;
/**
* List of monitored groups
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<Group> || null}
*/
this.GroupListForMonitor = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;
if (params.TopicList) {
this.TopicList = new Array();
for (let z in params.TopicList) {
let obj = new ConsumerGroupTopic();
obj.deserialize(params.TopicList[z]);
this.TopicList.push(obj);
}
}
if (params.GroupList) {
this.GroupList = new Array();
for (let z in params.GroupList) {
let obj = new ConsumerGroup();
obj.deserialize(params.GroupList[z]);
this.GroupList.push(obj);
}
}
this.TotalPartition = 'TotalPartition' in params ? params.TotalPartition : null;
if (params.PartitionListForMonitor) {
this.PartitionListForMonitor = new Array();
for (let z in params.PartitionListForMonitor) {
let obj = new Partition();
obj.deserialize(params.PartitionListForMonitor[z]);
this.PartitionListForMonitor.push(obj);
}
}
this.TotalTopic = 'TotalTopic' in params ? params.TotalTopic : null;
if (params.TopicListForMonitor) {
this.TopicListForMonitor = new Array();
for (let z in params.TopicListForMonitor) {
let obj = new ConsumerGroupTopic();
obj.deserialize(params.TopicListForMonitor[z]);
this.TopicListForMonitor.push(obj);
}
}
if (params.GroupListForMonitor) {
this.GroupListForMonitor = new Array();
for (let z in params.GroupListForMonitor) {
let obj = new Group();
obj.deserialize(params.GroupListForMonitor[z]);
this.GroupListForMonitor.push(obj);
}
}
}
} |
JavaScript | class GroupOffsetTopic extends AbstractModel {
constructor(){
super();
/**
* Topic name
* @type {string || null}
*/
this.Topic = null;
/**
* Array of partitions in the topic, where each element is a JSON object
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<GroupOffsetPartition> || null}
*/
this.Partitions = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Topic = 'Topic' in params ? params.Topic : null;
if (params.Partitions) {
this.Partitions = new Array();
for (let z in params.Partitions) {
let obj = new GroupOffsetPartition();
obj.deserialize(params.Partitions[z]);
this.Partitions.push(obj);
}
}
}
} |
JavaScript | class Partition extends AbstractModel {
constructor(){
super();
/**
* Partition ID
* @type {number || null}
*/
this.PartitionId = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.PartitionId = 'PartitionId' in params ? params.PartitionId : null;
}
} |
JavaScript | class DynamicRetentionTime extends AbstractModel {
constructor(){
super();
/**
* Whether the dynamic message retention time configuration is enabled. 0: disabled; 1: enabled
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.Enable = null;
/**
* Disk quota threshold (in percentage) for triggering the message retention time change event
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.DiskQuotaPercentage = null;
/**
* Percentage by which the message retention time is shortened each time
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.StepForwardPercentage = null;
/**
* Minimum retention time, in minutes
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.BottomRetention = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Enable = 'Enable' in params ? params.Enable : null;
this.DiskQuotaPercentage = 'DiskQuotaPercentage' in params ? params.DiskQuotaPercentage : null;
this.StepForwardPercentage = 'StepForwardPercentage' in params ? params.StepForwardPercentage : null;
this.BottomRetention = 'BottomRetention' in params ? params.BottomRetention : null;
}
} |
JavaScript | class InstanceDetailResponse extends AbstractModel {
constructor(){
super();
/**
* Total number of eligible instances
* @type {number || null}
*/
this.TotalCount = null;
/**
* List of eligible instance details
* @type {Array.<InstanceDetail> || null}
*/
this.InstanceList = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;
if (params.InstanceList) {
this.InstanceList = new Array();
for (let z in params.InstanceList) {
let obj = new InstanceDetail();
obj.deserialize(params.InstanceList[z]);
this.InstanceList.push(obj);
}
}
}
} |
JavaScript | class TopicInSyncReplicaInfo extends AbstractModel {
constructor(){
super();
/**
* Partition name
* @type {string || null}
*/
this.Partition = null;
/**
* Leader ID
* @type {number || null}
*/
this.Leader = null;
/**
* Replica set
* @type {string || null}
*/
this.Replica = null;
/**
* ISR
* @type {string || null}
*/
this.InSyncReplica = null;
/**
* Starting offset
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.BeginOffset = null;
/**
* Ending offset
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.EndOffset = null;
/**
* Number of messages
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.MessageCount = null;
/**
* Unsynced replica set
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.OutOfSyncReplica = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Partition = 'Partition' in params ? params.Partition : null;
this.Leader = 'Leader' in params ? params.Leader : null;
this.Replica = 'Replica' in params ? params.Replica : null;
this.InSyncReplica = 'InSyncReplica' in params ? params.InSyncReplica : null;
this.BeginOffset = 'BeginOffset' in params ? params.BeginOffset : null;
this.EndOffset = 'EndOffset' in params ? params.EndOffset : null;
this.MessageCount = 'MessageCount' in params ? params.MessageCount : null;
this.OutOfSyncReplica = 'OutOfSyncReplica' in params ? params.OutOfSyncReplica : null;
}
} |
JavaScript | class InstanceConfigDO extends AbstractModel {
constructor(){
super();
/**
* Whether to create topics automatically
* @type {boolean || null}
*/
this.AutoCreateTopicsEnable = null;
/**
* Number of partitions
* @type {number || null}
*/
this.DefaultNumPartitions = null;
/**
* Default replication factor
* @type {number || null}
*/
this.DefaultReplicationFactor = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.AutoCreateTopicsEnable = 'AutoCreateTopicsEnable' in params ? params.AutoCreateTopicsEnable : null;
this.DefaultNumPartitions = 'DefaultNumPartitions' in params ? params.DefaultNumPartitions : null;
this.DefaultReplicationFactor = 'DefaultReplicationFactor' in params ? params.DefaultReplicationFactor : null;
}
} |
JavaScript | class UserResponse extends AbstractModel {
constructor(){
super();
/**
* List of eligible users
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<User> || null}
*/
this.Users = null;
/**
* Total number of eligible users
* @type {number || null}
*/
this.TotalCount = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
if (params.Users) {
this.Users = new Array();
for (let z in params.Users) {
let obj = new User();
obj.deserialize(params.Users[z]);
this.Users.push(obj);
}
}
this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;
}
} |
JavaScript | class AppIdResponse extends AbstractModel {
constructor(){
super();
/**
* Number of eligible `AppId`
* @type {number || null}
*/
this.TotalCount = null;
/**
* List of eligible `AppId`
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<number> || null}
*/
this.AppIdList = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;
this.AppIdList = 'AppIdList' in params ? params.AppIdList : null;
}
} |
JavaScript | class Group extends AbstractModel {
constructor(){
super();
/**
* Group name
* @type {string || null}
*/
this.GroupName = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.GroupName = 'GroupName' in params ? params.GroupName : null;
}
} |
JavaScript | class AclResponse extends AbstractModel {
constructor(){
super();
/**
* Number of eligible data entries
* @type {number || null}
*/
this.TotalCount = null;
/**
* ACL list
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<Acl> || null}
*/
this.AclList = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;
if (params.AclList) {
this.AclList = new Array();
for (let z in params.AclList) {
let obj = new Acl();
obj.deserialize(params.AclList[z]);
this.AclList.push(obj);
}
}
}
} |
JavaScript | class Instance extends AbstractModel {
constructor(){
super();
/**
* Instance ID
* @type {string || null}
*/
this.InstanceId = null;
/**
* Instance name
* @type {string || null}
*/
this.InstanceName = null;
/**
* Instance status. 0: creating, 1: running, 2: deleting, 5: isolated, -1: creation failed
* @type {number || null}
*/
this.Status = null;
/**
* Whether it is an open-source instance. true: yes, false: no
Note: this field may return null, indicating that no valid values can be obtained.
* @type {boolean || null}
*/
this.IfCommunity = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.InstanceId = 'InstanceId' in params ? params.InstanceId : null;
this.InstanceName = 'InstanceName' in params ? params.InstanceName : null;
this.Status = 'Status' in params ? params.Status : null;
this.IfCommunity = 'IfCommunity' in params ? params.IfCommunity : null;
}
} |
JavaScript | class TopicDetailResponse extends AbstractModel {
constructor(){
super();
/**
* List of returned topic details
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<TopicDetail> || null}
*/
this.TopicList = null;
/**
* Number of all eligible topic details
* @type {number || null}
*/
this.TotalCount = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
if (params.TopicList) {
this.TopicList = new Array();
for (let z in params.TopicList) {
let obj = new TopicDetail();
obj.deserialize(params.TopicList[z]);
this.TopicList.push(obj);
}
}
this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;
}
} |
JavaScript | class TopicSubscribeGroup extends AbstractModel {
constructor(){
super();
/**
* Total number
* @type {number || null}
*/
this.TotalCount = null;
/**
* Number of consumer group status
* @type {string || null}
*/
this.StatusCountInfo = null;
/**
* Consumer group information
Note: this field may return `null`, indicating that no valid values can be obtained.
* @type {Array.<GroupInfoResponse> || null}
*/
this.GroupsInfo = null;
/**
* Whether a request is asynchronous. If there are fewer consumer groups in the instances, the result will be returned directly, and status code is 1. When there are many consumer groups in the instances, cache will be updated asynchronously. When status code is 0, grouping information will not be returned until cache update is completed and status code becomes 1.
Note: this field may return `null`, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.Status = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;
this.StatusCountInfo = 'StatusCountInfo' in params ? params.StatusCountInfo : null;
if (params.GroupsInfo) {
this.GroupsInfo = new Array();
for (let z in params.GroupsInfo) {
let obj = new GroupInfoResponse();
obj.deserialize(params.GroupsInfo[z]);
this.GroupsInfo.push(obj);
}
}
this.Status = 'Status' in params ? params.Status : null;
}
} |
JavaScript | class Config extends AbstractModel {
constructor(){
super();
/**
* Message retention period
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.Retention = null;
/**
* Minimum number of sync replications
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.MinInsyncReplicas = null;
/**
* Log cleanup mode. Default value: delete.
delete: logs will be deleted by save time; compact: logs will be compressed by key; compact, delete: logs will be compressed by key and deleted by save time.
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.CleanUpPolicy = null;
/**
* Segment rolling duration
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.SegmentMs = null;
/**
* 0: false, 1: true.
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.UncleanLeaderElectionEnable = null;
/**
* Number of bytes for segment rolling
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.SegmentBytes = null;
/**
* Maximum number of message bytes
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.MaxMessageBytes = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Retention = 'Retention' in params ? params.Retention : null;
this.MinInsyncReplicas = 'MinInsyncReplicas' in params ? params.MinInsyncReplicas : null;
this.CleanUpPolicy = 'CleanUpPolicy' in params ? params.CleanUpPolicy : null;
this.SegmentMs = 'SegmentMs' in params ? params.SegmentMs : null;
this.UncleanLeaderElectionEnable = 'UncleanLeaderElectionEnable' in params ? params.UncleanLeaderElectionEnable : null;
this.SegmentBytes = 'SegmentBytes' in params ? params.SegmentBytes : null;
this.MaxMessageBytes = 'MaxMessageBytes' in params ? params.MaxMessageBytes : null;
}
} |
JavaScript | class VipEntity extends AbstractModel {
constructor(){
super();
/**
* Virtual IP
* @type {string || null}
*/
this.Vip = null;
/**
* Virtual port
* @type {string || null}
*/
this.Vport = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Vip = 'Vip' in params ? params.Vip : null;
this.Vport = 'Vport' in params ? params.Vport : null;
}
} |
JavaScript | class ConsumerGroupTopic extends AbstractModel {
constructor(){
super();
/**
* Topic ID
* @type {string || null}
*/
this.TopicId = null;
/**
* Topic name
* @type {string || null}
*/
this.TopicName = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TopicId = 'TopicId' in params ? params.TopicId : null;
this.TopicName = 'TopicName' in params ? params.TopicName : null;
}
} |
JavaScript | class User extends AbstractModel {
constructor(){
super();
/**
* User ID
* @type {number || null}
*/
this.UserId = null;
/**
* Username
* @type {string || null}
*/
this.Name = null;
/**
* Creation time
* @type {string || null}
*/
this.CreateTime = null;
/**
* Last updated time
* @type {string || null}
*/
this.UpdateTime = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.UserId = 'UserId' in params ? params.UserId : null;
this.Name = 'Name' in params ? params.Name : null;
this.CreateTime = 'CreateTime' in params ? params.CreateTime : null;
this.UpdateTime = 'UpdateTime' in params ? params.UpdateTime : null;
}
} |
JavaScript | class GroupOffsetPartition extends AbstractModel {
constructor(){
super();
/**
* Topic `partitionId`
* @type {number || null}
*/
this.Partition = null;
/**
* Offset position submitted by consumer
* @type {number || null}
*/
this.Offset = null;
/**
* Metadata can be passed in for other purposes when the consumer submits messages. Currently, this parameter is usually an empty string
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Metadata = null;
/**
* Error code
* @type {number || null}
*/
this.ErrorCode = null;
/**
* Latest offset of current partition
* @type {number || null}
*/
this.LogEndOffset = null;
/**
* Number of unconsumed messages
* @type {number || null}
*/
this.Lag = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Partition = 'Partition' in params ? params.Partition : null;
this.Offset = 'Offset' in params ? params.Offset : null;
this.Metadata = 'Metadata' in params ? params.Metadata : null;
this.ErrorCode = 'ErrorCode' in params ? params.ErrorCode : null;
this.LogEndOffset = 'LogEndOffset' in params ? params.LogEndOffset : null;
this.Lag = 'Lag' in params ? params.Lag : null;
}
} |
JavaScript | class InstanceAttributesResponse extends AbstractModel {
constructor(){
super();
/**
* Instance ID
* @type {string || null}
*/
this.InstanceId = null;
/**
* Instance name
* @type {string || null}
*/
this.InstanceName = null;
/**
* VIP list information of access point
* @type {Array.<VipEntity> || null}
*/
this.VipList = null;
/**
* Virtual IP
* @type {string || null}
*/
this.Vip = null;
/**
* Virtual port
* @type {string || null}
*/
this.Vport = null;
/**
* Instance status. 0: creating, 1: running, 2: deleting
* @type {number || null}
*/
this.Status = null;
/**
* Instance bandwidth in Mbps
* @type {number || null}
*/
this.Bandwidth = null;
/**
* Instance storage capacity in GB
* @type {number || null}
*/
this.DiskSize = null;
/**
* AZ
* @type {number || null}
*/
this.ZoneId = null;
/**
* VPC ID. If this parameter is empty, it means the basic network
* @type {string || null}
*/
this.VpcId = null;
/**
* Subnet ID. If this parameter is empty, it means the basic network
* @type {string || null}
*/
this.SubnetId = null;
/**
* Instance health status. 1: healthy, 2: alarmed, 3: exceptional
* @type {number || null}
*/
this.Healthy = null;
/**
* Instance health information. Currently, the disk utilization is displayed with a maximum length of 256
* @type {string || null}
*/
this.HealthyMessage = null;
/**
* Creation time
* @type {number || null}
*/
this.CreateTime = null;
/**
* Message retention period in minutes
* @type {number || null}
*/
this.MsgRetentionTime = null;
/**
* Configuration for automatic topic creation. If this field is empty, it means that automatic creation is not enabled
* @type {InstanceConfigDO || null}
*/
this.Config = null;
/**
* Number of remaining creatable partitions
* @type {number || null}
*/
this.RemainderPartitions = null;
/**
* Number of remaining creatable topics
* @type {number || null}
*/
this.RemainderTopics = null;
/**
* Number of partitions already created
* @type {number || null}
*/
this.CreatedPartitions = null;
/**
* Number of topics already created
* @type {number || null}
*/
this.CreatedTopics = null;
/**
* Tag array
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<Tag> || null}
*/
this.Tags = null;
/**
* Expiration time
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.ExpireTime = null;
/**
* Cross-AZ
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<number> || null}
*/
this.ZoneIds = null;
/**
* Kafka version information
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Version = null;
/**
* Maximum number of groups
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.MaxGroupNum = null;
/**
* Offering type. `0`: Standard Edition; `1`: Professional Edition
Note: this field may return `null`, indicating that no valid value was found.
* @type {number || null}
*/
this.Cvm = null;
/**
* Type.
Note: this field may return `null`, indicating that no valid value was found.
* @type {string || null}
*/
this.InstanceType = null;
/**
* Features supported by the instance. `FEATURE_SUBNET_ACL` indicates that the ACL policy supports setting subnets.
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<string> || null}
*/
this.Features = null;
/**
* Dynamic message retention policy
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {DynamicRetentionTime || null}
*/
this.RetentionTimeConfig = null;
/**
* Maximum number of connections
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.MaxConnection = null;
/**
* Public network bandwidth
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.PublicNetwork = null;
/**
* Time
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.DeleteRouteTimestamp = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.InstanceId = 'InstanceId' in params ? params.InstanceId : null;
this.InstanceName = 'InstanceName' in params ? params.InstanceName : null;
if (params.VipList) {
this.VipList = new Array();
for (let z in params.VipList) {
let obj = new VipEntity();
obj.deserialize(params.VipList[z]);
this.VipList.push(obj);
}
}
this.Vip = 'Vip' in params ? params.Vip : null;
this.Vport = 'Vport' in params ? params.Vport : null;
this.Status = 'Status' in params ? params.Status : null;
this.Bandwidth = 'Bandwidth' in params ? params.Bandwidth : null;
this.DiskSize = 'DiskSize' in params ? params.DiskSize : null;
this.ZoneId = 'ZoneId' in params ? params.ZoneId : null;
this.VpcId = 'VpcId' in params ? params.VpcId : null;
this.SubnetId = 'SubnetId' in params ? params.SubnetId : null;
this.Healthy = 'Healthy' in params ? params.Healthy : null;
this.HealthyMessage = 'HealthyMessage' in params ? params.HealthyMessage : null;
this.CreateTime = 'CreateTime' in params ? params.CreateTime : null;
this.MsgRetentionTime = 'MsgRetentionTime' in params ? params.MsgRetentionTime : null;
if (params.Config) {
let obj = new InstanceConfigDO();
obj.deserialize(params.Config)
this.Config = obj;
}
this.RemainderPartitions = 'RemainderPartitions' in params ? params.RemainderPartitions : null;
this.RemainderTopics = 'RemainderTopics' in params ? params.RemainderTopics : null;
this.CreatedPartitions = 'CreatedPartitions' in params ? params.CreatedPartitions : null;
this.CreatedTopics = 'CreatedTopics' in params ? params.CreatedTopics : null;
if (params.Tags) {
this.Tags = new Array();
for (let z in params.Tags) {
let obj = new Tag();
obj.deserialize(params.Tags[z]);
this.Tags.push(obj);
}
}
this.ExpireTime = 'ExpireTime' in params ? params.ExpireTime : null;
this.ZoneIds = 'ZoneIds' in params ? params.ZoneIds : null;
this.Version = 'Version' in params ? params.Version : null;
this.MaxGroupNum = 'MaxGroupNum' in params ? params.MaxGroupNum : null;
this.Cvm = 'Cvm' in params ? params.Cvm : null;
this.InstanceType = 'InstanceType' in params ? params.InstanceType : null;
this.Features = 'Features' in params ? params.Features : null;
if (params.RetentionTimeConfig) {
let obj = new DynamicRetentionTime();
obj.deserialize(params.RetentionTimeConfig)
this.RetentionTimeConfig = obj;
}
this.MaxConnection = 'MaxConnection' in params ? params.MaxConnection : null;
this.PublicNetwork = 'PublicNetwork' in params ? params.PublicNetwork : null;
this.DeleteRouteTimestamp = 'DeleteRouteTimestamp' in params ? params.DeleteRouteTimestamp : null;
}
} |
JavaScript | class Filter extends AbstractModel {
constructor(){
super();
/**
* Field to be filtered.
* @type {string || null}
*/
this.Name = null;
/**
* Filter value of field.
* @type {Array.<string> || null}
*/
this.Values = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Name = 'Name' in params ? params.Name : null;
this.Values = 'Values' in params ? params.Values : null;
}
} |
JavaScript | class GroupOffsetResponse extends AbstractModel {
constructor(){
super();
/**
* Total number of eligible results
* @type {number || null}
*/
this.TotalCount = null;
/**
* Array of partitions in the topic, where each element is a JSON object
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<GroupOffsetTopic> || null}
*/
this.TopicList = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;
if (params.TopicList) {
this.TopicList = new Array();
for (let z in params.TopicList) {
let obj = new GroupOffsetTopic();
obj.deserialize(params.TopicList[z]);
this.TopicList.push(obj);
}
}
}
} |
JavaScript | class TopicInSyncReplicaResult extends AbstractModel {
constructor(){
super();
/**
* Set of topic details and replicas
* @type {Array.<TopicInSyncReplicaInfo> || null}
*/
this.TopicInSyncReplicaList = null;
/**
* Total number
* @type {number || null}
*/
this.TotalCount = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
if (params.TopicInSyncReplicaList) {
this.TopicInSyncReplicaList = new Array();
for (let z in params.TopicInSyncReplicaList) {
let obj = new TopicInSyncReplicaInfo();
obj.deserialize(params.TopicInSyncReplicaList[z]);
this.TopicInSyncReplicaList.push(obj);
}
}
this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;
}
} |
JavaScript | class GroupInfoResponse extends AbstractModel {
constructor(){
super();
/**
* Error code. 0: success
* @type {string || null}
*/
this.ErrorCode = null;
/**
* Group status description (common valid values: Empty, Stable, Dead):
Dead: the consumer group does not exist
Empty: there are currently no consumer subscriptions in the consumer group
PreparingRebalance: the consumer group is currently in `rebalance` state
CompletingRebalance: the consumer group is currently in `rebalance` state
Stable: each consumer in the consumer group has joined and is in stable state
* @type {string || null}
*/
this.State = null;
/**
* The type of protocol selected by the consumer group, which is `consumer` for common consumers. However, some systems use their own protocols; for example, the protocol used by kafka-connect is `connect`. Only with the standard `consumer` protocol can this API get to know the specific assigning method and parse the specific partition assignment
* @type {string || null}
*/
this.ProtocolType = null;
/**
* Consumer partition assignment algorithm, such as `range` (which is the default value for the Kafka consumer SDK), `roundrobin`, and `sticky`
* @type {string || null}
*/
this.Protocol = null;
/**
* This array contains information only if `state` is `Stable` and `protocol_type` is `consumer`
* @type {Array.<GroupInfoMember> || null}
*/
this.Members = null;
/**
* Kafka consumer group
* @type {string || null}
*/
this.Group = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.ErrorCode = 'ErrorCode' in params ? params.ErrorCode : null;
this.State = 'State' in params ? params.State : null;
this.ProtocolType = 'ProtocolType' in params ? params.ProtocolType : null;
this.Protocol = 'Protocol' in params ? params.Protocol : null;
if (params.Members) {
this.Members = new Array();
for (let z in params.Members) {
let obj = new GroupInfoMember();
obj.deserialize(params.Members[z]);
this.Members.push(obj);
}
}
this.Group = 'Group' in params ? params.Group : null;
}
} |
JavaScript | class TopicAttributesResponse extends AbstractModel {
constructor(){
super();
/**
* Topic ID
* @type {string || null}
*/
this.TopicId = null;
/**
* Creation time
* @type {number || null}
*/
this.CreateTime = null;
/**
* Topic remarks
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Note = null;
/**
* Number of partitions
* @type {number || null}
*/
this.PartitionNum = null;
/**
* IP allowlist switch. 1: enabled, 0: disabled
* @type {number || null}
*/
this.EnableWhiteList = null;
/**
* IP allowlist list
* @type {Array.<string> || null}
*/
this.IpWhiteList = null;
/**
* Topic configuration array
* @type {Config || null}
*/
this.Config = null;
/**
* Partition details
* @type {Array.<TopicPartitionDO> || null}
*/
this.Partitions = null;
/**
* Switch of the preset ACL rule. `1`: enable, `0`: disable.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.EnableAclRule = null;
/**
* Preset ACL rule list.
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {Array.<AclRule> || null}
*/
this.AclRuleList = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TopicId = 'TopicId' in params ? params.TopicId : null;
this.CreateTime = 'CreateTime' in params ? params.CreateTime : null;
this.Note = 'Note' in params ? params.Note : null;
this.PartitionNum = 'PartitionNum' in params ? params.PartitionNum : null;
this.EnableWhiteList = 'EnableWhiteList' in params ? params.EnableWhiteList : null;
this.IpWhiteList = 'IpWhiteList' in params ? params.IpWhiteList : null;
if (params.Config) {
let obj = new Config();
obj.deserialize(params.Config)
this.Config = obj;
}
if (params.Partitions) {
this.Partitions = new Array();
for (let z in params.Partitions) {
let obj = new TopicPartitionDO();
obj.deserialize(params.Partitions[z]);
this.Partitions.push(obj);
}
}
this.EnableAclRule = 'EnableAclRule' in params ? params.EnableAclRule : null;
if (params.AclRuleList) {
this.AclRuleList = new Array();
for (let z in params.AclRuleList) {
let obj = new AclRule();
obj.deserialize(params.AclRuleList[z]);
this.AclRuleList.push(obj);
}
}
}
} |
JavaScript | class InstanceResponse extends AbstractModel {
constructor(){
super();
/**
* List of eligible instances
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<Instance> || null}
*/
this.InstanceList = null;
/**
* Total number of eligible results
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.TotalCount = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
if (params.InstanceList) {
this.InstanceList = new Array();
for (let z in params.InstanceList) {
let obj = new Instance();
obj.deserialize(params.InstanceList[z]);
this.InstanceList.push(obj);
}
}
this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;
}
} |
JavaScript | class DescribeGroup extends AbstractModel {
constructor(){
super();
/**
* groupId
* @type {string || null}
*/
this.Group = null;
/**
* Protocol used by the group.
* @type {string || null}
*/
this.Protocol = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Group = 'Group' in params ? params.Group : null;
this.Protocol = 'Protocol' in params ? params.Protocol : null;
}
} |
JavaScript | class TopicPartitionDO extends AbstractModel {
constructor(){
super();
/**
* Partition ID
* @type {number || null}
*/
this.Partition = null;
/**
* Leader running status
* @type {number || null}
*/
this.LeaderStatus = null;
/**
* ISR quantity
* @type {number || null}
*/
this.IsrNum = null;
/**
* Number of replicas
* @type {number || null}
*/
this.ReplicaNum = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Partition = 'Partition' in params ? params.Partition : null;
this.LeaderStatus = 'LeaderStatus' in params ? params.LeaderStatus : null;
this.IsrNum = 'IsrNum' in params ? params.IsrNum : null;
this.ReplicaNum = 'ReplicaNum' in params ? params.ReplicaNum : null;
}
} |
JavaScript | class CreateTopicResp extends AbstractModel {
constructor(){
super();
/**
* Topic ID
* @type {string || null}
*/
this.TopicId = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TopicId = 'TopicId' in params ? params.TopicId : null;
}
} |
JavaScript | class ConsumerRecord extends AbstractModel {
constructor(){
super();
/**
* Topic name
* @type {string || null}
*/
this.Topic = null;
/**
* Partition ID
* @type {number || null}
*/
this.Partition = null;
/**
* Offset
* @type {number || null}
*/
this.Offset = null;
/**
* Message key
Note: this field may return `null`, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Key = null;
/**
* Message value
Note: this field may return `null`, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Value = null;
/**
* Message timestamp
Note: this field may return `null`, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.Timestamp = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Topic = 'Topic' in params ? params.Topic : null;
this.Partition = 'Partition' in params ? params.Partition : null;
this.Offset = 'Offset' in params ? params.Offset : null;
this.Key = 'Key' in params ? params.Key : null;
this.Value = 'Value' in params ? params.Value : null;
this.Timestamp = 'Timestamp' in params ? params.Timestamp : null;
}
} |
JavaScript | class Route extends AbstractModel {
constructor(){
super();
/**
* Instance connection method
0: PLAINTEXT (plaintext method, which does not carry user information and is supported for legacy versions and Community Edition)
1: SASL_PLAINTEXT (plaintext method, which authenticates the login through SASL before data start and is supported only for Community Edition)
2: SSL (SSL-encrypted communication, which does not carry user information and is supported for legacy versions and Community Edition)
3: SASL_SSL (SSL-encrypted communication, which authenticates the login through SASL before data start and is supported only for Community Edition)
* @type {number || null}
*/
this.AccessType = null;
/**
* Route ID
* @type {number || null}
*/
this.RouteId = null;
/**
* VIP network type (1: public network TGW; 2: classic network; 3: VPC; 4: supporting network (Standard Edition); 5: SSL public network access; 6: BM VPC; 7: supporting network (Pro Edition))
* @type {number || null}
*/
this.VipType = null;
/**
* Virtual IP list
* @type {Array.<VipEntity> || null}
*/
this.VipList = null;
/**
* Domain name
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Domain = null;
/**
* Domain name port
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.DomainPort = null;
/**
* Timestamp
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.DeleteTimestamp = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.AccessType = 'AccessType' in params ? params.AccessType : null;
this.RouteId = 'RouteId' in params ? params.RouteId : null;
this.VipType = 'VipType' in params ? params.VipType : null;
if (params.VipList) {
this.VipList = new Array();
for (let z in params.VipList) {
let obj = new VipEntity();
obj.deserialize(params.VipList[z]);
this.VipList.push(obj);
}
}
this.Domain = 'Domain' in params ? params.Domain : null;
this.DomainPort = 'DomainPort' in params ? params.DomainPort : null;
this.DeleteTimestamp = 'DeleteTimestamp' in params ? params.DeleteTimestamp : null;
}
} |
JavaScript | class AclRuleInfo extends AbstractModel {
constructor(){
super();
/**
* ACL operation types. Enumerated values: `All` (all operations), `Read` (read), `Write` (write).
* @type {string || null}
*/
this.Operation = null;
/**
* Permission types: `Deny`, `Allow`.
* @type {string || null}
*/
this.PermissionType = null;
/**
* The default value is `*`, which means that any host can access the topic. CKafka currently does not support specifying a host value of * or an IP range.
* @type {string || null}
*/
this.Host = null;
/**
* The list of users allowed to access the topic. Default value: `User:*`, which means all users. The current user must be in the user list. Add the prefix `User:` before the user name (`User:A`, for example).
* @type {string || null}
*/
this.Principal = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Operation = 'Operation' in params ? params.Operation : null;
this.PermissionType = 'PermissionType' in params ? params.PermissionType : null;
this.Host = 'Host' in params ? params.Host : null;
this.Principal = 'Principal' in params ? params.Principal : null;
}
} |
JavaScript | class Acl extends AbstractModel {
constructor(){
super();
/**
* ACL resource type. 0: UNKNOWN, 1: ANY, 2: TOPIC, 3: GROUP, 4: CLUSTER, 5: TRANSACTIONAL_ID. Currently, only `TOPIC` is available,
* @type {number || null}
*/
this.ResourceType = null;
/**
* Resource name, which is related to `resourceType`. For example, if `resourceType` is `TOPIC`, this field indicates the topic name; if `resourceType` is `GROUP`, this field indicates the group name
* @type {string || null}
*/
this.ResourceName = null;
/**
* User list. The default value is `User:*`, which means that any user can access. The current user can only be one included in the user list
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Principal = null;
/**
* The default value is `*`, which means that any host can access. Currently, CKafka does not support the host as `*`, but the future product based on the open-source Kafka will directly support this
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Host = null;
/**
* ACL operation mode. 0: UNKNOWN, 1: ANY, 2: ALL, 3: READ, 4: WRITE, 5: CREATE, 6: DELETE, 7: ALTER, 8: DESCRIBE, 9: CLUSTER_ACTION, 10: DESCRIBE_CONFIGS, 11: ALTER_CONFIGS, 12: IDEMPOTEN_WRITE
* @type {number || null}
*/
this.Operation = null;
/**
* Permission type. 0: UNKNOWN, 1: ANY, 2: DENY, 3: ALLOW
* @type {number || null}
*/
this.PermissionType = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.ResourceType = 'ResourceType' in params ? params.ResourceType : null;
this.ResourceName = 'ResourceName' in params ? params.ResourceName : null;
this.Principal = 'Principal' in params ? params.Principal : null;
this.Host = 'Host' in params ? params.Host : null;
this.Operation = 'Operation' in params ? params.Operation : null;
this.PermissionType = 'PermissionType' in params ? params.PermissionType : null;
}
} |
JavaScript | class TopicRetentionTimeConfigRsp extends AbstractModel {
constructor(){
super();
/**
* Expected value, i.e., the topic message retention time (min) configured
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.Expect = null;
/**
* Current value (min), i.e., the retention time currently in effect, which may be dynamically adjusted
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.Current = null;
/**
* Last modified time
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.ModTimeStamp = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.Expect = 'Expect' in params ? params.Expect : null;
this.Current = 'Current' in params ? params.Current : null;
this.ModTimeStamp = 'ModTimeStamp' in params ? params.ModTimeStamp : null;
}
} |
JavaScript | class InstanceDetail extends AbstractModel {
constructor(){
super();
/**
* Instance ID
* @type {string || null}
*/
this.InstanceId = null;
/**
* Instance name
* @type {string || null}
*/
this.InstanceName = null;
/**
* Instance VIP information
* @type {string || null}
*/
this.Vip = null;
/**
* Instance port information
* @type {string || null}
*/
this.Vport = null;
/**
* Virtual IP list
* @type {Array.<VipEntity> || null}
*/
this.VipList = null;
/**
* Instance status. 0: creating, 1: running, 2: deleting, 5: isolated, -1: creation failed
* @type {number || null}
*/
this.Status = null;
/**
* Instance bandwidth in Mbps
* @type {number || null}
*/
this.Bandwidth = null;
/**
* Instance storage capacity in GB
* @type {number || null}
*/
this.DiskSize = null;
/**
* AZ ID
* @type {number || null}
*/
this.ZoneId = null;
/**
* vpcId. If this parameter is empty, it means the basic network
* @type {string || null}
*/
this.VpcId = null;
/**
* Subnet ID
* @type {string || null}
*/
this.SubnetId = null;
/**
* Whether to renew the instance automatically, which is an int-type enumerated value. 1: yes, 2: no
* @type {number || null}
*/
this.RenewFlag = null;
/**
* Instance status, which is an int-type value. 0: healthy, 1: alarmed, 2: exceptional
* @type {number || null}
*/
this.Healthy = null;
/**
* Instance status information
* @type {string || null}
*/
this.HealthyMessage = null;
/**
* Instance creation time
* @type {number || null}
*/
this.CreateTime = null;
/**
* Instance expiration time
* @type {number || null}
*/
this.ExpireTime = null;
/**
* Whether it is an internal customer. 1: yes
* @type {number || null}
*/
this.IsInternal = null;
/**
* Number of topics
* @type {number || null}
*/
this.TopicNum = null;
/**
* Tag
* @type {Array.<Tag> || null}
*/
this.Tags = null;
/**
* Kafka version information
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.Version = null;
/**
* Cross-AZ
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<number> || null}
*/
this.ZoneIds = null;
/**
* CKafka sale type
Note: this field may return null, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.Cvm = null;
/**
* CKafka instance type
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.InstanceType = null;
/**
* Disk type
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.DiskType = null;
/**
* Maximum number of topics for the current instance
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.MaxTopicNumber = null;
/**
* Maximum number of partitions for the current instance
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {number || null}
*/
this.MaxPartitionNumber = null;
/**
* Time of scheduled upgrade
Note: `null` may be returned for this field, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.RebalanceTime = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.InstanceId = 'InstanceId' in params ? params.InstanceId : null;
this.InstanceName = 'InstanceName' in params ? params.InstanceName : null;
this.Vip = 'Vip' in params ? params.Vip : null;
this.Vport = 'Vport' in params ? params.Vport : null;
if (params.VipList) {
this.VipList = new Array();
for (let z in params.VipList) {
let obj = new VipEntity();
obj.deserialize(params.VipList[z]);
this.VipList.push(obj);
}
}
this.Status = 'Status' in params ? params.Status : null;
this.Bandwidth = 'Bandwidth' in params ? params.Bandwidth : null;
this.DiskSize = 'DiskSize' in params ? params.DiskSize : null;
this.ZoneId = 'ZoneId' in params ? params.ZoneId : null;
this.VpcId = 'VpcId' in params ? params.VpcId : null;
this.SubnetId = 'SubnetId' in params ? params.SubnetId : null;
this.RenewFlag = 'RenewFlag' in params ? params.RenewFlag : null;
this.Healthy = 'Healthy' in params ? params.Healthy : null;
this.HealthyMessage = 'HealthyMessage' in params ? params.HealthyMessage : null;
this.CreateTime = 'CreateTime' in params ? params.CreateTime : null;
this.ExpireTime = 'ExpireTime' in params ? params.ExpireTime : null;
this.IsInternal = 'IsInternal' in params ? params.IsInternal : null;
this.TopicNum = 'TopicNum' in params ? params.TopicNum : null;
if (params.Tags) {
this.Tags = new Array();
for (let z in params.Tags) {
let obj = new Tag();
obj.deserialize(params.Tags[z]);
this.Tags.push(obj);
}
}
this.Version = 'Version' in params ? params.Version : null;
this.ZoneIds = 'ZoneIds' in params ? params.ZoneIds : null;
this.Cvm = 'Cvm' in params ? params.Cvm : null;
this.InstanceType = 'InstanceType' in params ? params.InstanceType : null;
this.DiskType = 'DiskType' in params ? params.DiskType : null;
this.MaxTopicNumber = 'MaxTopicNumber' in params ? params.MaxTopicNumber : null;
this.MaxPartitionNumber = 'MaxPartitionNumber' in params ? params.MaxPartitionNumber : null;
this.RebalanceTime = 'RebalanceTime' in params ? params.RebalanceTime : null;
}
} |
JavaScript | class SubscribedInfo extends AbstractModel {
constructor(){
super();
/**
* Subscribed topic name
* @type {string || null}
*/
this.TopicName = null;
/**
* Subscribed partition
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<number> || null}
*/
this.Partition = null;
/**
* Partition offset information
Note: this field may return null, indicating that no valid values can be obtained.
* @type {Array.<PartitionOffset> || null}
*/
this.PartitionOffset = null;
/**
* ID of the subscribed topic.
Note: this field may return null, indicating that no valid values can be obtained.
* @type {string || null}
*/
this.TopicId = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.TopicName = 'TopicName' in params ? params.TopicName : null;
this.Partition = 'Partition' in params ? params.Partition : null;
if (params.PartitionOffset) {
this.PartitionOffset = new Array();
for (let z in params.PartitionOffset) {
let obj = new PartitionOffset();
obj.deserialize(params.PartitionOffset[z]);
this.PartitionOffset.push(obj);
}
}
this.TopicId = 'TopicId' in params ? params.TopicId : null;
}
} |
JavaScript | class Price extends AbstractModel {
constructor(){
super();
/**
* Discounted price
* @type {number || null}
*/
this.RealTotalCost = null;
/**
* Original price
* @type {number || null}
*/
this.TotalCost = null;
}
/**
* @private
*/
deserialize(params) {
if (!params) {
return;
}
this.RealTotalCost = 'RealTotalCost' in params ? params.RealTotalCost : null;
this.TotalCost = 'TotalCost' in params ? params.TotalCost : null;
}
} |
JavaScript | class PlainResultParser extends AbstractObjectResultParser {
addEntity(entityAlias, dbEntity, context) {
return context.ioc.applicationUtils.getNewEntity(dbEntity, context.ioc.airDb);
}
addProperty(entityAlias, resultObject, dataType, propertyName, propertyValue) {
resultObject[propertyName] = propertyValue;
return objectExists(propertyValue);
}
bufferManyToOneStub(entityAlias, dbEntity, resultObject, propertyName, relationDbEntity, relationInfos, context) {
this.addManyToOneStub(resultObject, propertyName, relationInfos, context);
}
bufferManyToOneObject(entityAlias, dbEntity, resultObject, propertyName, relationDbEntity, childResultObject, context) {
resultObject[propertyName] = childResultObject;
}
bufferBlankManyToOneStub(entityAlias, resultObject, propertyName, relationInfos) {
resultObject[propertyName] = null;
// Nothing to do the facade simply doesn't have anything in it
}
bufferBlankManyToOneObject(entityAlias, resultObject, propertyName) {
resultObject[propertyName] = null;
// Nothing to do the facade simply doesn't have anything in it
}
bufferOneToManyStub(otmDbEntity, otmPropertyName) {
throw new Error(`@OneToMany stubs not allowed in QueryResultType.PLAIN`);
}
bufferOneToManyCollection(entityAlias, resultObject, otmDbEntity, propertyName, relationDbEntity, childResultObject, context) {
resultObject[propertyName] = [childResultObject];
}
bufferBlankOneToMany(entityAlias, resultObject, otmEntityName, propertyName, relationDbEntity, context) {
resultObject[propertyName] = [];
}
flushEntity(entityAlias, dbEntity, selectClauseFragment, entityId, resultObject, context) {
// Nothing to be done, plain objects don't need to be flushed since they don't relate
// do any other rows
return resultObject;
}
flushRow() {
// Nothing to be done, plain rows don't need to be flushed since they don't relate do
// any other rows
}
bridge(parsedResults, selectClauseFragment, context) {
// Nothing to be done, plain queries are not bridged
return parsedResults;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.