conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
if (is_func_expr(node)) {
=======
if (node instanceof AST_Function) {
node.inlined = false;
>>>>>>>
if (is_func_expr(node)) {
node.inlined = false;
<<<<<<<
var abort = false, replaced = false, can_replace = !args || !hit;
var tt = new TreeTransformer(function(node, descend) {
if (abort) return node;
// Skip nodes before `candidate` as quickly as possible
if (!hit) {
if (node === candidate) {
hit = true;
return node;
}
return;
}
// Stop immediately if these node types are encountered
var parent = tt.parent();
if (node instanceof AST_Assign && node.operator != "=" && lhs.equivalent_to(node.left)
|| node instanceof AST_Await
|| node instanceof AST_Call && lhs instanceof AST_PropAccess && lhs.equivalent_to(node.expression)
|| node instanceof AST_Debugger
|| node instanceof AST_Destructuring
|| node instanceof AST_IterationStatement && !(node instanceof AST_For)
|| node instanceof AST_SymbolRef && !node.is_declared(compressor)
|| node instanceof AST_Try
|| node instanceof AST_With
|| parent instanceof AST_For && node !== parent.init) {
abort = true;
return node;
}
// Replace variable with assignment when found
if (can_replace
&& !(node instanceof AST_SymbolDeclaration)
&& !is_lhs(node, parent)
&& lhs.equivalent_to(node)) {
CHANGED = replaced = abort = true;
compressor.info("Collapsing {name} [{file}:{line},{col}]", {
name: node.print_to_string(),
file: node.start.file,
line: node.start.line,
col: node.start.col
});
if (candidate instanceof AST_UnaryPostfix) {
return make_node(AST_UnaryPrefix, candidate, candidate);
}
if (candidate instanceof AST_VarDef) {
var def = candidate.name.definition();
if (def.references.length == 1 && !compressor.exposed(def)) {
return maintain_this_binding(parent, node, candidate.value);
}
return make_node(AST_Assign, candidate, {
operator: "=",
left: make_node(AST_SymbolRef, candidate.name, candidate.name),
right: candidate.value
});
}
candidate.write_only = false;
return candidate;
}
// These node types have child nodes that execute sequentially,
// but are otherwise not safe to scan into or beyond them.
var sym;
if (node instanceof AST_Call
|| node instanceof AST_Exit
|| node instanceof AST_PropAccess
&& (side_effects || node.expression.may_throw_on_access(compressor))
|| node instanceof AST_SymbolRef
&& (lvalues[node.name]
|| side_effects && !references_in_scope(node.definition()))
|| (sym = lhs_or_def(node))
&& (sym instanceof AST_PropAccess || sym.name in lvalues)
|| (side_effects || !one_off)
&& (parent instanceof AST_Binary && lazy_op(parent.operator)
|| parent instanceof AST_Case
|| parent instanceof AST_Conditional
|| parent instanceof AST_If)) {
if (!(node instanceof AST_Scope)) descend(node, tt);
abort = true;
return node;
}
// Skip (non-executed) functions and (leading) default case in switch statements
if (node instanceof AST_Default || node instanceof AST_Scope) return node;
});
=======
var abort = false, replaced = 0, can_replace = !args || !hit;
>>>>>>>
var abort = false, replaced = 0, can_replace = !args || !hit;
<<<<<<<
for (var j = compressor.self().argnames.lastIndexOf(candidate.__name || candidate.name) + 1; j < args.length; j++) {
args[j].transform(tt);
=======
for (var j = compressor.self().argnames.lastIndexOf(candidate.name) + 1; !abort && j < args.length; j++) {
args[j].transform(scanner);
>>>>>>>
for (var j = compressor.self().argnames.lastIndexOf(candidate.name) + 1; !abort && j < args.length; j++) {
args[j].transform(scanner);
<<<<<<<
var var_names = Object.create(null);
self.enclosed.forEach(function(def) {
var_names[def.name] = true;
});
self.variables.each(function(def, name) {
var_names[name] = true;
});
var tt = new TreeTransformer(function(node) {
if (node instanceof AST_Definitions && tt.parent() instanceof AST_Export) return node;
=======
return self.transform(new TreeTransformer(function(node) {
>>>>>>>
var tt = new TreeTransformer(function(node) {
if (node instanceof AST_Definitions && tt.parent() instanceof AST_Export) return node;
<<<<<<<
}).optimize(compressor);
break;
case "Symbol":
// Symbol's argument is only used for debugging.
self.args = [];
return self;
}
}
else if (exp instanceof AST_Dot && exp.property == "toString" && self.args.length == 0) {
return make_node(AST_Binary, self, {
=======
}),
operator: "!"
}).optimize(compressor);
break;
} else if (exp instanceof AST_Dot) switch(exp.property) {
case "toString":
if (self.args.length == 0) return make_node(AST_Binary, self, {
>>>>>>>
}),
operator: "!"
}).optimize(compressor);
break;
case "Symbol":
// Symbol's argument is only used for debugging.
self.args = [];
return self;
} else if (exp instanceof AST_Dot) switch(exp.property) {
case "toString":
if (self.args.length == 0) return make_node(AST_Binary, self, {
<<<<<<<
}
else if (exp instanceof AST_Dot && exp.expression instanceof AST_Array && exp.property == "join") EXIT: {
var separator;
if (self.args.length > 0) {
separator = self.args[0].evaluate(compressor);
if (separator === self.args[0]) break EXIT; // not a constant
}
var elements = [];
var consts = [];
for (var i = 0, len = exp.expression.elements.length; i < len; i++) {
var el = exp.expression.elements[i];
if (el instanceof AST_Expansion) break EXIT;
var value = el.evaluate(compressor);
if (value !== el) {
consts.push(value);
} else {
if (consts.length > 0) {
elements.push(make_node(AST_String, self, {
value: consts.join(separator)
}));
consts.length = 0;
}
elements.push(el);
}
}
if (consts.length > 0) {
elements.push(make_node(AST_String, self, {
value: consts.join(separator)
}));
}
if (elements.length == 0) return make_node(AST_String, self, { value: "" });
if (elements.length == 1) {
if (elements[0].is_string(compressor)) {
return elements[0];
=======
break;
case "join":
if (exp.expression instanceof AST_Array) EXIT: {
var separator;
if (self.args.length > 0) {
separator = self.args[0].evaluate(compressor);
if (separator === self.args[0]) break EXIT; // not a constant
>>>>>>>
break;
case "join":
if (exp.expression instanceof AST_Array) EXIT: {
var separator;
if (self.args.length > 0) {
separator = self.args[0].evaluate(compressor);
if (separator === self.args[0]) break EXIT; // not a constant |
<<<<<<<
var ch = get_full_char(str, 0);
var prev = get_full_char(last, last.length - 1);
=======
var ch = str.charAt(0);
if (need_newline_indented && ch) {
need_newline_indented = false;
if (ch != "\n") {
print("\n");
indent();
}
}
if (need_space && ch) {
need_space = false;
if (!/[\s;})]/.test(ch)) {
space();
}
}
newline_insert = -1;
var prev = last.charAt(last.length - 1);
>>>>>>>
var ch = get_full_char(str, 0);
var prev = get_full_char(last, last.length - 1);
if (need_newline_indented && ch) {
need_newline_indented = false;
if (ch != "\n") {
print("\n");
indent();
}
}
if (need_space && ch) {
need_space = false;
if (!/[\s;})]/.test(ch)) {
space();
}
}
newline_insert = -1;
var prev = last.charAt(last.length - 1); |
<<<<<<<
if (this.operator == "typeof" && is_func_expr(this.expression)) {
=======
if (compressor.option("typeofs")
&& this.operator == "typeof"
&& (e instanceof AST_Lambda
|| e instanceof AST_SymbolRef
&& e.fixed_value() instanceof AST_Lambda)) {
>>>>>>>
if (compressor.option("typeofs")
&& this.operator == "typeof"
&& (e instanceof AST_Lambda
|| e instanceof AST_SymbolRef
&& e.fixed_value() instanceof AST_Lambda)) {
<<<<<<<
var sym;
if (scope === self
&& (sym = assign_as_unused(node)) instanceof AST_SymbolRef
&& !is_ref_of(node.left, AST_SymbolBlockDeclaration)
&& self.variables.get(sym.name) === sym.definition()) {
if (node instanceof AST_Assign) node.right.walk(tw);
return true;
}
if (node instanceof AST_SymbolRef) {
var node_def = node.definition();
if (!(node_def.id in in_use_ids)) {
in_use_ids[node_def.id] = true;
in_use.push(node_def);
}
return true;
}
if (node instanceof AST_Scope) {
var save_scope = scope;
scope = node;
descend();
scope = save_scope;
return true;
}
if (node.destructuring && destructuring_value) {
initializations.add(node.name, destructuring_value);
}
=======
return scan_ref_scoped(node, descend);
>>>>>>>
if (node.destructuring && destructuring_value) {
initializations.add(node.name, destructuring_value);
}
return scan_ref_scoped(node, descend);
<<<<<<<
var tt = new TreeTransformer(function(node) {
if (node instanceof AST_Definitions && tt.parent() instanceof AST_Export) return node;
=======
return self.transform(new TreeTransformer(function(node, descend) {
>>>>>>>
var tt = new TreeTransformer(function(node, descend) {
if (node instanceof AST_Definitions && tt.parent() instanceof AST_Export) return node; |
<<<<<<<
}
reassign_const_1: {
options = {
collapse_vars: true,
}
input: {
function f() {
const a = 1;
a = 2;
return a;
}
console.log(f());
}
expect: {
function f() {
const a = 1;
a = 2;
return a;
}
console.log(f());
}
expect_stdout: true
}
reassign_const_2: {
options = {
collapse_vars: true,
}
input: {
function f() {
const a = 1;
++a;
return a;
}
console.log(f());
}
expect: {
function f() {
const a = 1;
++a;
return a;
}
console.log(f());
}
expect_stdout: true
=======
}
issue_2187_1: {
options = {
collapse_vars: true,
unused: true,
}
input: {
var a = 1;
!function(foo) {
foo();
var a = 2;
console.log(a);
}(function() {
console.log(a);
});
}
expect: {
var a = 1;
!function(foo) {
foo();
var a = 2;
console.log(a);
}(function() {
console.log(a);
});
}
expect_stdout: [
"1",
"2",
]
}
issue_2187_2: {
options = {
collapse_vars: true,
unused: true,
}
input: {
var b = 1;
console.log(function(a) {
return a && ++b;
}(b--));
}
expect: {
var b = 1;
console.log(function(a) {
return b-- && ++b;
}());
}
expect_stdout: "1"
}
issue_2187_3: {
options = {
collapse_vars: true,
inline: true,
unused: true,
}
input: {
var b = 1;
console.log(function(a) {
return a && ++b;
}(b--));
}
expect: {
var b = 1;
console.log(b-- && ++b);
}
expect_stdout: "1"
>>>>>>>
}
reassign_const_1: {
options = {
collapse_vars: true,
}
input: {
function f() {
const a = 1;
a = 2;
return a;
}
console.log(f());
}
expect: {
function f() {
const a = 1;
a = 2;
return a;
}
console.log(f());
}
expect_stdout: true
}
reassign_const_2: {
options = {
collapse_vars: true,
}
input: {
function f() {
const a = 1;
++a;
return a;
}
console.log(f());
}
expect: {
function f() {
const a = 1;
++a;
return a;
}
console.log(f());
}
expect_stdout: true
}
issue_2187_1: {
options = {
collapse_vars: true,
unused: true,
}
input: {
var a = 1;
!function(foo) {
foo();
var a = 2;
console.log(a);
}(function() {
console.log(a);
});
}
expect: {
var a = 1;
!function(foo) {
foo();
var a = 2;
console.log(a);
}(function() {
console.log(a);
});
}
expect_stdout: [
"1",
"2",
]
}
issue_2187_2: {
options = {
collapse_vars: true,
unused: true,
}
input: {
var b = 1;
console.log(function(a) {
return a && ++b;
}(b--));
}
expect: {
var b = 1;
console.log(function(a) {
return b-- && ++b;
}());
}
expect_stdout: "1"
}
issue_2187_3: {
options = {
collapse_vars: true,
inline: true,
unused: true,
}
input: {
var b = 1;
console.log(function(a) {
return a && ++b;
}(b--));
}
expect: {
var b = 1;
console.log(b-- && ++b);
}
expect_stdout: "1" |
<<<<<<<
if (window) function g() {}
=======
if (window);
}
}
}
defun_else_if_return: {
options = {
hoist_funs: false,
if_return: true,
}
input: {
function e() {
function f() {}
if (window) function g() {}
else return;
function h() {}
}
}
expect: {
function e() {
function f() {}
if (window) function g() {}
function h() {}
>>>>>>>
if (window) function g() {}
}
}
}
defun_else_if_return: {
options = {
hoist_funs: false,
if_return: true,
}
input: {
function e() {
function f() {}
if (window) function g() {}
else return;
function h() {}
}
}
expect: {
function e() {
function f() {}
if (window) function g() {}
function h() {} |
<<<<<<<
}
issue_2136_1: {
options = {
inline: true,
unused: true,
}
input: {
!function(a, ...b) {
console.log(b);
}();
}
expect: {
!function(a, ...b) {
console.log(b);
}();
}
expect_stdout: "[]"
node_version: ">=6"
}
issue_2136_2: {
options = {
collapse_vars: true,
inline: true,
side_effects: true,
unused: true,
}
input: {
function f(x) {
console.log(x);
}
!function(a, ...b) {
f(b[0]);
}(1, 2, 3);
}
expect: {
function f(x) {
console.log(x);
}
f([2,3][0]);
}
expect_stdout: "2"
node_version: ">=6"
}
issue_2136_3: {
options = {
collapse_vars: true,
evaluate: true,
inline: true,
passes: 3,
reduce_vars: true,
side_effects: true,
toplevel: true,
unsafe: true,
unused: true,
}
input: {
function f(x) {
console.log(x);
}
!function(a, ...b) {
f(b[0]);
}(1, 2, 3);
}
expect: {
console.log(2);
}
expect_stdout: "2"
node_version: ">=6"
}
issue_2163: {
options = {
pure_funcs: [ "pure" ],
side_effects: true,
}
input: {
var c;
/*@__PURE__*/f(...a);
pure(b, ...c);
}
expect: {
var c;
a;
b;
}
=======
}
issue_2226_1: {
options = {
side_effects: true,
unused: true,
}
input: {
function f1() {
var a = b;
a += c;
}
function f2(a) {
a <<= b;
}
function f3(a) {
--a;
}
function f4() {
var a = b;
return a *= c;
}
function f5(a) {
x(a /= b);
}
}
expect: {
function f1() {
b;
c;
}
function f2(a) {
b;
}
function f3(a) {
0;
}
function f4() {
var a = b;
return a *= c;
}
function f5(a) {
x(a /= b);
}
}
}
issue_2226_2: {
options = {
cascade: true,
sequences: true,
side_effects: true,
unused: true,
}
input: {
console.log(function(a, b) {
a += b;
return a;
}(1, 2));
}
expect: {
console.log(function(a, b) {
return a += b;
}(1, 2));
}
expect_stdout: "3"
}
issue_2226_3: {
options = {
collapse_vars: true,
side_effects: true,
unused: true,
}
input: {
console.log(function(a, b) {
a += b;
return a;
}(1, 2));
}
expect: {
console.log(function(a, b) {
return a += 2;
}(1));
}
expect_stdout: "3"
>>>>>>>
}
issue_2136_1: {
options = {
inline: true,
unused: true,
}
input: {
!function(a, ...b) {
console.log(b);
}();
}
expect: {
!function(a, ...b) {
console.log(b);
}();
}
expect_stdout: "[]"
node_version: ">=6"
}
issue_2136_2: {
options = {
collapse_vars: true,
inline: true,
side_effects: true,
unused: true,
}
input: {
function f(x) {
console.log(x);
}
!function(a, ...b) {
f(b[0]);
}(1, 2, 3);
}
expect: {
function f(x) {
console.log(x);
}
f([2,3][0]);
}
expect_stdout: "2"
node_version: ">=6"
}
issue_2136_3: {
options = {
collapse_vars: true,
evaluate: true,
inline: true,
passes: 3,
reduce_vars: true,
side_effects: true,
toplevel: true,
unsafe: true,
unused: true,
}
input: {
function f(x) {
console.log(x);
}
!function(a, ...b) {
f(b[0]);
}(1, 2, 3);
}
expect: {
console.log(2);
}
expect_stdout: "2"
node_version: ">=6"
}
issue_2163: {
options = {
pure_funcs: [ "pure" ],
side_effects: true,
}
input: {
var c;
/*@__PURE__*/f(...a);
pure(b, ...c);
}
expect: {
var c;
a;
b;
}
}
issue_2226_1: {
options = {
side_effects: true,
unused: true,
}
input: {
function f1() {
var a = b;
a += c;
}
function f2(a) {
a <<= b;
}
function f3(a) {
--a;
}
function f4() {
var a = b;
return a *= c;
}
function f5(a) {
x(a /= b);
}
}
expect: {
function f1() {
b;
c;
}
function f2(a) {
b;
}
function f3(a) {
0;
}
function f4() {
var a = b;
return a *= c;
}
function f5(a) {
x(a /= b);
}
}
}
issue_2226_2: {
options = {
cascade: true,
sequences: true,
side_effects: true,
unused: true,
}
input: {
console.log(function(a, b) {
a += b;
return a;
}(1, 2));
}
expect: {
console.log(function(a, b) {
return a += b;
}(1, 2));
}
expect_stdout: "3"
}
issue_2226_3: {
options = {
collapse_vars: true,
side_effects: true,
unused: true,
}
input: {
console.log(function(a, b) {
a += b;
return a;
}(1, 2));
}
expect: {
console.log(function(a, b) {
return a += 2;
}(1));
}
expect_stdout: "3" |
<<<<<<<
mangle_props = {
builtins: true,
keep_quoted: true
=======
mangle = {
properties: {
keep_quoted: true,
},
>>>>>>>
mangle = {
properties: {
builtins: true,
keep_quoted: true,
},
<<<<<<<
mangle_props = {
builtins: true,
keep_quoted: true,
debug: "XYZ",
reserved: []
=======
mangle = {
properties: {
debug: "XYZ",
keep_quoted: true,
reserved: [],
},
>>>>>>>
mangle = {
properties: {
builtins: true,
debug: "XYZ",
keep_quoted: true,
reserved: [],
},
<<<<<<<
}
issue_2208_6: {
options = {
inline: true,
side_effects: true,
unsafe: true,
}
input: {
console.log({
p: () => 42
}.p());
}
expect: {
console.log(42);
}
expect_stdout: "42"
node_version: ">=4"
}
issue_2208_7: {
options = {
inline: true,
side_effects: true,
unsafe: true,
}
input: {
console.log({
p() {
return 42;
}
}.p());
}
expect: {
console.log(42);
}
expect_stdout: "42"
node_version: ">=4"
}
issue_2208_8: {
options = {
inline: true,
side_effects: true,
unsafe: true,
}
input: {
console.log({
*p() {
return x();
}
}.p());
console.log({
async p() {
return await x();
}
}.p());
}
expect: {
console.log({
*p() {
return x();
}
}.p());
console.log(async function() {
return await x();
}());
}
}
issue_2208_9: {
options = {
inline: true,
side_effects: true,
unsafe: true,
}
input: {
a = 42;
console.log({
p: () => {
return function() {
return this.a;
}();
}
}.p());
}
expect: {
a = 42;
console.log(function() {
return this.a;
}());
}
expect_stdout: "42"
node_version: ">=4"
}
methods_keep_quoted_true: {
options = {
arrows: true,
ecma: 6,
}
mangle_props = {
keep_quoted: true,
};
input: {
class C { "Quoted"(){} Unquoted(){} }
f1({ "Quoted"(){}, Unquoted(){}, "Prop": 3 });
f2({ "Quoted": function(){} });
f3({ "Quoted": ()=>{} });
}
expect_exact: "class C{Quoted(){}o(){}}f1({Quoted(){},o(){},Prop:3});f2({Quoted(){}});f3({Quoted(){}});"
}
methods_keep_quoted_false: {
options = {
arrows: true,
ecma: 6,
}
mangle_props = {
keep_quoted: false,
};
input: {
class C { "Quoted"(){} Unquoted(){} }
f1({ "Quoted"(){}, Unquoted(){}, "Prop": 3 });
f2({ "Quoted": function(){} });
f3({ "Quoted": ()=>{} });
}
expect_exact: "class C{o(){}d(){}}f1({o(){},d(){},e:3});f2({o(){}});f3({o(){}});"
=======
}
issue_2256: {
options = {
side_effects: true,
}
mangle = {
properties: {
keep_quoted: true,
},
}
input: {
({ "keep": 1 });
g.keep = g.change;
}
expect: {
g.keep = g.g;
}
>>>>>>>
}
issue_2208_6: {
options = {
inline: true,
side_effects: true,
unsafe: true,
}
input: {
console.log({
p: () => 42
}.p());
}
expect: {
console.log(42);
}
expect_stdout: "42"
node_version: ">=4"
}
issue_2208_7: {
options = {
inline: true,
side_effects: true,
unsafe: true,
}
input: {
console.log({
p() {
return 42;
}
}.p());
}
expect: {
console.log(42);
}
expect_stdout: "42"
node_version: ">=4"
}
issue_2208_8: {
options = {
inline: true,
side_effects: true,
unsafe: true,
}
input: {
console.log({
*p() {
return x();
}
}.p());
console.log({
async p() {
return await x();
}
}.p());
}
expect: {
console.log({
*p() {
return x();
}
}.p());
console.log(async function() {
return await x();
}());
}
}
issue_2208_9: {
options = {
inline: true,
side_effects: true,
unsafe: true,
}
input: {
a = 42;
console.log({
p: () => {
return function() {
return this.a;
}();
}
}.p());
}
expect: {
a = 42;
console.log(function() {
return this.a;
}());
}
expect_stdout: "42"
node_version: ">=4"
}
methods_keep_quoted_true: {
options = {
arrows: true,
ecma: 6,
}
mangle_props = {
keep_quoted: true,
};
input: {
class C { "Quoted"(){} Unquoted(){} }
f1({ "Quoted"(){}, Unquoted(){}, "Prop": 3 });
f2({ "Quoted": function(){} });
f3({ "Quoted": ()=>{} });
}
expect_exact: "class C{Quoted(){}o(){}}f1({Quoted(){},o(){},Prop:3});f2({Quoted(){}});f3({Quoted(){}});"
}
methods_keep_quoted_false: {
options = {
arrows: true,
ecma: 6,
}
mangle_props = {
keep_quoted: false,
};
input: {
class C { "Quoted"(){} Unquoted(){} }
f1({ "Quoted"(){}, Unquoted(){}, "Prop": 3 });
f2({ "Quoted": function(){} });
f3({ "Quoted": ()=>{} });
}
expect_exact: "class C{o(){}d(){}}f1({o(){},d(){},e:3});f2({o(){}});f3({o(){}});"
}
issue_2256: {
options = {
side_effects: true,
}
mangle = {
properties: {
keep_quoted: true,
},
}
input: {
({ "keep": 1 });
g.keep = g.change;
}
expect: {
g.keep = g.g;
} |
<<<<<<<
}
issue_2321: {
options = {
ecma: 6,
unsafe_methods: false,
}
input: {
var f = {
foo: function(){ console.log("foo") },
bar() { console.log("bar") }
};
var foo = new f.foo();
var bar = f.bar();
}
expect: {
var f = {
foo: function() {
console.log("foo");
},
bar() {
console.log("bar");
}
};
var foo = new f.foo();
var bar = f.bar();
}
expect_stdout: [
"foo",
"bar",
]
node_version: ">=6"
}
unsafe_methods_regex: {
options = {
ecma: 6,
unsafe_methods: /^[A-Z1]/,
}
input: {
var f = {
123: function(){ console.log("123") },
foo: function(){ console.log("foo") },
bar() { console.log("bar") },
Baz: function(){ console.log("baz") },
BOO: function(){ console.log("boo") },
null: function(){ console.log("null") },
undefined: function(){ console.log("undefined") },
};
f[123]();
new f.foo();
f.bar();
f.Baz();
f.BOO();
new f.null();
new f.undefined();
}
expect: {
var f = {
123() { console.log("123") },
foo: function(){ console.log("foo") },
bar() { console.log("bar"); },
Baz() { console.log("baz") },
BOO() { console.log("boo") },
null: function(){ console.log("null") },
undefined: function(){ console.log("undefined") },
};
f[123]();
new f.foo();
f.bar();
f.Baz();
f.BOO();
new f.null();
new f.undefined();
}
expect_stdout: [
"123",
"foo",
"bar",
"baz",
"boo",
"null",
"undefined",
]
node_version: ">=6"
=======
}
lhs_prop_1: {
options = {
evaluate: true,
properties: true,
}
input: {
console.log(++{
a: 1
}.a);
}
expect: {
console.log(++{
a: 1
}.a);
}
expect_stdout: "2"
}
lhs_prop_2: {
options = {
evaluate: true,
inline: true,
properties: true,
reduce_vars: true,
side_effects: true,
unused: true,
}
input: {
[1][0] = 42;
(function(a) {
a.b = "g";
})("abc");
(function(a) {
a[2] = "g";
})("def");
(function(a) {
a[""] = "g";
})("ghi");
}
expect: {
[1][0] = 42;
"abc".b = "g";
"def"[2] = "g";
"ghi"[""] = "g";
}
}
literal_duplicate_key_side_effects: {
options = {
properties: true,
side_effects: true,
}
input: {
console.log({
a: "FAIL",
a: console.log ? "PASS" : "FAIL"
}.a);
}
expect: {
console.log(console.log ? "PASS" : "FAIL");
}
expect_stdout: "PASS"
}
prop_side_effects_1: {
options = {
evaluate: true,
inline: true,
properties: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
var C = 1;
console.log(C);
var obj = {
bar: function() {
return C + C;
}
};
console.log(obj.bar());
}
expect: {
console.log(1);
var obj = {
bar: function() {
return 2;
}
};
console.log(obj.bar());
}
expect_stdout: [
"1",
"2",
]
}
prop_side_effects_2: {
options = {
evaluate: true,
inline: true,
passes: 2,
properties: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
var C = 1;
console.log(C);
var obj = {
"": function() {
return C + C;
}
};
console.log(obj[""]());
}
expect: {
console.log(1);
console.log(2);
}
expect_stdout: [
"1",
"2",
]
}
accessor_1: {
options = {
properties: true,
}
input: {
console.log({
a: "FAIL",
get a() {
return "PASS";
}
}.a);
}
expect: {
console.log({
a: "FAIL",
get a() {
return "PASS";
}
}.a);
}
expect_stdout: "PASS"
node_version: ">=4"
}
accessor_2: {
options = {
properties: true,
}
input: {
console.log({
get a() {
return "PASS";
},
set a(v) {},
a: "FAIL"
}.a);
}
expect: {
console.log({
get a() {
return "PASS";
},
set a(v) {},
a: "FAIL"
}.a);
}
expect_stdout: true
}
array_hole: {
options = {
properties: true,
side_effects: true,
}
input: {
console.log(
[ 1, 2, , 3][1],
[ 1, 2, , 3][2],
[ 1, 2, , 3][3]
);
}
expect: {
console.log(2, void 0, 3);
}
expect_stdout: "2 undefined 3"
>>>>>>>
}
issue_2321: {
options = {
ecma: 6,
unsafe_methods: false,
}
input: {
var f = {
foo: function(){ console.log("foo") },
bar() { console.log("bar") }
};
var foo = new f.foo();
var bar = f.bar();
}
expect: {
var f = {
foo: function() {
console.log("foo");
},
bar() {
console.log("bar");
}
};
var foo = new f.foo();
var bar = f.bar();
}
expect_stdout: [
"foo",
"bar",
]
node_version: ">=6"
}
unsafe_methods_regex: {
options = {
ecma: 6,
unsafe_methods: /^[A-Z1]/,
}
input: {
var f = {
123: function(){ console.log("123") },
foo: function(){ console.log("foo") },
bar() { console.log("bar") },
Baz: function(){ console.log("baz") },
BOO: function(){ console.log("boo") },
null: function(){ console.log("null") },
undefined: function(){ console.log("undefined") },
};
f[123]();
new f.foo();
f.bar();
f.Baz();
f.BOO();
new f.null();
new f.undefined();
}
expect: {
var f = {
123() { console.log("123") },
foo: function(){ console.log("foo") },
bar() { console.log("bar"); },
Baz() { console.log("baz") },
BOO() { console.log("boo") },
null: function(){ console.log("null") },
undefined: function(){ console.log("undefined") },
};
f[123]();
new f.foo();
f.bar();
f.Baz();
f.BOO();
new f.null();
new f.undefined();
}
expect_stdout: [
"123",
"foo",
"bar",
"baz",
"boo",
"null",
"undefined",
]
node_version: ">=6"
}
lhs_prop_1: {
options = {
evaluate: true,
properties: true,
}
input: {
console.log(++{
a: 1
}.a);
}
expect: {
console.log(++{
a: 1
}.a);
}
expect_stdout: "2"
}
lhs_prop_2: {
options = {
evaluate: true,
inline: true,
properties: true,
reduce_vars: true,
side_effects: true,
unused: true,
}
input: {
[1][0] = 42;
(function(a) {
a.b = "g";
})("abc");
(function(a) {
a[2] = "g";
})("def");
(function(a) {
a[""] = "g";
})("ghi");
}
expect: {
[1][0] = 42;
"abc".b = "g";
"def"[2] = "g";
"ghi"[""] = "g";
}
}
literal_duplicate_key_side_effects: {
options = {
properties: true,
side_effects: true,
}
input: {
console.log({
a: "FAIL",
a: console.log ? "PASS" : "FAIL"
}.a);
}
expect: {
console.log(console.log ? "PASS" : "FAIL");
}
expect_stdout: "PASS"
}
prop_side_effects_1: {
options = {
evaluate: true,
inline: true,
properties: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
var C = 1;
console.log(C);
var obj = {
bar: function() {
return C + C;
}
};
console.log(obj.bar());
}
expect: {
console.log(1);
var obj = {
bar: function() {
return 2;
}
};
console.log(obj.bar());
}
expect_stdout: [
"1",
"2",
]
}
prop_side_effects_2: {
options = {
evaluate: true,
inline: true,
passes: 2,
properties: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
var C = 1;
console.log(C);
var obj = {
"": function() {
return C + C;
}
};
console.log(obj[""]());
}
expect: {
console.log(1);
console.log(2);
}
expect_stdout: [
"1",
"2",
]
}
accessor_1: {
options = {
properties: true,
}
input: {
console.log({
a: "FAIL",
get a() {
return "PASS";
}
}.a);
}
expect: {
console.log({
a: "FAIL",
get a() {
return "PASS";
}
}.a);
}
expect_stdout: "PASS"
node_version: ">=4"
}
accessor_2: {
options = {
properties: true,
}
input: {
console.log({
get a() {
return "PASS";
},
set a(v) {},
a: "FAIL"
}.a);
}
expect: {
console.log({
get a() {
return "PASS";
},
set a(v) {},
a: "FAIL"
}.a);
}
expect_stdout: true
}
array_hole: {
options = {
properties: true,
side_effects: true,
}
input: {
console.log(
[ 1, 2, , 3][1],
[ 1, 2, , 3][2],
[ 1, 2, , 3][3]
);
}
expect: {
console.log(2, void 0, 3);
}
expect_stdout: "2 undefined 3" |
<<<<<<<
var scope = compressor.find_parent(AST_Scope).get_defun_scope();
=======
>>>>>>>
<<<<<<<
=======
if (def.name.fixed_value() === def.value) {
fixed_ids[node_def.id] = def;
}
>>>>>>>
<<<<<<<
if (drop_block && sym.global) return tail.push(def);
if (!(drop_vars || drop_block) || sym.id in in_use_ids) {
=======
if (!drop_vars || sym.id in in_use_ids) {
if (def.value && sym.id in fixed_ids && fixed_ids[sym.id] !== def) {
def.value = def.value.drop_side_effect_free(compressor);
}
>>>>>>>
if (drop_block && sym.global) return tail.push(def);
if (!(drop_vars || drop_block) || sym.id in in_use_ids) {
if (def.value && sym.id in fixed_ids && fixed_ids[sym.id] !== def) {
def.value = def.value.drop_side_effect_free(compressor);
} |
<<<<<<<
screw_ie8 : true,
keep_fnames : false,
keep_classnames : false
=======
>>>>>>> |
<<<<<<<
}
issue_2265_1: {
options = {
pure_getters: "strict",
side_effects: true,
}
input: {
({ ...{} }).p;
({ ...g }).p;
}
expect: {
({ ...g }).p;
}
}
issue_2265_2: {
options = {
pure_getters: "strict",
reduce_vars: true,
side_effects: true,
toplevel: true,
}
input: {
var a = {
get b() {
throw 0;
}
};
({...a}).b;
}
expect: {
var a = {
get b() {
throw 0;
}
};
({...a}).b;
}
}
issue_2265_3: {
options = {
pure_getters: "strict",
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
var a = {
set b() {
throw 0;
}
};
({...a}).b;
}
expect: {}
}
issue_2265_4: {
options = {
pure_getters: "strict",
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
var a = { b: 1 };
({...a}).b;
}
expect: {}
=======
}
issue_2313_1: {
options = {
cascade: true,
conditionals: true,
pure_getters: "strict",
sequences: true,
side_effects: true,
}
input: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
if (x().y().z) {
console.log(3);
}
}
expect: {
function x() {
return console.log(1), {
y: function() {
return console.log(2), {
z: 0
};
}
};
}
x().y().z++,
x().y().z && console.log(3);
}
expect_stdout: [
"1",
"2",
"1",
"2",
]
}
issue_2313_2: {
options = {
cascade: true,
conditionals: true,
pure_getters: true,
sequences: true,
side_effects: true,
}
input: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
if (x().y().z) {
console.log(3);
}
}
expect: {
function x() {
return console.log(1), {
y: function() {
return console.log(2), {
z: 0
};
}
};
}
x().y().z++,
x().y().z && console.log(3);
}
expect_stdout: [
"1",
"2",
"1",
"2",
]
}
issue_2313_3: {
options = {
collapse_vars: true,
conditionals: true,
pure_getters: "strict",
}
input: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
if (x().y().z) {
console.log(3);
}
}
expect: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
x().y().z && console.log(3);
}
expect_stdout: [
"1",
"2",
"1",
"2",
]
}
issue_2313_4: {
options = {
collapse_vars: true,
conditionals: true,
pure_getters: true,
}
input: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
if (x().y().z) {
console.log(3);
}
}
expect: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
x().y().z && console.log(3);
}
expect_stdout: [
"1",
"2",
"1",
"2",
]
}
issue_2313_5: {
options = {
pure_getters: "strict",
side_effects: true,
}
input: {
x().y++;
x().y;
}
expect: {
x().y++;
x().y;
}
}
issue_2313_6: {
options = {
pure_getters: true,
side_effects: true,
}
input: {
x().y++;
x().y;
}
expect: {
x().y++;
x();
}
>>>>>>>
}
issue_2265_1: {
options = {
pure_getters: "strict",
side_effects: true,
}
input: {
({ ...{} }).p;
({ ...g }).p;
}
expect: {
({ ...g }).p;
}
}
issue_2265_2: {
options = {
pure_getters: "strict",
reduce_vars: true,
side_effects: true,
toplevel: true,
}
input: {
var a = {
get b() {
throw 0;
}
};
({...a}).b;
}
expect: {
var a = {
get b() {
throw 0;
}
};
({...a}).b;
}
}
issue_2265_3: {
options = {
pure_getters: "strict",
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
var a = {
set b() {
throw 0;
}
};
({...a}).b;
}
expect: {}
}
issue_2265_4: {
options = {
pure_getters: "strict",
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
var a = { b: 1 };
({...a}).b;
}
expect: {}
}
issue_2313_1: {
options = {
cascade: true,
conditionals: true,
pure_getters: "strict",
sequences: true,
side_effects: true,
}
input: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
if (x().y().z) {
console.log(3);
}
}
expect: {
function x() {
return console.log(1), {
y: function() {
return console.log(2), {
z: 0
};
}
};
}
x().y().z++,
x().y().z && console.log(3);
}
expect_stdout: [
"1",
"2",
"1",
"2",
]
}
issue_2313_2: {
options = {
cascade: true,
conditionals: true,
pure_getters: true,
sequences: true,
side_effects: true,
}
input: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
if (x().y().z) {
console.log(3);
}
}
expect: {
function x() {
return console.log(1), {
y: function() {
return console.log(2), {
z: 0
};
}
};
}
x().y().z++,
x().y().z && console.log(3);
}
expect_stdout: [
"1",
"2",
"1",
"2",
]
}
issue_2313_3: {
options = {
collapse_vars: true,
conditionals: true,
pure_getters: "strict",
}
input: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
if (x().y().z) {
console.log(3);
}
}
expect: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
x().y().z && console.log(3);
}
expect_stdout: [
"1",
"2",
"1",
"2",
]
}
issue_2313_4: {
options = {
collapse_vars: true,
conditionals: true,
pure_getters: true,
}
input: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
if (x().y().z) {
console.log(3);
}
}
expect: {
function x() {
console.log(1);
return {
y: function() {
console.log(2);
return {
z: 0
};
}
};
}
x().y().z++;
x().y().z && console.log(3);
}
expect_stdout: [
"1",
"2",
"1",
"2",
]
}
issue_2313_5: {
options = {
pure_getters: "strict",
side_effects: true,
}
input: {
x().y++;
x().y;
}
expect: {
x().y++;
x().y;
}
}
issue_2313_6: {
options = {
pure_getters: true,
side_effects: true,
}
input: {
x().y++;
x().y;
}
expect: {
x().y++;
x();
} |
<<<<<<<
if (node instanceof AST_SymbolFunarg) {
node.object_destructuring_arg = !!in_destructuring;
defun.def_variable(node);
}
=======
if (node instanceof AST_Label) {
node.thedef = node;
node.references = [];
}
>>>>>>>
if (node instanceof AST_SymbolFunarg) {
node.object_destructuring_arg = !!in_destructuring;
defun.def_variable(node);
}
if (node instanceof AST_Label) {
node.thedef = node;
node.references = [];
}
<<<<<<<
if (node instanceof AST_Class) {
var prev_cls = cls;
cls = node;
descend();
cls = prev_cls;
return true;
}
=======
if (node instanceof AST_LoopControl && node.label) {
node.label.thedef.references.push(node);
return true;
}
>>>>>>>
if (node instanceof AST_Class) {
var prev_cls = cls;
cls = node;
descend();
cls = prev_cls;
return true;
}
if (node instanceof AST_LoopControl && node.label) {
node.label.thedef.references.push(node);
return true;
} |
<<<<<<<
var AST_Arrow = DEFNODE("Arrow", null, {
$documentation: "An ES6 Arrow function ((a) => b)"
}, AST_Lambda);
var AST_Defun = DEFNODE("Defun", null, {
=======
var AST_Defun = DEFNODE("Defun", "inlined", {
>>>>>>>
var AST_Arrow = DEFNODE("Arrow", "inlined", {
$documentation: "An ES6 Arrow function ((a) => b)"
}, AST_Lambda);
var AST_Defun = DEFNODE("Defun", "inlined", { |
<<<<<<<
init =
is("keyword", "var") ? (next(), var_(true)) :
is("keyword", "let") ? (next(), let_(true)) :
is("keyword", "const") ? (next(), const_(true)) :
expression(true, true);
var is_in = is("operator", "in");
var is_of = is("name", "of");
if (is_in || is_of) {
if ((init instanceof AST_Definitions) &&
init.definitions.length > 1)
croak("Only one variable declaration allowed in for..in loop");
=======
init = is("keyword", "var")
? (next(), var_(true))
: expression(true, true);
if (is("operator", "in")) {
if (init instanceof AST_Var && init.definitions.length > 1)
croak("SyntaxError: Only one variable declaration allowed in for..in loop");
>>>>>>>
init =
is("keyword", "var") ? (next(), var_(true)) :
is("keyword", "let") ? (next(), let_(true)) :
is("keyword", "const") ? (next(), const_(true)) :
expression(true, true);
var is_in = is("operator", "in");
var is_of = is("name", "of");
if (is_in || is_of) {
if ((init instanceof AST_Definitions) &&
init.definitions.length > 1)
croak("SyntaxError: Only one variable declaration allowed in for..in loop"); |
<<<<<<<
issue_2090_1: {
options = {
evaluate: true,
reduce_vars: true,
}
input: {
console.log(function() {
var x = 1;
[].forEach(() => x = 2);
return x;
}());
}
expect: {
console.log(function() {
var x = 1;
[].forEach(() => x = 2);
return x;
}());
}
expect_stdout: "1"
node_version: ">=4"
}
issue_2090_2: {
options = {
evaluate: true,
reduce_vars: true,
}
input: {
console.log(function() {
var x = 1;
[].forEach(() => {
x = 2;
});
return x;
}());
}
expect: {
console.log(function() {
var x = 1;
[].forEach(() => {
x = 2;
});
return x;
}());
}
expect_stdout: "1"
node_version: ">=4"
}
=======
accessor_2: {
options = {
collapse_vars: true,
evaluate: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var A = 1;
var B = {
get c() {
console.log(A);
}
};
B.c;
}
expect: {
({
get c() {
console.log(1);
}
}).c;
}
expect_stdout: "1"
}
>>>>>>>
accessor_2: {
options = {
collapse_vars: true,
evaluate: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var A = 1;
var B = {
get c() {
console.log(A);
}
};
B.c;
}
expect: {
({
get c() {
console.log(1);
}
}).c;
}
expect_stdout: "1"
}
issue_2090_1: {
options = {
evaluate: true,
reduce_vars: true,
}
input: {
console.log(function() {
var x = 1;
[].forEach(() => x = 2);
return x;
}());
}
expect: {
console.log(function() {
var x = 1;
[].forEach(() => x = 2);
return x;
}());
}
expect_stdout: "1"
node_version: ">=4"
}
issue_2090_2: {
options = {
evaluate: true,
reduce_vars: true,
}
input: {
console.log(function() {
var x = 1;
[].forEach(() => {
x = 2;
});
return x;
}());
}
expect: {
console.log(function() {
var x = 1;
[].forEach(() => {
x = 2;
});
return x;
}());
}
expect_stdout: "1"
node_version: ">=4"
} |
<<<<<<<
if (!drop_vars && sym.global) return true;
if (sym.orig[0] instanceof AST_SymbolCatch
&& sym.scope.parent_scope.find_variable(def.name).orig[0] === def.name) {
=======
if (sym.orig[0] instanceof AST_SymbolCatch) {
>>>>>>>
if (!drop_vars && sym.global) return true;
if (sym.orig[0] instanceof AST_SymbolCatch) { |
<<<<<<<
var value = node.fixed_value();
if (value && ref_once(d) && !compressor.exposed(d)) {
if (value instanceof AST_Lambda) {
d.single_use = d.scope === node.scope
&& !(d.orig[0] instanceof AST_SymbolFunarg)
|| value.is_constant_expression(node.scope);
} else {
d.single_use = d.scope === node.scope
&& loop_ids[d.id] === in_loop
&& value.is_constant_expression();
}
=======
value = node.fixed_value();
if (value && ref_once(d)) {
d.single_use = value instanceof AST_Lambda
|| d.scope === node.scope && value.is_constant_expression();
>>>>>>>
value = node.fixed_value();
if (value && ref_once(d) && !compressor.exposed(d)) {
d.single_use = value instanceof AST_Lambda
|| d.scope === node.scope && value.is_constant_expression();
<<<<<<<
if (value instanceof AST_Constant
|| value instanceof AST_Function
|| value instanceof AST_ClassExpression) {
return;
}
=======
if (value instanceof AST_Constant) return;
if (level > 0 && value instanceof AST_Function) return;
>>>>>>>
if (value instanceof AST_Constant || value instanceof AST_ClassExpression) return;
if (level > 0 && value instanceof AST_Function) return;
<<<<<<<
OPT(AST_SymbolExport, function(self, compressor){
return self;
});
=======
function recursive_ref(compressor, def) {
var node;
for (var i = 0; node = compressor.parent(i); i++) {
if (node instanceof AST_Lambda) {
var name = node.name;
if (name && name.definition() === def) break;
}
}
return node;
}
>>>>>>>
OPT(AST_SymbolExport, function(self, compressor){
return self;
});
function recursive_ref(compressor, def) {
var node;
for (var i = 0; node = compressor.parent(i); i++) {
if (node instanceof AST_Lambda) {
var name = node.name;
if (name && name.definition() === def) break;
}
}
return node;
} |
<<<<<<<
var assign_as_unused = !/keep_assign/.test(compressor.option("unused"));
=======
if (!drop_funcs && !drop_vars) return;
var assign_as_unused = /keep_assign/.test(compressor.option("unused")) ? return_false : function(node) {
if (node instanceof AST_Assign && (node.write_only || node.operator == "=")) {
return node.left;
}
if (node instanceof AST_Unary && node.write_only) return node.expression;
};
>>>>>>>
var assign_as_unused = /keep_assign/.test(compressor.option("unused")) ? return_false : function(node) {
if (node instanceof AST_Assign && (node.write_only || node.operator == "=")) {
return node.left;
}
if (node instanceof AST_Unary && node.write_only) return node.expression;
};
<<<<<<<
if (assign_as_unused
&& node instanceof AST_Assign
&& node.operator == "="
&& node.left instanceof AST_SymbolRef
&& !is_ref_of(node.left, AST_SymbolBlockDeclaration)
&& scope === self) {
node.right.walk(tw);
=======
if (assign_as_unused(node) instanceof AST_SymbolRef && scope === self) {
if (node instanceof AST_Assign) node.right.walk(tw);
>>>>>>>
if (assign_as_unused(node) instanceof AST_SymbolRef && scope === self
&& !is_ref_of(node.left, AST_SymbolBlockDeclaration)) {
if (node instanceof AST_Assign) node.right.walk(tw);
<<<<<<<
if (assign_as_unused
&& node instanceof AST_Assign
&& node.operator == "="
&& node.left instanceof AST_SymbolRef) {
var def = node.left.definition();
if (!(def.id in in_use_ids)
&& (drop_vars || !def.global)
=======
if (drop_vars) {
var def = assign_as_unused(node);
if (def instanceof AST_SymbolRef
&& !((def = def.definition()).id in in_use_ids)
>>>>>>>
if (drop_vars) {
var def = assign_as_unused(node);
if (def instanceof AST_SymbolRef
&& !((def = def.definition()).id in in_use_ids)
&& (drop_vars || !def.global)
<<<<<<<
return maintain_this_binding(parent, node, node.right.transform(tt));
=======
if (node instanceof AST_Assign) {
return maintain_this_binding(tt.parent(), node, node.right.transform(tt));
}
return make_node(AST_Number, node, {
value: 0
});
>>>>>>>
if (node instanceof AST_Assign) {
return maintain_this_binding(parent, node, node.right.transform(tt));
}
return make_node(AST_Number, node, {
value: 0
});
<<<<<<<
var key = values[i].key;
if ((key instanceof AST_SymbolMethod ? key.name : key) === prop) {
=======
if (values[i].key === self.property) {
>>>>>>>
var key = values[i].key;
if ((key instanceof AST_SymbolMethod ? key.name : key) === self.property) { |
<<<<<<<
componentWillReceiveProps(nextProps) {
const {
autoDrawerUp
} = this.props;
const autoDrawerUpSuccess = (autoDrawerUp !== nextProps.autoDrawerUp) && (nextProps.autoDrawerUp === 1);
if (autoDrawerUpSuccess) {
setTimeout(() => {
this.moveFinishedUpper();
}, 1000);
}
}
=======
open() {
this.startAnimation(-100, 500, this.state.initialPositon, null, this.state.finalPosition);
this.props.onRelease && this.props.onRelease(true); // only add this line if you need to detect if the drawer is up or not
}
close() {
this.startAnimation(-90, 100, this.state.finalPosition, null, this.state.initialPositon);
this.props.onRelease && this.props.onRelease(true); // only add this line if you need to detect if the drawer is up or not
}
>>>>>>>
componentWillReceiveProps(nextProps) {
const {
autoDrawerUp
} = this.props;
const autoDrawerUpSuccess = (autoDrawerUp !== nextProps.autoDrawerUp) && (nextProps.autoDrawerUp === 1);
if (autoDrawerUpSuccess) {
setTimeout(() => {
this.moveFinishedUpper();
}, 1000);
}
}
open() {
this.startAnimation(-100, 500, this.state.initialPositon, null, this.state.finalPosition);
this.props.onRelease && this.props.onRelease(true); // only add this line if you need to detect if the drawer is up or not
}
close() {
this.startAnimation(-90, 100, this.state.finalPosition, null, this.state.initialPositon);
this.props.onRelease && this.props.onRelease(true); // only add this line if you need to detect if the drawer is up or not
} |
<<<<<<<
import JobInfoDialog from './common/dialog/job_info_dialog';
import BatchPriorityDialog from './/common/dialog/batch_priority_dialog';
import ImportResultDialog from './common/dialog/import_result_dialog';
=======
import MyLine from './common/charts/line';
>>>>>>>
import MyLine from './common/charts/line';
import JobInfoDialog from './common/dialog/job_info_dialog';
import BatchPriorityDialog from './/common/dialog/batch_priority_dialog';
import ImportResultDialog from './common/dialog/import_result_dialog';
<<<<<<<
Vue.component('add-config-dialog', AddConfigDialog);
Vue.component('job-info-dialog', JobInfoDialog);
Vue.component('batch-priority-dialog', BatchPriorityDialog);
Vue.component('import-result-dialog', ImportResultDialog);
=======
Vue.component('add-config-dialog', AddConfigDialog);
Vue.component('MyLine', MyLine);
>>>>>>>
Vue.component('add-config-dialog', AddConfigDialog);
Vue.component('MyLine', MyLine);
Vue.component('job-info-dialog', JobInfoDialog);
Vue.component('batch-priority-dialog', BatchPriorityDialog);
Vue.component('import-result-dialog', ImportResultDialog); |
<<<<<<<
{ pattern: 'dist/client/dev/**/*.js', included: false, watched: true },
{ pattern: 'dist/client/dev/**/*.html', included: false, watched: true, served: true },
{ pattern: 'dist/client/dev/**/*.css', included: false, watched: true, served: true },
=======
'test-config.js',
{ pattern: 'dist/dev/system-config.js', watched: true, included: true },
{ pattern: 'dist/dev/**/*.js', included: false, watched: true },
{ pattern: 'dist/dev/**/*.html', included: false, watched: true, served: true },
{ pattern: 'dist/dev/**/*.css', included: false, watched: true, served: true },
>>>>>>>
'test-config.js',
{ pattern: 'dist/client/dev/system-config.js', watched: true, included: true },
{ pattern: 'dist/client/dev/**/*.js', included: false, watched: true },
{ pattern: 'dist/client/dev/**/*.html', included: false, watched: true, served: true },
{ pattern: 'dist/client/dev/**/*.css', included: false, watched: true, served: true },
<<<<<<<
'test-config.js',
'dist/client/dev/system-config.js',
=======
>>>>>>> |
<<<<<<<
import bodymovin2Avd from 'bodymovin-to-avd'
=======
import {versionFetched} from '../redux/actions/generalActions'
>>>>>>>
import {versionFetched} from '../redux/actions/generalActions'
import bodymovin2Avd from 'bodymovin-to-avd'
<<<<<<<
function saveAVD(data) {
bodymovin2Avd(data).then(function(avdData){
console.log('avdData:', avdData);
var eScript = "bm_dataManager.saveAVDData('" + avdData + "')";
csInterface.evalScript(eScript);
})
}
=======
function getVersionFromExtension() {
let prom = new Promise(function(resolve, reject){
resolve()
})
var eScript = 'bm_renderManager.getVersion()';
csInterface.evalScript(eScript);
return prom
}
>>>>>>>
function saveAVD(data) {
bodymovin2Avd(data).then(function(avdData){
console.log('avdData:', avdData);
var eScript = "bm_dataManager.saveAVDData('" + avdData + "')";
csInterface.evalScript(eScript);
})
}
function getVersionFromExtension() {
let prom = new Promise(function(resolve, reject){
resolve()
})
var eScript = 'bm_renderManager.getVersion()';
csInterface.evalScript(eScript);
return prom
}
<<<<<<<
goToFolder,
saveAVD
=======
getVersionFromExtension,
goToFolder
>>>>>>>
goToFolder,
getVersionFromExtension,
saveAVD |
<<<<<<<
[ getCompositionState, getID, getReports ],
(compositionState, id, reports) => {
=======
[ getCompositionState, getPreviewState, getID ],
(compositionState, previewState, id) => {
>>>>>>>
[ getCompositionState, getPreviewState, getID, getReports ],
(compositionState, previewState, id, reports) => {
<<<<<<<
},
reports: {
renderers: reports.settings.renderers,
messageTypes: reports.settings.messageTypes,
}
=======
},
preview: {
backgroundColor: previewState.backgroundColor,
shouldLockTimelineToComposition: previewState.shouldLockTimelineToComposition,
}
>>>>>>>
},
reports: {
renderers: reports.settings.renderers,
messageTypes: reports.settings.messageTypes,
},
preview: {
backgroundColor: previewState.backgroundColor,
shouldLockTimelineToComposition: previewState.shouldLockTimelineToComposition,
} |
<<<<<<<
},
preview: {
backgroundColor: previewState.backgroundColor,
shouldLockTimelineToComposition: previewState.shouldLockTimelineToComposition,
=======
builders: reports.settings.builders,
>>>>>>>
builders: reports.settings.builders,
},
preview: {
backgroundColor: previewState.backgroundColor,
shouldLockTimelineToComposition: previewState.shouldLockTimelineToComposition, |
<<<<<<<
'use strict'
function setFavorite(_Self, _ArtistName, _CollectioName, _Artwork30, _Artwork60, _Artwork100, _FeedUrl) {
let Feed = {
'artistName': _ArtistName,
'artworkUrl100': _Artwork100,
'artworkUrl30': _Artwork30,
'artworkUrl60': _Artwork60,
'collectionName': _CollectioName,
'feedUrl': _FeedUrl
=======
function setFavorite(_Self, _ArtistName, _CollectionName, _Artwork30, _Artwork60, _Artwork100, _FeedUrl)
{
var Feed =
{
"artistName": _ArtistName,
"collectionName": _CollectionName,
"artworkUrl30": _Artwork30,
"artworkUrl60": _Artwork60,
"artworkUrl100": _Artwork100,
"feedUrl": _FeedUrl,
"addToInbox": true
>>>>>>>
function setFavorite(_Self, _ArtistName, _CollectionName, _Artwork30, _Artwork60, _Artwork100, _FeedUrl)
{
var Feed =
{
"artistName": _ArtistName,
"collectionName": _CollectionName,
"artworkUrl30": _Artwork30,
"artworkUrl60": _Artwork60,
"artworkUrl100": _Artwork100,
"feedUrl": _FeedUrl,
"addToInbox": true
<<<<<<<
addToSettings(_CollectioName, _FeedUrl)
=======
>>>>>>> |
<<<<<<<
renderTab: React.PropTypes.func,
=======
underlineStyle: View.propTypes.style,
>>>>>>>
renderTab: React.PropTypes.func,
underlineStyle: View.propTypes.style,
<<<<<<<
{this.props.tabs.map((name, page) => {
const isTabActive = this.props.activeTab === page;
const renderTab = this.props.renderTab || this.renderTab;
return renderTab(name, page, isTabActive, this.props.goToPage);
})}
<Animated.View style={[tabUnderlineStyle, { left, }, ]} />
=======
{this.props.tabs.map((tab, i) => this.renderTabOption(tab, i))}
<Animated.View style={[tabUnderlineStyle, { left, }, this.props.underlineStyle, ]} />
>>>>>>>
{this.props.tabs.map((name, page) => {
const isTabActive = this.props.activeTab === page;
const renderTab = this.props.renderTab || this.renderTab;
return renderTab(name, page, isTabActive, this.props.goToPage);
})}
<Animated.View style={[tabUnderlineStyle, { left, }, this.props.underlineStyle, ]} /> |
<<<<<<<
if (thingTimer){
window.clearInterval(thingTimer);
}
=======
if (window.CSceneGame !== undefined)
{
window.CSceneGame.prototype.DoScreenShake = function() {};
}
if (thingTimer !== undefined) {
window.clearTimeout(thingTimer);
>>>>>>>
if (thingTimer){
window.clearInterval(thingTimer);
}
if (window.CSceneGame !== undefined)
{
window.CSceneGame.prototype.DoScreenShake = function() {};
}
if (thingTimer !== undefined) {
window.clearTimeout(thingTimer);
} |
<<<<<<<
MenuButton: "/src/components/MenuButton/MenuButton.jsx",
=======
RadioButton: "/src/components/RadioButton/RadioButton.jsx",
>>>>>>>
MenuButton: "/src/components/MenuButton/MenuButton.jsx",
RadioButton: "/src/components/RadioButton/RadioButton.jsx", |
<<<<<<<
// @name Monster Minigame Auto-script w/ auto-click
// @namespace https://github.com/chauffer/steamSummerMinigame
=======
// @name Monster Minigame AutoScript
// @author /u/mouseasw for creating and maintaining the script, /u/WinneonSword for the Greasemonkey support, and every contributor on the GitHub repo for constant enhancements.
// @version 1.4
// @namespace https://github.com/mouseas/steamSummerMinigame
>>>>>>>
// @name Monster Minigame Auto-script w/ auto-click
// @namespace https://github.com/chauffer/steamSummerMinigame
<<<<<<<
// @version 1.3
=======
>>>>>>>
// @version 1.4
<<<<<<<
function clickTheThing() {
g_Minigame.m_CurrentScene.DoClick(
{
data: {
getLocalPosition: function() {
var enemy = g_Minigame.m_CurrentScene.GetEnemy(
g_Minigame.m_CurrentScene.m_rgPlayerData.current_lane,
g_Minigame.m_CurrentScene.m_rgPlayerData.target),
laneOffset = enemy.m_nLane * 440;
return {
x: enemy.m_Sprite.position.x - laneOffset,
y: enemy.m_Sprite.position.y - 52
}
}
}
}
);
}
if(setClickVariable) {
var clickTimer = setInterval( function(){
g_Minigame.m_CurrentScene.m_nClicks = clickRate;
}, 1000);
} else {
var clickTimer = window.setInterval(clickTheThing, 1000/clickRate);
}
var ABILITIES = {
"GOOD_LUCK": 6,
"MEDIC": 7,
"METAL_DETECTOR": 8,
"COOLDOWN": 9,
"NUKE": 10,
"CLUSTER_BOMB": 11,
"NAPALM": 12
};
var ITEMS = {
"REVIVE": 13,
"GOLD_RAIN": 17,
"GOD_MODE": 21,
"REFLECT_DAMAGE":24
}
=======
>>>>>>>
function clickTheThing() {
g_Minigame.m_CurrentScene.DoClick(
{
data: {
getLocalPosition: function() {
var enemy = g_Minigame.m_CurrentScene.GetEnemy(
g_Minigame.m_CurrentScene.m_rgPlayerData.current_lane,
g_Minigame.m_CurrentScene.m_rgPlayerData.target),
laneOffset = enemy.m_nLane * 440;
return {
x: enemy.m_Sprite.position.x - laneOffset,
y: enemy.m_Sprite.position.y - 52
}
}
}
}
);
}
if(setClickVariable) {
var clickTimer = setInterval( function(){
g_Minigame.m_CurrentScene.m_nClicks = clickRate;
}, 1000);
} else {
var clickTimer = window.setInterval(clickTheThing, 1000/clickRate);
}
var ABILITIES = {
"GOOD_LUCK": 6,
"MEDIC": 7,
"METAL_DETECTOR": 8,
"COOLDOWN": 9,
"NUKE": 10,
"CLUSTER_BOMB": 11,
"NAPALM": 12
};
var ITEMS = {
"REVIVE": 13,
"GOLD_RAIN": 17,
"GOD_MODE": 21,
"REFLECT_DAMAGE":24
} |
<<<<<<<
export { default as CustomSvgIcon } from "./Icon/CustomSvgIcon";
export { default as Counter } from "./Counter/Counter";
=======
export { default as CustomSvgIcon } from "./Icon/CustomSvgIcon";
export { default as RadioButton } from "./RadioButton/RadioButton";
export { default as MenuButton } from "./MenuButton/MenuButton";
>>>>>>>
export { default as CustomSvgIcon } from "./Icon/CustomSvgIcon";
export { default as RadioButton } from "./RadioButton/RadioButton";
export { default as MenuButton } from "./MenuButton/MenuButton";
export { default as Counter } from "./Counter/Counter"; |
<<<<<<<
MenuTitle: "/src/components/Menu/MenuTitle/MenuTitle.jsx",
Divider: "/src/components/Divider/Divider.jsx",
MenuItem: "/src/components/Menu/MenuItem/MenuItem.jsx",
Menu: "/src/components/Menu/Menu/Menu.jsx",
=======
DialogContentContainer:
"/src/components/DialogContentContainer/DialogContentContainer.jsx",
>>>>>>>
MenuTitle: "/src/components/Menu/MenuTitle/MenuTitle.jsx",
Divider: "/src/components/Divider/Divider.jsx",
MenuItem: "/src/components/Menu/MenuItem/MenuItem.jsx",
Menu: "/src/components/Menu/Menu/Menu.jsx",
DialogContentContainer:
"/src/components/DialogContentContainer/DialogContentContainer.jsx", |
<<<<<<<
var ServeTask = require('../tasks/ember-build-serve');
var Promise = require('ember-cli/lib/ext/promise');
var PortFinder = require('portfinder');
var chalk = require('chalk');
var _merge = require('lodash').merge;
var validateLocationType = require('../utils/validate-location-type');
var getCordovaConfig = require('../utils/get-cordova-config');
=======
var chalk = require('chalk');
var WatchTask = require('../tasks/ember-build-watch');
var ServeTask = require('../tasks/serve-hang');
var ValidatePluginTask = require('../tasks/plugin-exists');
var validateLocationType = require('../utils/validate-location-type');
var getCordovaConfig = require('../utils/get-cordova-config');
>>>>>>>
var ServeTask = require('../tasks/ember-build-serve');
var ValidatePluginTask = require('../tasks/plugin-exists');
var Promise = require('ember-cli/lib/ext/promise');
var PortFinder = require('portfinder');
var chalk = require('chalk');
var _merge = require('lodash').merge;
var validateLocationType = require('../utils/validate-location-type');
var getCordovaConfig = require('../utils/get-cordova-config');
<<<<<<<
var hook, serve, cordovaBuild, validateCordovaConfig;
=======
var hook, watch, serve, pluginExists, cordovaBuild, validateCordovaConfig;
var ui = this.ui;
>>>>>>>
var hook, serve, cordovaBuild, validateCordovaConfig, pluginExists;
<<<<<<<
.then(function(cordovaConfig) {
return validateAllowNavigation(
cordovaConfig,
true
);
=======
.then(function(cordovaConfig) {
return validateAllowNavigation(
cordovaConfig,
options.environment !== 'production'
);
});
pluginExists = new ValidatePluginTask({
project: this.project,
ui: ui,
platform: platform,
pluginName: 'cordova-plugin-whitelist'
});
hook = new HookTask({
project: this.project,
ui: ui
>>>>>>>
.then(function(cordovaConfig) {
return validateAllowNavigation(
cordovaConfig,
true
);
});
pluginExists = new ValidatePluginTask({
project: this.project,
ui: this.ui,
platform: platform,
pluginName: 'cordova-plugin-whitelist' |
<<<<<<<
// @author /u/mouseasw for creating and maintaining the script, /u/WinneonSword for the Greasemonkey support, and every contributor on the GitHub repo for constant enhancements. /u/wchill and contributors on his repo for MSG2015-specific improvements.
// @version 1.7
// @namespace https://github.com/wchill/steamSummerMinigame
=======
// @author /u/mouseasw for creating and maintaining the script, /u/WinneonSword for the Greasemonkey support, and every contributor on the GitHub repo for constant enhancements.
// @version 1.7
// @namespace https://github.com/mouseas/steamSummerMinigame
>>>>>>>
// @author /u/mouseasw for creating and maintaining the script, /u/WinneonSword for the Greasemonkey support, and every contributor on the GitHub repo for constant enhancements. /u/wchill and contributors on his repo for MSG2015-specific improvements.
// @version 1.7
// @namespace https://github.com/wchill/steamSummerMinigame
<<<<<<<
// Use Moral Booster if doable
function useMoraleBoosterIfRelevant() {
// check if Good Luck Charms is purchased and cooled down
if (hasPurchasedAbility(5)) {
if (isAbilityCoolingDown(5)) {
return;
}
var numberOfWorthwhileEnemies = 0;
for(i = 0; i < g_Minigame.CurrentScene().m_rgGameData.lanes[g_Minigame.CurrentScene().m_nExpectedLane].enemies.length; i++){
//Worthwhile enemy is when an enamy has a current hp value of at least 1,000,000
if(g_Minigame.CurrentScene().m_rgGameData.lanes[g_Minigame.CurrentScene().m_nExpectedLane].enemies[i].hp > 1000000)
numberOfWorthwhileEnemies++;
}
if(numberOfWorthwhileEnemies >= 2){
// Moral Booster is purchased, cooled down, and needed. Trigger it.
console.log('Moral Booster is purchased, cooled down, and needed. Trigger it.');
triggerAbility(5);
}
}
}
=======
function useTacticalNukeIfRelevant() {
// Check if Tactical Nuke is purchased
if(hasPurchasedAbility(ABILITIES.NUKE)) {
if (isAbilityCoolingDown(ABILITIES.NUKE)) {
return;
}
//Check that the lane has a spawner and record it's health percentage
var currentLane = g_Minigame.CurrentScene().m_nExpectedLane;
var enemySpawnerExists = false;
var enemySpawnerHealthPercent = 0.0;
//Count each slot in lane
for (var i = 0; i < 4; i++) {
var enemy = g_Minigame.CurrentScene().GetEnemy(currentLane, i);
if (enemy) {
if (enemy.m_data.type == 0) {
enemySpawnerExists = true;
enemySpawnerHealthPercent = enemy.m_flDisplayedHP / enemy.m_data.max_hp;
}
}
}
// If there is a spawner and it's health is between 60% and 30%, nuke it!
if (enemySpawnerExists && enemySpawnerHealthPercent < 0.6 && enemySpawnerHealthPercent > 0.3) {
console.log("Tactical Nuke is purchased, cooled down, and needed. Nuke 'em.");
triggerAbility(ABILITIES.NUKE);
}
}
}
>>>>>>>
// Use Moral Booster if doable
function useMoraleBoosterIfRelevant() {
// check if Good Luck Charms is purchased and cooled down
if (hasPurchasedAbility(5)) {
if (isAbilityCoolingDown(5)) {
return;
}
var numberOfWorthwhileEnemies = 0;
for(i = 0; i < g_Minigame.CurrentScene().m_rgGameData.lanes[g_Minigame.CurrentScene().m_nExpectedLane].enemies.length; i++){
//Worthwhile enemy is when an enamy has a current hp value of at least 1,000,000
if(g_Minigame.CurrentScene().m_rgGameData.lanes[g_Minigame.CurrentScene().m_nExpectedLane].enemies[i].hp > 1000000)
numberOfWorthwhileEnemies++;
}
if(numberOfWorthwhileEnemies >= 2){
// Moral Booster is purchased, cooled down, and needed. Trigger it.
console.log('Moral Booster is purchased, cooled down, and needed. Trigger it.');
triggerAbility(5);
}
}
}
function useTacticalNukeIfRelevant() {
// Check if Tactical Nuke is purchased
if(hasPurchasedAbility(ABILITIES.NUKE)) {
if (isAbilityCoolingDown(ABILITIES.NUKE)) {
return;
}
//Check that the lane has a spawner and record it's health percentage
var currentLane = g_Minigame.CurrentScene().m_nExpectedLane;
var enemySpawnerExists = false;
var enemySpawnerHealthPercent = 0.0;
//Count each slot in lane
for (var i = 0; i < 4; i++) {
var enemy = g_Minigame.CurrentScene().GetEnemy(currentLane, i);
if (enemy) {
if (enemy.m_data.type == 0) {
enemySpawnerExists = true;
enemySpawnerHealthPercent = enemy.m_flDisplayedHP / enemy.m_data.max_hp;
}
}
}
// If there is a spawner and it's health is between 60% and 30%, nuke it!
if (enemySpawnerExists && enemySpawnerHealthPercent < 0.6 && enemySpawnerHealthPercent > 0.3) {
console.log("Tactical Nuke is purchased, cooled down, and needed. Nuke 'em.");
triggerAbility(ABILITIES.NUKE);
}
}
}
<<<<<<<
var thingTimer = window.setInterval(doTheThing, 1000);
function clickTheThing() {
g_Minigame.m_CurrentScene.DoClick(
{
data: {
getLocalPosition: function() {
var enemy = g_Minigame.m_CurrentScene.GetEnemy(
g_Minigame.m_CurrentScene.m_rgPlayerData.current_lane,
g_Minigame.m_CurrentScene.m_rgPlayerData.target),
laneOffset = enemy.m_nLane * 440;
return {
x: enemy.m_Sprite.position.x - laneOffset,
y: enemy.m_Sprite.position.y - 52
}
}
}
}
);
}
if(enableAutoClicker) {
if(setClickVariable) {
var clickTimer = setInterval( function(){
g_Minigame.m_CurrentScene.m_nClicks = clickRate;
}, 1000);
} else {
var clickTimer = window.setInterval(clickTheThing, 1000/clickRate);
}
}
alert("Autoscript now enabled - your game ID is " + g_GameID +
"\nAutoclicker: " + (enableAutoClicker?"enabled - "+clickRate+"cps, "+(setClickVariable?"variable":"clicks"):"disabled") +
"\nParticle effects: " + (disableParticleEffects?"disabled":"enabled") +
"\nFlinching effect: " + (disableFlinching?"disabled":"enabled"));
=======
var thingTimer = window.setInterval(function(){
if (g_Minigame && g_Minigame.CurrentScene().m_bRunning && g_Minigame.CurrentScene().m_rgPlayerTechTree) {
window.clearInterval(thingTimer);
firstRun();
thingTimer = window.setInterval(doTheThing, 1000);
}
}, 1000);
>>>>>>>
var thingTimer = window.setInterval(function(){
if (g_Minigame && g_Minigame.CurrentScene().m_bRunning && g_Minigame.CurrentScene().m_rgPlayerTechTree) {
window.clearInterval(thingTimer);
firstRun();
thingTimer = window.setInterval(doTheThing, 1000);
}
}, 1000);
function clickTheThing() {
g_Minigame.m_CurrentScene.DoClick(
{
data: {
getLocalPosition: function() {
var enemy = g_Minigame.m_CurrentScene.GetEnemy(
g_Minigame.m_CurrentScene.m_rgPlayerData.current_lane,
g_Minigame.m_CurrentScene.m_rgPlayerData.target),
laneOffset = enemy.m_nLane * 440;
return {
x: enemy.m_Sprite.position.x - laneOffset,
y: enemy.m_Sprite.position.y - 52
}
}
}
}
);
}
if(enableAutoClicker) {
if(setClickVariable) {
var clickTimer = setInterval( function(){
g_Minigame.m_CurrentScene.m_nClicks = clickRate;
}, 1000);
} else {
var clickTimer = window.setInterval(clickTheThing, 1000/clickRate);
}
}
alert("Autoscript now enabled - your game ID is " + g_GameID +
"\nAutoclicker: " + (enableAutoClicker?"enabled - "+clickRate+"cps, "+(setClickVariable?"variable":"clicks"):"disabled") +
"\nParticle effects: " + (disableParticleEffects?"disabled":"enabled") +
"\nFlinching effect: " + (disableFlinching?"disabled":"enabled")); |
<<<<<<<
const Command = require('./-command');
const Hook = require('../tasks/run-hook');
const logger = require('../utils/logger');
const CordovaTarget = require('../targets/cordova/target');
const CordovaRaw = require('../targets/cordova/tasks/raw');
const editXml = require('../targets/cordova/utils/edit-xml');
const getNetworkIp = require('../utils/get-network-ip');
const requireFramework = require('../utils/require-framework');
const RSVP = require('rsvp');
const Promise = RSVP.Promise;
const listAndroidEms = require('../targets/android/tasks/list-emulators');
const listAndroidDevices = require('../targets/android/tasks/list-devices');
const AndroidTarget = require('../targets/android/target');
const listIOSEms = require('../targets/ios/tasks/list-emulators');
const listIOSDevices = require('../targets/ios/tasks/list-devices');
const IOSTarget = require('../targets/ios/target');
const CreateLiveReloadShell = require('../tasks/create-livereload-shell');
=======
const Command = require('./-command');
const Hook = require('../tasks/run-hook');
const CreateLRShell = require('../tasks/create-livereload-shell');
const CordovaTarget = require('../targets/cordova/target');
const CordovaRaw = require('../targets/cordova/tasks/raw');
const editXml = require('../targets/cordova/utils/edit-xml');
const listAndroidEmulators = require('../targets/android/tasks/list-emulators');
const listAndroidDevices = require('../targets/android/tasks/list-devices');
const AndroidTarget = require('../targets/android/target');
const listIOSEmulators = require('../targets/ios/tasks/list-emulators');
const IOSTarget = require('../targets/ios/target');
const getNetworkIp = require('../utils/get-network-ip');
const logger = require('../utils/logger');
const requireFramework = require('../utils/require-framework');
const RSVP = require('rsvp');
const supportedPlatforms = ['ios', 'android'];
>>>>>>>
const Command = require('./-command');
const Hook = require('../tasks/run-hook');
const CreateLRShell = require('../tasks/create-livereload-shell');
const CordovaTarget = require('../targets/cordova/target');
const CordovaRaw = require('../targets/cordova/tasks/raw');
const editXml = require('../targets/cordova/utils/edit-xml');
const listAndroidEmulators = require('../targets/android/tasks/list-emulators');
const listAndroidDevices = require('../targets/android/tasks/list-devices');
const AndroidTarget = require('../targets/android/target');
const listIOSEmulators = require('../targets/ios/tasks/list-emulators');
const listIOSDevices = require('../targets/ios/tasks/list-devices');
const IOSTarget = require('../targets/ios/target');
const getNetworkIp = require('../utils/get-network-ip');
const logger = require('../utils/logger');
const requireFramework = require('../utils/require-framework');
const RSVP = require('rsvp');
const supportedPlatforms = ['ios', 'android'];
<<<<<<<
if (opts.platform !== 'android' && installedPlatforms.includes('ios')) {
foundDevices.push(listIOSEms());
foundDevices.push(listIOSDevices());
}
=======
let prepare = new CordovaRaw({
project: project,
api: 'prepare'
});
>>>>>>>
let prepare = new CordovaRaw({
project: project,
api: 'prepare'
}); |
<<<<<<<
=======
var ValidateLocationType = require('../tasks/validate/location-type');
var ValidatePlatformTask = require('../tasks/validate/platform');
var ValidateAllowNavigation = require('../tasks/validate/allow-navigation');
var ValidateRootUrl = require('../tasks/validate/root-url');
var LintIndex = require('../tasks/lint-index');
var parseCordovaOpts = require('../utils/parse-cordova-build-opts');
var projectType = require('../utils/get-project-type');
>>>>>>>
<<<<<<<
=======
startValidators: function(project, options) {
var validations = [];
var projectConfig = project.config(options.environment);
var isGlimmer = projectType.isGlimmer(this.project.root);
if (isGlimmer === false) {
validations.push(
new ValidateRootUrl({
config: projectConfig,
force: options.force
}).run()
);
validations.push(
new ValidateLocationType({
config: projectConfig,
force: options.force
}).run()
);
}
validations.push(
new ValidateAllowNavigation({
project: project,
rejectIfUndefined: false
}).run()
);
if (options.skipCordovaBuild !== true) {
validations.push(
new ValidatePlatformTask({
project: project,
platform: options.platform
}).run()
);
}
return runValidators(validations);
},
>>>>>>>
<<<<<<<
return framework.validateBuild(options)
.then(cordovaTarget.validateBuild(options.skipCordovaBuild))
.then(hook.prepare('beforeBuild', options))
=======
return hook.run('beforeBuild', options)
.then(this.startValidators.bind(this, project, options))
>>>>>>>
return hook.run('beforeBuild')
.then(framework.validateBuild(options))
.then(cordovaTarget.validateBuild(options.skipCordovaBuild)) |
<<<<<<<
return RSVP.all(foundDevices).then((devices) => {
devices = flatten(devices);
=======
return Promise.all(getEmulators).then((emulators) => {
emulators = flatten(emulators);
>>>>>>>
return RSVP.all(foundDevices).then((devices) => {
devices = flatten(devices);
<<<<<<<
return hook.run('beforeBuild')
.then(() => editXml.addNavigation(this.project, reloadUrl))
.then(() => cdvTarget.validateServe())
.then(() => framework.validateServe(opts))
.then(() => createLivereloadShell.run(reloadUrl))
.then(() => prepare.run({ platforms: [device.platform] }))
.then(function() {
if (opts.skipCordovaBuild !== true) {
return platformTarget.build();
}
})
.then(() => hook.run('afterBuild'))
.then(() => platformTarget.run())
.then(() => {
if (opts.skipFrameworkBuild !== true) {
return framework.serve(opts, this.ui);
}
});
=======
return new Promise((resolve, reject) => {
framework.validateServe(opts)
.then(() => editXml.addNavigation(this.project, reloadUrl))
.then(() => createLivereloadShell.run(reloadUrl))
.then(() => prepare.run({ platforms: [emulator.platform] }))
.then(() => hook.run('beforeBuild'))
.then(() => cdvTarget.validateServe())
.then(() => platformTarget.build())
.then(() => hook.run('afterBuild'))
.then(() => platformTarget.run())
.then(() => framework.serve(opts, this.ui))
.then(resolve).catch(reject);
});
>>>>>>>
return new Promise((resolve, reject) => {
hook.run('beforeBuild')
.then(() => editXml.addNavigation(this.project, reloadUrl))
.then(() => cdvTarget.validateServe())
.then(() => framework.validateServe(opts))
.then(() => createLivereloadShell.run(reloadUrl))
.then(() => prepare.run({ platforms: [device.platform] }))
.then(function() {
if (opts.skipCordovaBuild !== true) {
return platformTarget.build();
}
})
.then(() => hook.run('afterBuild'))
.then(() => platformTarget.run())
.then(() => {
if (opts.skipFrameworkBuild !== true) {
return framework.serve(opts, this.ui);
}
})
.then(resolve).catch(reject); |
<<<<<<<
* @struct
* @suppress {checkStructDictInheritance}
* @extends {goog.iter.Iterator}
=======
* @extends {goog.iter.Iterator<goog.date.Date>}
>>>>>>>
* @struct
* @suppress {checkStructDictInheritance}
* @extends {goog.iter.Iterator<goog.date.Date>} |
<<<<<<<
expect(Object.keys(output.components)).toContain(
'package-json-component-test'
);
});
=======
expect(Object.keys(output.components)).toContain('package-json-component-test');
})
// Tests for default and custom components
test('Idyll getComponents() gets all default & custom components', () => {
var defaultComponentsDirectory = __dirname + '/../../../idyll-components/src/';
var idyllComponents = idyll.getComponents();
var componentNames = idyllComponents.map(comp => comp.name + '.js');
// Ensure that the getComponents() have all of the default component file names
fs.readdirSync(defaultComponentsDirectory).forEach(file => {
if (file !== 'index.js') {
expect(componentNames).toContain(file + '');
}
})
// Ensure that we also get the custom components
var customComponentsPath = __dirname + '/src/components/';
fs.readdirSync(customComponentsPath).forEach(file => {
if (file !== 'index.js') {
expect(componentNames).toContain(file + '');
}
})
})
// Tests that getDatasets returns all datasets
// in an Idyll project
test('Idyll getDatasets() gets all default datasets', () => {
var datasets = idyll.getDatasets();
var datasetNames = datasets.map(dataset => dataset.name);
var thisDatasetPath = __dirname + '/src/data/';
fs.readdirSync(thisDatasetPath).forEach(file => {
expect(datasetNames).toContain(file + '');
})
})
>>>>>>>
expect(Object.keys(output.components)).toContain(
'package-json-component-test'
);
});
// Tests for default and custom components
test('Idyll getComponents() gets all default & custom components', () => {
var defaultComponentsDirectory =
__dirname + '/../../../idyll-components/src/';
var idyllComponents = idyll.getComponents();
var componentNames = idyllComponents.map(comp => comp.name + '.js');
// Ensure that the getComponents() have all of the default component file names
fs.readdirSync(defaultComponentsDirectory).forEach(file => {
if (file !== 'index.js') {
expect(componentNames).toContain(file + '');
}
});
// Ensure that we also get the custom components
var customComponentsPath = __dirname + '/src/components/';
fs.readdirSync(customComponentsPath).forEach(file => {
if (file !== 'index.js') {
expect(componentNames).toContain(file + '');
}
});
});
// Tests that getDatasets returns all datasets
// in an Idyll project
test('Idyll getDatasets() gets all default datasets', () => {
var datasets = idyll.getDatasets();
var datasetNames = datasets.map(dataset => dataset.name);
var thisDatasetPath = __dirname + '/src/data/';
fs.readdirSync(thisDatasetPath).forEach(file => {
expect(datasetNames).toContain(file + '');
});
}); |
<<<<<<<
const {
getChildren,
getNodeName,
getProperties,
getType,
removeNodesByName
} = require('idyll-ast');
export const buildExpression = (acc, expr, key, context, isEventHandler) => {
=======
export const buildExpression = (acc, expr, isEventHandler) => {
let identifiers = [];
const modifiedExpression = falafel(
isEventHandler ? expr : `var __idyllReturnValue = ${expr || 'undefined'}`,
node => {
switch (node.type) {
case 'Identifier':
if (Object.keys(acc).indexOf(node.name) > -1) {
identifiers.push(node.name);
node.update('__idyllStateProxy.' + node.source());
}
break;
}
}
);
if (!isEventHandler) {
return `
((context) => {
var __idyllStateProxy = new Proxy({}, {
get: (_, prop) => {
return context[prop];
},
set: (_, prop, value) => {
console.warn('Warning, trying to set a value in a property expression.');
}
});
${modifiedExpression};
return __idyllReturnValue;
})(this)`;
}
>>>>>>>
const {
getChildren,
getNodeName,
getProperties,
getType,
removeNodesByName
} = require('idyll-ast');
export const buildExpression = (acc, expr, isEventHandler) => {
let identifiers = [];
const modifiedExpression = falafel(
isEventHandler ? expr : `var __idyllReturnValue = ${expr || 'undefined'}`,
node => {
switch (node.type) {
case 'Identifier':
if (Object.keys(acc).indexOf(node.name) > -1) {
identifiers.push(node.name);
node.update('__idyllStateProxy.' + node.source());
}
break;
}
}
);
if (!isEventHandler) {
return `
((context) => {
var __idyllStateProxy = new Proxy({}, {
get: (_, prop) => {
return context[prop];
},
set: (_, prop, value) => {
console.warn('Warning, trying to set a value in a property expression.');
}
});
${modifiedExpression};
return __idyllReturnValue;
})(this)`;
} |
<<<<<<<
logging.log(request.method + " " + request.url.href);
if (request.method === "GET" || request.method === "HEAD") {
=======
logging.log(request.id + request.method + " " + request.url.href);
if (request.method == "GET" || request.method == "HEAD") {
>>>>>>>
logging.log(request.id + request.method + " " + request.url.href);
if (request.method === "GET" || request.method === "HEAD") { |
<<<<<<<
cache.update_timestamp(rid, userId, skin_hash, false, function(cache_err) {
callback(cache_err, skin_hash, slim);
=======
cache.update_timestamp(rid, userId, false, function(cache_err) {
callback(cache_err, skin_hash);
>>>>>>>
cache.update_timestamp(rid, userId, false, function(cache_err) {
callback(cache_err, skin_hash, slim);
<<<<<<<
logging.error(rid, skin_err);
callback(skin_err, null, slim);
=======
callback(skin_err, null);
>>>>>>>
callback(skin_err, null, slim);
<<<<<<<
logging.error(rid, err2.stack);
callback(err2, null, slim);
=======
callback(err2, null);
>>>>>>>
callback(err2, null, slim);
<<<<<<<
function resume(userId, type, err, hash, slim) {
var callbacks = requests[type][userId];
=======
function resume(userId, type, err, hash) {
var userId_safe = "!" + userId;
var callbacks = requests[type][userId_safe];
>>>>>>>
function resume(userId, type, err, hash, slim) {
var userId_safe = "!" + userId;
var callbacks = requests[type][userId_safe];
<<<<<<<
cache.update_timestamp(rid, userId, cached_hash, true, function(err2) {
callback(err2 || store_err, -1, cache_details && cached_hash, slim);
=======
cache.update_timestamp(rid, userId, true, function(err2) {
callback(err2 || store_err, -1, cache_details && cached_hash);
>>>>>>>
cache.update_timestamp(rid, userId, true, function(err2) {
callback(err2 || store_err, -1, cache_details && cached_hash, slim);
<<<<<<<
exp.get_avatar = function(rid, userId, helm, size, callback) {
exp.get_image_hash(rid, userId, "skin", function(err, status, skin_hash, slim) {
=======
exp.get_avatar = function(rid, userId, overlay, size, callback) {
exp.get_image_hash(rid, userId, "skin", function(err, status, skin_hash) {
>>>>>>>
exp.get_avatar = function(rid, userId, overlay, size, callback) {
exp.get_image_hash(rid, userId, "skin", function(err, status, skin_hash, slim) {
<<<<<<<
exp.get_render = function(rid, userId, scale, helm, body, callback) {
exp.get_skin(rid, userId, function(err, skin_hash, status, img, slim) {
=======
exp.get_render = function(rid, userId, scale, overlay, body, callback) {
exp.get_skin(rid, userId, function(err, skin_hash, status, img) {
>>>>>>>
exp.get_render = function(rid, userId, scale, overlay, body, callback) {
exp.get_skin(rid, userId, function(err, skin_hash, status, img, slim) {
<<<<<<<
var renderpath = path.join(__dirname, "..", config.directories.renders, [skin_hash, scale, get_type(helm, body), slim ? "s" : "t"].join("-") + ".png");
=======
var renderpath = path.join(config.directories.renders, [skin_hash, scale, get_type(overlay, body)].join("-") + ".png");
>>>>>>>
var renderpath = path.join(config.directories.renders, [skin_hash, scale, get_type(overlay, body), slim ? "s" : "t"].join("-") + ".png");
<<<<<<<
renders.draw_model(rid, img, scale, helm, body, slim, function(draw_err, drawn_img) {
=======
renders.draw_model(rid, img, scale, overlay, body, function(draw_err, drawn_img) {
>>>>>>>
renders.draw_model(rid, img, scale, overlay, body, slim, function(draw_err, drawn_img) { |
<<<<<<<
function handle_default(http_status, uuid) {
if (def && def !== "steve" && def !== "alex") {
logging.log(uuid + " status: 301");
=======
function handle_default(rid, http_status, uuid) {
if (def && def != "steve" && def != "alex") {
logging.log(rid + "status: 301");
>>>>>>>
function handle_default(rid, http_status, uuid) {
if (def && def !== "steve" && def !== "alex") {
logging.log(rid + "status: 301"); |
<<<<<<<
var estraverse = require('estraverse'),
=======
var estraverse = require('estraverse'),
escope = require('escope'),
esprima = require('esprima'),
escodegen = require('escodegen'),
>>>>>>>
var estraverse = require('estraverse'),
escope = require('escope'),
<<<<<<<
function equals(a, b, s) {
var equal,
k;
if(typeof a != typeof b)
return false;
if(typeof a == 'object' || typeof a == 'array') {
equal = true;
for(k in a) {
equal = equal && equals(a[k], b[k], s);
}
for(k in b) {
equal = equal && equals(a[k], b[k], s);
}
return equal;
}
return a === b;
}
function nodeAncestry(f, ast) {
var ancestry = [],
result;
estraverse.traverse(ast, {
enter: function(n) {
if(n == f) result = ancestry.slice();
if(result) return;
ancestry.push(n);
},
leave: function() {
ancestry.pop();
}
});
return result;
}
function returnValue(r) {
return {
=======
function returnValue(r, resultIdentifier) {
return {
>>>>>>>
function equals(a, b, s) {
var equal,
k;
if(typeof a != typeof b)
return false;
if(typeof a == 'object' || typeof a == 'array') {
equal = true;
for(k in a) {
equal = equal && equals(a[k], b[k], s);
}
for(k in b) {
equal = equal && equals(a[k], b[k], s);
}
return equal;
}
return a === b;
}
function nodeAncestry(f, ast) {
var ancestry = [],
result;
estraverse.traverse(ast, {
enter: function(n) {
if(n == f) result = ancestry.slice();
if(result) return;
ancestry.push(n);
},
leave: function() {
ancestry.pop();
}
});
return result;
}
function returnValue(r, resultIdentifier) {
return {
<<<<<<<
};
}
function isFunctionNode(n) {
return ['FunctionDeclaration', 'FunctionExpression'].indexOf(n.type) != -1;
=======
};
>>>>>>>
};
}
function isFunctionNode(n) {
return ['FunctionDeclaration', 'FunctionExpression'].indexOf(n.type) != -1;
<<<<<<<
function functionId(f, ast) {
var ancestry,
parent;
if(f.type == 'FunctionDeclaration') {
return f.id;
}
ancestry = nodeAncestry(f, ast);
parent = ancestry[ancestry.length - 1];
if(parent.type == 'VariableDeclarator') {
return parent.id;
} else if(parent.type == 'AssignmentExpression') {
return parent.left;
}
}
function hasOnlyTailCalls(f, ast) {
var accum = {
=======
function hasOnlyTailCalls(f) {
var name = f.id.name,
accum = {
>>>>>>>
function functionId(f, ast) {
var ancestry,
parent;
if(f.type == 'FunctionDeclaration') {
return f.id;
}
ancestry = nodeAncestry(f, ast);
parent = ancestry[ancestry.length - 1];
if(parent.type == 'VariableDeclarator') {
return parent.id;
} else if(parent.type == 'AssignmentExpression') {
return parent.left;
}
}
function hasOnlyTailCalls(f, ast) {
var accum = { |
<<<<<<<
const ConnectWithLyra = ({ onUpdate }) => {
const connectLyra = async() => {
let response = "";
try {
response = await window.lyra.getPublicKey();
} catch (e) {
console.error(e);
}
const { publicKey, error } = response;
onUpdate('sourceAccount', publicKey);
}
return (
<button className="s-button" type="button" onClick={connectLyra}>Connect Source Account with Lyra</button>
)
}
export default function TxBuilderAttributes(props) {
let {onUpdate, attributes} = props;
=======
function TxBuilderAttributes(props) {
let {onUpdate, attributes, horizonURL} = props;
>>>>>>>
const ConnectWithLyra = ({ onUpdate }) => {
const connectLyra = async() => {
let response = "";
try {
response = await window.lyra.getPublicKey();
} catch (e) {
console.error(e);
}
const { publicKey, error } = response;
onUpdate('sourceAccount', publicKey);
}
return (
<button className="s-button" type="button" onClick={connectLyra}>Connect Source Account with Lyra</button>
)
}
function TxBuilderAttributes(props) {
let {onUpdate, attributes, horizonURL} = props; |
<<<<<<<
it('Should expose a "notify" extender that can configure a computed to notify on all changes', function() {
var notifiedValues = [];
var observable = new ko.observable(1);
var computed = new ko.computed(function () { return observable(); });
computed.subscribe(function (value) { notifiedValues.push(value); });
expect(notifiedValues).toEqual([]);
// Trigger update without changing value; the computed will not notify the change (default behavior)
observable.valueHasMutated();
expect(notifiedValues).toEqual([]);
// Set the computed to notify always
computed.extend({ notify: 'always' });
observable.valueHasMutated();
expect(notifiedValues).toEqual([1]);
});
});
=======
// Borrowed from haberman/knockout (see knockout/knockout#359)
it('Should allow long chains without overflowing the stack', function() {
// maximum with previous code (when running this test only): Chrome 28: 1310, IE 10: 2200; FF 23: 103
// maximum with changed code: Chrome 28: 2620, +100%, IE 10: 4900, +122%; FF 23: 267, +160%
var depth = 200;
var first = ko.observable(0);
var last = first;
for (var i = 0; i < depth; i++) {
(function() {
var l = last;
last = ko.computed(function() { return l() + 1; });
})();
}
var all = ko.computed(function() { return last() + first(); });
first(1);
expect(all()).toEqual(depth+2);
});
})
>>>>>>>
it('Should expose a "notify" extender that can configure a computed to notify on all changes', function() {
var notifiedValues = [];
var observable = new ko.observable(1);
var computed = new ko.computed(function () { return observable(); });
computed.subscribe(function (value) { notifiedValues.push(value); });
expect(notifiedValues).toEqual([]);
// Trigger update without changing value; the computed will not notify the change (default behavior)
observable.valueHasMutated();
expect(notifiedValues).toEqual([]);
// Set the computed to notify always
computed.extend({ notify: 'always' });
observable.valueHasMutated();
expect(notifiedValues).toEqual([1]);
});
// Borrowed from haberman/knockout (see knockout/knockout#359)
it('Should allow long chains without overflowing the stack', function() {
// maximum with previous code (when running this test only): Chrome 28: 1310, IE 10: 2200; FF 23: 103
// maximum with changed code: Chrome 28: 2620, +100%, IE 10: 4900, +122%; FF 23: 267, +160%
var depth = 200;
var first = ko.observable(0);
var last = first;
for (var i = 0; i < depth; i++) {
(function() {
var l = last;
last = ko.computed(function() { return l() + 1; });
})();
}
var all = ko.computed(function() { return last() + first(); });
first(1);
expect(all()).toEqual(depth+2);
});
}); |
<<<<<<<
var allBindings = allBindingsAccessor();
var includeDestroyed = allBindings['optionsIncludeDestroyed'];
var captionPlaceholder = {};
var captionValue;
=======
var includeDestroyed = allBindings.get('optionsIncludeDestroyed');
var caption = {};
>>>>>>>
var includeDestroyed = allBindings.get('optionsIncludeDestroyed');
var captionPlaceholder = {};
var captionValue;
<<<<<<<
if ('optionsCaption' in allBindings) {
captionValue = ko.utils.unwrapObservable(allBindings['optionsCaption']);
// If caption value is null or undefined, don't show a caption
if (captionValue !== null && captionValue !== undefined) {
filteredArray.unshift(captionPlaceholder);
}
=======
if (allBindings['has']('optionsCaption')) {
filteredArray.unshift(caption);
>>>>>>>
if (allBindings['has']('optionsCaption')) {
captionValue = ko.utils.unwrapObservable(allBindings.get('optionsCaption'));
// If caption value is null or undefined, don't show a caption
if (captionValue !== null && captionValue !== undefined) {
filteredArray.unshift(captionPlaceholder);
}
<<<<<<<
if (arrayEntry === captionPlaceholder) {
ko.utils.setHtml(option, captionValue);
=======
if (arrayEntry === caption) {
ko.utils.setHtml(option, allBindings.get('optionsCaption'));
>>>>>>>
if (arrayEntry === captionPlaceholder) {
ko.utils.setHtml(option, allBindings.get('optionsCaption'));
<<<<<<<
ko.dependencyDetection.ignore(allBindings['optionsAfterRender'], null, [newOptions[0], arrayEntry !== captionPlaceholder ? arrayEntry : undefined]);
=======
ko.dependencyDetection.ignore(allBindings.get('optionsAfterRender'), null, [newOptions[0], arrayEntry !== caption ? arrayEntry : undefined]);
>>>>>>>
ko.dependencyDetection.ignore(allBindings.get('optionsAfterRender'), null, [newOptions[0], arrayEntry !== captionPlaceholder ? arrayEntry : undefined]); |
<<<<<<<
* Date: Aug 14 2012
=======
* Date: Aug 22 2012
>>>>>>>
* Date: Aug 23 2012
<<<<<<<
Kinetic.Node.addGettersSetters(Kinetic.Node, ['x', 'y', 'scale', 'detectionType', 'rotation', 'alpha', 'name', 'id', 'offset', 'draggable', 'dragConstraint', 'dragBounds', 'dragBoundFunc', 'listening']);
=======
Kinetic.Node.addGettersSetters(Kinetic.Node, ['x', 'y', 'scale', 'rotation', 'opacity', 'name', 'id', 'offset', 'draggable', 'dragConstraint', 'dragBounds', 'listening']);
>>>>>>>
Kinetic.Node.addGettersSetters(Kinetic.Node, ['x', 'y', 'scale', 'rotation', 'opacity', 'name', 'id', 'offset', 'draggable', 'dragConstraint', 'dragBounds', 'dragBoundFunc', 'listening']); |
<<<<<<<
filterCanvas = this.filterCanvas = new Kinetic.SceneCanvas({
width: width,
height: height
});
=======
if (this.filterCanvas){
filterCanvas = this.filterCanvas;
}
else {
filterCanvas = this.filterCanvas = new Kinetic.SceneCanvas({
width: width,
height: height,
pixelRatio: 1
});
}
>>>>>>>
filterCanvas = this.filterCanvas = new Kinetic.SceneCanvas({
width: width,
height: height,
pixelRatio: 1
}); |
<<<<<<<
})
test('request should wait for "up" event', { timeout: 5000 }, (t) => {
t.plan(5)
const instance = upring(opts({
logLevel: 'error',
base: []
}))
var key = 'hello'
instance.on('request', (req, reply) => {
t.equal(req.key, key, 'key matches')
t.equal(req.hello, 42, 'other key matches')
reply(null, { replying: req.key })
})
instance.request({
key: key,
hello: 42
}, (err, response) => {
t.error(err)
t.deepEqual(response, {
replying: key
}, 'response matches')
instance.close(t.error)
})
})
test('join should wait for "up" event', { timeout: 5000 }, (t) => {
t.plan(1)
const instance1 = upring(opts({
logLevel: 'error',
base: []
}))
instance1.on('up', () => {
const instance2 = upring(opts({
logLevel: 'error',
base: []
}))
instance2.join(instance1.whoami(), () => {
t.pass('everything ok!')
instance1.close()
instance2.close()
})
})
})
test('allocatedToMe should return null if upring is not ready', { timeout: 5000 }, (t) => {
t.plan(2)
const instance = upring(opts({
logLevel: 'error',
base: []
}))
t.equal(instance.allocatedToMe(), null)
instance.on('up', () => {
instance.close(t.error)
})
})
test('whoami should return null if upring is not ready', { timeout: 5000 }, (t) => {
t.plan(2)
const instance = upring(opts({
logLevel: 'error',
base: []
}))
t.equal(instance.whoami(), null)
instance.on('up', () => {
instance.close(t.error)
})
=======
})
test('requestp should support promises', { timeout: 5000 }, (t) => {
t.plan(8)
bootTwo(t, (i1, i2) => {
let i1Key = getKey(i1)
let i2Key = getKey(i2)
i1
.requestp({
key: i2Key,
hello: 42
})
.then(response => {
t.deepEqual(response, {
replying: 'i2'
}, 'response matches')
})
.catch(err => {
t.error(err)
})
i2
.requestp({
key: i1Key,
hello: 42
})
.then(response => {
t.deepEqual(response, {
replying: 'i1'
}, 'response matches')
})
.catch(err => {
t.error(err)
})
i1.on('request', (req, reply) => {
t.equal(req.key, i1Key, 'key matches')
t.equal(req.hello, 42, 'other key matches')
reply(null, { replying: 'i1' })
})
i2.on('request', (req, reply) => {
t.equal(req.key, i2Key, 'key matches')
t.equal(req.hello, 42, 'other key matches')
reply(null, { replying: 'i2' })
})
})
})
test('async await support', t => {
if (Number(process.versions.node[0]) >= 8) {
require('./async-await').asyncAwaitTestRequest(t.test)
} else {
t.pass('Skip because Node version < 8')
}
t.end()
>>>>>>>
})
test('request should wait for "up" event', { timeout: 5000 }, (t) => {
t.plan(5)
const instance = upring(opts({
logLevel: 'error',
base: []
}))
var key = 'hello'
instance.on('request', (req, reply) => {
t.equal(req.key, key, 'key matches')
t.equal(req.hello, 42, 'other key matches')
reply(null, { replying: req.key })
})
instance.request({
key: key,
hello: 42
}, (err, response) => {
t.error(err)
t.deepEqual(response, {
replying: key
}, 'response matches')
instance.close(t.error)
})
})
test('join should wait for "up" event', { timeout: 5000 }, (t) => {
t.plan(1)
const instance1 = upring(opts({
logLevel: 'error',
base: []
}))
instance1.on('up', () => {
const instance2 = upring(opts({
logLevel: 'error',
base: []
}))
instance2.join(instance1.whoami(), () => {
t.pass('everything ok!')
instance1.close()
instance2.close()
})
})
})
test('allocatedToMe should return null if upring is not ready', { timeout: 5000 }, (t) => {
t.plan(2)
const instance = upring(opts({
logLevel: 'error',
base: []
}))
t.equal(instance.allocatedToMe(), null)
instance.on('up', () => {
instance.close(t.error)
})
})
test('whoami should return null if upring is not ready', { timeout: 5000 }, (t) => {
t.plan(2)
const instance = upring(opts({
logLevel: 'error',
base: []
}))
t.equal(instance.whoami(), null)
instance.on('up', () => {
instance.close(t.error)
})
})
test('requestp should support promises', { timeout: 5000 }, (t) => {
t.plan(8)
bootTwo(t, (i1, i2) => {
let i1Key = getKey(i1)
let i2Key = getKey(i2)
i1
.requestp({
key: i2Key,
hello: 42
})
.then(response => {
t.deepEqual(response, {
replying: 'i2'
}, 'response matches')
})
.catch(err => {
t.error(err)
})
i2
.requestp({
key: i1Key,
hello: 42
})
.then(response => {
t.deepEqual(response, {
replying: 'i1'
}, 'response matches')
})
.catch(err => {
t.error(err)
})
i1.on('request', (req, reply) => {
t.equal(req.key, i1Key, 'key matches')
t.equal(req.hello, 42, 'other key matches')
reply(null, { replying: 'i1' })
})
i2.on('request', (req, reply) => {
t.equal(req.key, i2Key, 'key matches')
t.equal(req.hello, 42, 'other key matches')
reply(null, { replying: 'i2' })
})
})
})
test('async await support', t => {
if (Number(process.versions.node[0]) >= 8) {
require('./async-await').asyncAwaitTestRequest(t.test)
} else {
t.pass('Skip because Node version < 8')
}
t.end() |
<<<<<<<
const parsedProfile = Object.create(BaseStateProfile);
parsedProfile.populate(mockStateApi);
export const mockBreakdownProps = {
stateProfile: {
id: '06',
fy: 'latest',
overview: parsedProfile
}
};
=======
export const mockTimes = {
fiscal_year: '2017',
quarter: '4',
month: 4
};
export const mockYears = {
results: [
{
time_period: {
fiscal_year: '1979'
},
aggregated_amount: 123,
group: 'fiscal_Year'
},
{
time_period: {
fiscal_year: '1980'
},
aggregated_amount: 234,
group: 'fiscal_Year'
}
]
};
export const mockQuarters = {
results: [{
time_period: {
fiscal_year: "1979",
quarter: "1"
},
aggregated_amount: "1234"
},
{
time_period: {
fiscal_year: "1979",
quarter: "2"
},
aggregated_amount: "5555"
}]
};
export const mockMonths = {
results: [{
time_period: {
fiscal_year: "1979",
month: "1"
},
aggregated_amount: "1234"
},
{
time_period: {
fiscal_year: "1979",
month: "2"
},
aggregated_amount: "5555"
}]
};
>>>>>>>
const parsedProfile = Object.create(BaseStateProfile);
parsedProfile.populate(mockStateApi);
export const mockBreakdownProps = {
stateProfile: {
id: '06',
fy: 'latest',
overview: parsedProfile
}
};
export const mockTimes = {
fiscal_year: '2017',
quarter: '4',
month: 4
};
export const mockYears = {
results: [
{
time_period: {
fiscal_year: '1979'
},
aggregated_amount: 123,
group: 'fiscal_Year'
},
{
time_period: {
fiscal_year: '1980'
},
aggregated_amount: 234,
group: 'fiscal_Year'
}
]
};
export const mockQuarters = {
results: [{
time_period: {
fiscal_year: "1979",
quarter: "1"
},
aggregated_amount: "1234"
},
{
time_period: {
fiscal_year: "1979",
quarter: "2"
},
aggregated_amount: "5555"
}]
};
export const mockMonths = {
results: [{
time_period: {
fiscal_year: "1979",
month: "1"
},
aggregated_amount: "1234"
},
{
time_period: {
fiscal_year: "1979",
month: "2"
},
aggregated_amount: "5555"
}]
}; |
<<<<<<<
'pop_city',
=======
'parent_award',
'pop_city_name',
>>>>>>>
'pop_city',
'parent_award', |
<<<<<<<
import * as ContractFilterFunctions from './filters/contractFilterFunctions';
=======
import * as OtherFilterFunctions from './filters/OtherFilterFunctions';
>>>>>>>
import * as ContractFilterFunctions from './filters/contractFilterFunctions';
import * as OtherFilterFunctions from './filters/OtherFilterFunctions';
<<<<<<<
awardAmounts: OrderedMap,
pricingType: Set,
setAside: Set,
extentCompeted: Set
=======
awardAmounts: OrderedMap,
selectedCFDA: OrderedMap,
selectedNAICS: OrderedMap,
selectedPSC: OrderedMap
>>>>>>>
awardAmounts: OrderedMap,
selectedCFDA: OrderedMap,
selectedNAICS: OrderedMap,
selectedPSC: OrderedMap,
pricingType: Set,
setAside: Set,
extentCompeted: Set
<<<<<<<
awardAmounts: new OrderedMap(),
pricingType: new Set(),
setAside: new Set(),
extentCompeted: new Set()
=======
awardAmounts: new OrderedMap(),
selectedCFDA: new OrderedMap(),
selectedNAICS: new OrderedMap(),
selectedPSC: new OrderedMap()
>>>>>>>
awardAmounts: new OrderedMap(),
selectedCFDA: new OrderedMap(),
selectedNAICS: new OrderedMap(),
selectedPSC: new OrderedMap(),
pricingType: new Set(),
setAside: new Set(),
extentCompeted: new Set()
<<<<<<<
// Pricing Type Filter
case 'UPDATE_PRICING_TYPE': {
return Object.assign({}, state, {
pricingType: ContractFilterFunctions.updateContractFilterSet(
state.pricingType, action.pricingType)
});
}
// Set Aside Filter
case 'UPDATE_SET_ASIDE': {
return Object.assign({}, state, {
setAside: ContractFilterFunctions.updateContractFilterSet(
state.setAside, action.setAside)
});
}
// Extent Competed Filter
case 'UPDATE_EXTENT_COMPETED': {
return Object.assign({}, state, {
extentCompeted: ContractFilterFunctions.updateContractFilterSet(
state.extentCompeted, action.extentCompeted)
});
}
=======
// CFDA Filter
case 'UPDATE_SELECTED_CFDA': {
return Object.assign({}, state, {
selectedCFDA: OtherFilterFunctions.updateSelectedCFDA(
state.selectedCFDA, action.cfda)
});
}
// NAICS Filter
case 'UPDATE_SELECTED_NAICS': {
return Object.assign({}, state, {
selectedNAICS: OtherFilterFunctions.updateSelectedNAICS(
state.selectedNAICS, action.naics)
});
}
// PSC Filter
case 'UPDATE_SELECTED_PSC': {
return Object.assign({}, state, {
selectedPSC: OtherFilterFunctions.updateSelectedPSC(
state.selectedPSC, action.psc)
});
}
>>>>>>>
// CFDA Filter
case 'UPDATE_SELECTED_CFDA': {
return Object.assign({}, state, {
selectedCFDA: OtherFilterFunctions.updateSelectedCFDA(
state.selectedCFDA, action.cfda)
});
}
// NAICS Filter
case 'UPDATE_SELECTED_NAICS': {
return Object.assign({}, state, {
selectedNAICS: OtherFilterFunctions.updateSelectedNAICS(
state.selectedNAICS, action.naics)
});
}
// PSC Filter
case 'UPDATE_SELECTED_PSC': {
return Object.assign({}, state, {
selectedPSC: OtherFilterFunctions.updateSelectedPSC(
state.selectedPSC, action.psc)
});
}
// Pricing Type Filter
case 'UPDATE_PRICING_TYPE': {
return Object.assign({}, state, {
pricingType: ContractFilterFunctions.updateContractFilterSet(
state.pricingType, action.pricingType)
});
}
// Set Aside Filter
case 'UPDATE_SET_ASIDE': {
return Object.assign({}, state, {
setAside: ContractFilterFunctions.updateContractFilterSet(
state.setAside, action.setAside)
});
}
// Extent Competed Filter
case 'UPDATE_EXTENT_COMPETED': {
return Object.assign({}, state, {
extentCompeted: ContractFilterFunctions.updateContractFilterSet(
state.extentCompeted, action.extentCompeted)
});
} |
<<<<<<<
});
export const fetchSpendingOverTime = (params) => apiRequest({
isMocked: true,
url: 'v2/disaster/spending_over_time/',
method: 'post',
data: params
=======
});
export const fetchAwardAmounts = (params) => apiRequest({
isMocked: true,
url: 'v2/disaster/award/amount/',
method: 'post',
data: params
});
export const fetchAwardCount = (params) => apiRequest({
isMocked: true,
url: 'v2/disaster/award/count/',
method: 'post',
data: params
});
export const fetchCfdaCount = (params) => apiRequest({
isMocked: true,
url: 'v2/disaster/cfda/count/',
method: 'post',
data: params
>>>>>>>
});
export const fetchSpendingOverTime = (params) => apiRequest({
isMocked: true,
url: 'v2/disaster/spending_over_time/',
method: 'post',
data: params
});
export const fetchAwardAmounts = (params) => apiRequest({
isMocked: true,
url: 'v2/disaster/award/amount/',
method: 'post',
data: params
});
export const fetchAwardCount = (params) => apiRequest({
isMocked: true,
url: 'v2/disaster/award/count/',
method: 'post',
data: params
});
export const fetchCfdaCount = (params) => apiRequest({
isMocked: true,
url: 'v2/disaster/cfda/count/',
method: 'post',
data: params |
<<<<<<<
];
export const unlinkedDataColumns = (type) => ([
{ displayName: '' },
{ displayName: `Unlinked ${type} Awards in ${type === 'Contract' ? type : 'Financial Assistance'} Data` },
{ displayName: `Unlinked ${type} Awards in Award Spending Breakdown Data` },
{ displayName: 'Total' }
]);
const mockDataMissingAccountBalances = [
{
tas: "123-X-3409/3490-456",
amount: 12
},
{
tas: "123-X-3409",
amount: "2020-11-11T11:59:21Z"
},
{
tas: "234-X-3409/45-456",
amount: 123
},
{
tas: "123-34-3409/324-456",
amount: 543
},
{
tas: "123-3434-3409",
amount: 789
},
{
tas: "123-X-35/22-456",
amount: 23
},
{
tas: "123-096-3409/22-456",
amount: 234
},
{
tas: "123-X-00/3490-456",
amount: 56
},
{
tas: "007-X-3409/3490-456",
amount: 754
},
{
tas: "008-X-3409/3490-456",
amount: 345
},
{
tas: "009-X-3409/3490-456",
amount: 765
},
{
tas: "200-X-3409/3490-456",
amount: 758
},
{
tas: "444-X-3409/3490-456",
amount: 234
}
];
// TODO - delete this when API is integrated
export const mockAPIMissingAccountBalances = (params) => {
const pageMetaData = {
page: 1,
next: 2,
previous: 0,
hasNext: false,
hasPrevious: false,
total: 16,
limit: 10
};
pageMetaData.page = params.page;
pageMetaData.next = params.next;
pageMetaData.previous = params.page - 1;
pageMetaData.hasNext = params.page === 1;
pageMetaData.hasPrevious = params.page === 2;
pageMetaData.limite = params.limit;
return {
promise: new Promise((resolve) => {
setTimeout(() => {
if (params.page === 1) {
const data = {
page_metadata: pageMetaData,
results: mockDataMissingAccountBalances.slice(0, params.limit)
};
resolve({ data });
}
else {
const data = {
page_metadata: pageMetaData,
results: mockDataMissingAccountBalances.slice(params.limit, params.limit * 2)
};
resolve({ data });
}
}, 1000);
}),
cancel: () => console.log(' :wave: ')
};
};
=======
];
>>>>>>>
];
export const unlinkedDataColumns = (type) => ([
{ displayName: '' },
{ displayName: `Unlinked ${type} Awards in ${type === 'Contract' ? type : 'Financial Assistance'} Data` },
{ displayName: `Unlinked ${type} Awards in Award Spending Breakdown Data` },
{ displayName: 'Total' }
]); |
<<<<<<<
// make API call to transactions total aggregation endpoint
export const performTransactionsTotalSearch = (params) => {
=======
// Fetch Individual Award
export const fetchAward = (num) => {
const source = CancelToken.source();
return {
promise: Axios.request({
url: `awards/${num}/`,
baseURL: kGlobalConstants.API,
method: 'get',
cancelToken: source.token
}),
cancel() {
source.cancel();
}
};
};
// make API call to awards total aggregation endpoint
export const performAwardsTotalSearch = (params) => {
>>>>>>>
// Fetch Individual Award
export const fetchAward = (num) => {
const source = CancelToken.source();
return {
promise: Axios.request({
url: `awards/${num}/`,
baseURL: kGlobalConstants.API,
method: 'get',
cancelToken: source.token
}),
cancel() {
source.cancel();
}
};
};
// make API call to awards total aggregation endpoint
export const performTransactionsTotalSearch = (params) => { |
<<<<<<<
import Controller from '@ember/controller';
import { computed } from '@ember/object';
import { A } from '@ember/array';
import { inject as service } from '@ember/service';
import _ from 'lodash';
=======
import Ember from 'ember';
import values from 'npm:lodash.values';
import groupBy from 'npm:lodash.groupby';
>>>>>>>
import Controller from '@ember/controller';
import { computed } from '@ember/object';
import { A } from '@ember/array';
import { inject as service } from '@ember/service';
import values from 'npm:lodash.values';
import groupBy from 'npm:lodash.groupby'; |
<<<<<<<
head.writeUInt8(0x04, 0)
head.writeUInt8(quantity * 2, 1)
var response = Buffer.concat([head, mem.slice(byteStart * 2, byteStart * 2 + quantity * 2)])
=======
var response = Buffer.concat([head, mem.slice(byteStart, byteStart + quantity * 2)]);
>>>>>>>
head.writeUInt8(0x04, 0)
head.writeUInt8(quantity * 2, 1)
var response = Buffer.concat([head, mem.slice(byteStart, byteStart + quantity * 2)]) |
<<<<<<<
(function(phantomas) {
// Prevent events from being sent from an iframe. Only from the main document.
if (window.parent !== window || window.location.href === 'about:blank') {
return;
}
function emit(eventName) {
phantomas.log('Navigation Timing milestone: %s', eventName);
phantomas.emit('milestone', eventName); // @desc Page loading milestone has been reached: domInteractive, domReady and domComplete
}
=======
(function (phantomas) {
function emit(eventName) {
phantomas.log("Navigation Timing milestone: %s", eventName);
phantomas.emit("milestone", eventName); // @desc Page loading milestone has been reached: domInteractive, domReady and domComplete
}
>>>>>>>
(function (phantomas) {
// Prevent events from being sent from an iframe. Only from the main document.
if (window.parent !== window || window.location.href === 'about:blank') {
return;
}
function emit(eventName) {
phantomas.log("Navigation Timing milestone: %s", eventName);
phantomas.emit("milestone", eventName); // @desc Page loading milestone has been reached: domInteractive, domReady and domComplete
} |
<<<<<<<
readHoldingRegister: function (start, quantity, cb) {
var fc = 3,
defer = Q.defer(),
pdu = that.pduWithTwoParameter(fc, start, quantity);
if (!cb) {
that.makeRequest(fc, pdu, that.promiseCallback(defer));
return that.promise;
}
return that.makeRequest(fc, pdu, cb);
},
=======
readDiscreteInput: function (start, quantity, cb) {
var fc = 2,
defer = Q.defer(),
pdu = that.pduWithTwoParameter(fc, start, quantity);
if (quantity > 2000) {
if (!cb) {
defer.reject();
return defer.promise;
}
cb(null, {});
return;
}
if (!cb) {
that.makeRequest(fc, pdu, that.promiseCallback(defer));
return defer.promise;
}
return that.makeRequest(fc, pdu, cb);
},
>>>>>>>
readHoldingRegister: function (start, quantity, cb) {
var fc = 3,
defer = Q.defer(),
pdu = that.pduWithTwoParameter(fc, start, quantity);
if (!cb) {
that.makeRequest(fc, pdu, that.promiseCallback(defer));
return that.promise;
}
return that.makeRequest(fc, pdu, cb);
},
readDiscreteInput: function (start, quantity, cb) {
var fc = 2,
defer = Q.defer(),
pdu = that.pduWithTwoParameter(fc, start, quantity);
if (quantity > 2000) {
if (!cb) {
defer.reject();
return defer.promise;
}
cb(null, {});
return;
}
if (!cb) {
that.makeRequest(fc, pdu, that.promiseCallback(defer));
return defer.promise;
}
return that.makeRequest(fc, pdu, cb);
}, |
<<<<<<<
const payloadHashBuffer = new Buffer(block.payloadHash, 'hex')
=======
var payloadHashBuffer = Buffer.from(block.payloadHash, 'hex')
>>>>>>>
const payloadHashBuffer = Buffer.from(block.payloadHash, 'hex')
<<<<<<<
const generatorPublicKeyBuffer = new Buffer(block.generatorPublicKey, 'hex')
=======
var generatorPublicKeyBuffer = Buffer.from(block.generatorPublicKey, 'hex')
>>>>>>>
const generatorPublicKeyBuffer = Buffer.from(block.generatorPublicKey, 'hex') |
<<<<<<<
* @param {Number} config
* @param {Boolean} networkStart
* @return {void}
=======
* @param {Object} config [description]
* @param {Boolean} networkStart [description]
>>>>>>>
* @param {Number} config
* @param {Boolean} networkStart
* @return {void}
<<<<<<<
* @param {String} event
* @return {void}
=======
* @param {String} event [description]
* @return {Timeout} [description]
>>>>>>>
* @param {String} event
* @return {void}
<<<<<<<
* @return {void}
=======
>>>>>>>
* @return {void}
<<<<<<<
=======
* [getInstance description]
* @return {BlockchainManager} [description]
*/
static getInstance () {
return instance
}
/**
>>>>>>>
* [getInstance description]
* @return {BlockchainManager} [description]
*/
static getInstance () {
return instance
}
/**
<<<<<<<
* @return {void}
=======
>>>>>>>
* @return {void}
<<<<<<<
* @return {void}
=======
>>>>>>>
* @return {void}
<<<<<<<
* @param {Number} nblocks
* @return {void}
=======
* @param {[type]} nblocks [description]
>>>>>>>
* @param {Number} nblocks
* @return {void} |
<<<<<<<
const moment = require('moment')
=======
const delay = require('delay')
>>>>>>>
const moment = require('moment')
const delay = require('delay') |
<<<<<<<
const transformer = requireFrom('api/transformer')
const arkjs = require('arkjs')
=======
const Transformer = requireFrom('api/transformer')
>>>>>>>
const Transformer = requireFrom('api/transformer')
const arkjs = require('arkjs')
<<<<<<<
index(req, res, next) {
db.accounts.all(req.query).then(result => {
=======
index (req, res, next) {
db.accounts.all({
offset: parseInt(req.query.offset || 1),
limit: parseInt(req.query.limit || 100)
}).then(result => {
>>>>>>>
index(req, res, next) {
db.accounts.all(req.query).then(result => {
<<<<<<<
show(req, res, next) {
db.accounts.findById(req.query.address)
.then(result => {
if (result) {
responder.ok(req, res, {
account: new transformer(req).resource(result, 'account')
=======
show (req, res, next) {
if (arkjs.crypto.validateAddress(req.query.address, config.network.pubKeyHash)) {
db.accounts.findById(req.query.address)
.then(result => {
responder.ok(req, res, {
account: new Transformer(req).resource(result, 'account')
})
>>>>>>>
show (req, res, next) {
db.accounts.findById(req.query.address)
.then(result => {
if (result) {
responder.ok(req, res, {
account: new Transformer(req).resource(result, 'account')
<<<<<<<
balance(req, res, next) {
db.accounts.findById(req.query.address)
.then(account => {
if (account) {
responder.ok(req, res, {
balance: account ? account.balance : '0',
unconfirmedBalance: account ? account.balance : '0'
=======
balance (req, res, next) {
if (arkjs.crypto.validateAddress(req.query.address, config.network.pubKeyHash)) {
db.accounts.findById(req.query.address)
.then(account => {
responder.ok(req, res, {
balance: account ? account.balance : '0',
unconfirmedBalance: account ? account.balance : '0'
})
>>>>>>>
balance (req, res, next) {
db.accounts.findById(req.query.address)
.then(account => {
if (account) {
responder.ok(req, res, {
balance: account ? account.balance : '0',
unconfirmedBalance: account ? account.balance : '0'
<<<<<<<
error: error
=======
error: 'Object didn\'t pass validation for format address: ' + req.query.address
>>>>>>>
error: error
})
})
next()
}
balance (req, res, next) {
db.accounts.findById(req.query.address)
.then(account => {
if (account) {
responder.ok(req, res, {
balance: account ? account.balance : '0',
unconfirmedBalance: account ? account.balance : '0'
})
}
else {
responder.error(req, res, {
error: 'Not found',
})
}
})
.catch(error => {
logger.error(error)
responder.error(req, res, {
error: error
})
})
next()
}
publicKey (req, res, next) {
db.accounts.findById(req.query.address)
.then(account => {
if (account) {
responder.ok(req, res, {
publicKey: account.publicKey,
})
}else {
responder.error(req, res, {
error: 'Not found',
})
}
})
.catch(error => {
logger.error(error)
responder.error(req, res, {
error: error |
<<<<<<<
const Sequelize = require('sequelize')
=======
const Op = require('sequelize').Op
const moment = require('moment')
>>>>>>>
const Sequelize = require('sequelize')
const Op = require('sequelize').Op
const moment = require('moment')
<<<<<<<
all(queryParams) {
let whereStatement = {}
let orderBy = []
const filter = ['type', 'senderPublicKey', 'vendorField', 'senderId', 'recipientId', 'amount', 'fee', 'blockId']
for (const elem of filter) {
if (!!queryParams[elem])
whereStatement[elem] = queryParams[elem]
}
if (!!queryParams.orderBy){
let order = queryParams.orderBy.split(':')
if (['timestamp', 'type', 'amount'].includes(order[0])) {
orderBy.push(queryParams.orderBy.split(':'))
}
}
return this.db.transactionsTable.findAndCountAll({
where: whereStatement,
order: orderBy,
offset: parseInt(queryParams.offset || 1),
limit: parseInt(queryParams.limit || 100),
include: {
model: this.db.blocksTable,
attributes: ['height'],
}
})
=======
all (params = {}) {
return this.db.transactionsTable.findAndCountAll(params)
>>>>>>>
all (queryParams) {
let whereStatement = {}
let orderBy = []
const filter = ['type', 'senderPublicKey', 'vendorField', 'senderId', 'recipientId', 'amount', 'fee', 'blockId']
for (const elem of filter) {
if (!!queryParams[elem])
whereStatement[elem] = queryParams[elem]
}
if (!!queryParams.orderBy){
let order = queryParams.orderBy.split(':')
if (['timestamp', 'type', 'amount'].includes(order[0])) {
orderBy.push(queryParams.orderBy.split(':'))
}
}
return this.db.transactionsTable.findAndCountAll({
where: whereStatement,
order: orderBy,
offset: parseInt(queryParams.offset || 1),
limit: parseInt(queryParams.limit || 100),
include: {
model: this.db.blocksTable,
attributes: ['height'],
}
}) |
<<<<<<<
logger.info('Removing ' + (height - newHeigth) + ' blocks to start from current round')
let count = 0
const max = stateMachine.state.lastBlock.data.height - newHeigth
=======
logger.info(`Removing ${height - newHeigth} blocks to reset current round`)
>>>>>>>
logger.info(`Removing ${height - newHeigth} blocks to reset current round`)
let count = 0
const max = stateMachine.state.lastBlock.data.height - newHeigth |
<<<<<<<
if (this.transactionPool) this.transactionPool.acceptChainedBlock(block)
=======
if (this.transactionPool) {
this.transactionPool.removeTransactions(block.transactions)
}
>>>>>>>
if (this.transactionPool) {
this.transactionPool.acceptChainedBlock(block)
} |
<<<<<<<
model.welcome = undefined;
model.search = (model.lastname + ' ' + model.firstname + ' ' + model.email).toSearch();
=======
delete model.welcome;
model.search = (model.lastname + ' ' + model.firstname + ' ' + model.email).search();
>>>>>>>
model.welcome = undefined;
model.search = (model.lastname + ' ' + model.firstname + ' ' + model.email).toSearch();
<<<<<<<
prepare(item, $.model);
=======
G.users.push(item);
LOGGER('users', 'create: ' + item.id + ' - ' + item.name, '@' + ($.user ? $.user.name : 'root'), $.ip || 'localhost');
}
if (!item.apps)
item.apps = {};
item.ougroups = {};
var ou = item.ou.split('/').trim();
var oupath = '';
for (var i = 0; i < ou.length; i++) {
oupath += (oupath ? '/' : '') + ou[i];
item.ougroups[oupath] = true;
}
item.ou = OP.ou(item.ou);
item.companylinker = item.company.slug();
item.localitylinker = item.locality.slug();
delete item.rebuildtoken;
>>>>>>>
prepare(item, $.model);
<<<<<<<
=======
setTimeout2('users', function() {
$WORKFLOW('User', 'refresh');
OP.save2(2);
}, 1000);
EMIT('users.' + (newbie ? 'create' : 'update'), item);
EMIT('users.refresh', item, item.blocked || item.inactive ? true : undefined);
$.success();
>>>>>>>
<<<<<<<
$.success();
=======
LOGGER('users', 'remove: ' + id, '@' + ($.user ? $.user.name : 'root'), $.ip || 'localhost');
Fs.unlink(F.path.databases('notifications_' + user.id + '.json'), NOOP);
setTimeout2('users', function() {
$WORKFLOW('User', 'refresh');
OP.save2(2);
}, 1000);
EMIT('users.remove', user);
EMIT('users.refresh', user, true);
}
$.success();
});
schema.addWorkflow('refresh', function($) {
var ou = {};
var localities = {};
var companies = {};
var customers = {};
var groups = {};
var roles = {};
var toArray = function(obj, preparator) {
var arr = Object.keys(obj);
var output = [];
for (var i = 0, length = arr.length; i < length; i++)
output.push(preparator ? preparator(obj[arr[i]]) : obj[arr[i]]);
output.quicksort('name');
return output;
};
for (var i = 0, length = G.users.length; i < length; i++) {
var item = G.users[i];
var ougroups = item.ougroups ? Object.keys(item.ougroups) : EMPTYARRAY;
for (var j = 0; j < ougroups.length; j++) {
var oukey = ougroups[j];
if (ou[oukey])
ou[oukey].count++;
else
ou[oukey] = { count: 1, name: oukey };
}
for (var j = 0; j < item.groups.length; j++) {
var g = item.groups[j];
if (groups[g])
groups[g].count++;
else
groups[g] = { count: 1, id: g, name: g };
}
for (var j = 0; j < item.roles.length; j++) {
var r = item.roles[j];
if (roles[r])
roles[r].count++;
else
roles[r] = { count: 1, id: r, name: r };
}
if (item.locality) {
if (localities[item.locality])
localities[item.locality].count++;
else
localities[item.locality] = { count: 1, id: item.locality.slug(), name: item.locality };
}
if (item.company) {
if (item.customer) {
if (customers[item.company])
customers[item.company].count++;
else
customers[item.company] = { count: 1, id: item.company.slug(), name: item.company };
}
if (companies[item.company])
companies[item.company].count++;
else
companies[item.company] = { count: 1, id: item.company.slug(), name: item.company };
}
}
var meta = G.meta = {};
meta.companies = toArray(companies);
meta.customers = toArray(customers);
meta.localities = toArray(localities);
meta.groups = toArray(groups);
meta.roles = toArray(roles);
meta.languages = F.config.languages;
meta.ou = toArray(ou, function(item) {
item.id = item.name = item.name.replace(/\//g, ' / ');
return item;
>>>>>>>
$.success(); |
<<<<<<<
=======
.option('useLedgerKey', {
desc: 'Use Ledger for signing with given HD key path',
type: 'string',
default: "44'/397'/0'/0'/1'"
})
>>>>>>>
.option('useLedgerKey', {
desc: 'Use Ledger for signing with given HD key path',
type: 'string',
default: "44'/397'/0'/0'/1'"
}) |
<<<<<<<
const NEAR_ENV_SUFFIXES = {
production: 'near',
default: 'test',
development: 'test',
devnet: 'dev',
betanet: 'beta'
};
const TLA_MIN_LENGTH = 32;
=======
const eventtracking = require('../utils/eventtracking');
>>>>>>>
const eventtracking = require('../utils/eventtracking');
const NEAR_ENV_SUFFIXES = {
production: 'near',
default: 'test',
development: 'test',
devnet: 'dev',
betanet: 'beta'
};
const TLA_MIN_LENGTH = 32; |
<<<<<<<
const defaultConfig = require('./blank_project/src/config')(process.env.NODE_ENV || 'development');
console.log(defaultConfig);
=======
const defaultConfig = require('./config')(process.env.NODE_ENV || 'development');
>>>>>>>
const defaultConfig = require('./config')(process.env.NODE_ENV || 'development');
console.log(defaultConfig); |
<<<<<<<
/**
* Get ajax parameters to be used in setupArticleSelector, based on session.autocomplete
* @return {object|null} to be passed in as the value for `ajax` in setupArticleSelector
*/
=======
/**
* Returns the AJAX options based on search type
* @returns {object} options to be passed to $.ajax
*/
>>>>>>>
/**
* Get ajax parameters to be used in setupArticleSelector, based on session.autocomplete
* @return {object|null} to be passed in as the value for `ajax` in setupArticleSelector
*/
<<<<<<<
=======
/** the "Latest N days" links */
$('.date-latest a').on('click', function () {
var daterangepicker = $(config.dateRangeSelector).data('daterangepicker');
daterangepicker.setStartDate(moment().subtract($(this).data('value'), 'days'));
daterangepicker.setEndDate(moment());
});
/** language selector */
$('.lang-link').on('click', function () {
var expiryGMT = moment().add(config.cookieExpiry, 'days').toDate().toGMTString();
document.cookie = 'TsIntuition_userlang=' + $(this).data('lang') + '; expires=' + expiryGMT + '; path=/';
var expiryUnix = Math.floor(Date.now() / 1000) + config.cookieExpiry * 24 * 60 * 60;
document.cookie = 'TsIntuition_expiry=' + expiryUnix + '; expires=' + expiryGMT + '; path=/';
location.reload();
});
>>>>>>>
/** language selector */
$('.lang-link').on('click', function () {
var expiryGMT = moment().add(config.cookieExpiry, 'days').toDate().toGMTString();
document.cookie = 'TsIntuition_userlang=' + $(this).data('lang') + '; expires=' + expiryGMT + '; path=/';
var expiryUnix = Math.floor(Date.now() / 1000) + config.cookieExpiry * 24 * 60 * 60;
document.cookie = 'TsIntuition_expiry=' + expiryUnix + '; expires=' + expiryGMT + '; path=/';
location.reload();
}); |
<<<<<<<
attribute.informativeProperties = ['id', 'default', 'description', 'title'];
attribute.argumentProperties = ['exclusiveMinimum', 'exclusiveMaximum', 'additionalItems'];
attribute.ignoreProperties = [].concat(attribute.informativeProperties, attribute.argumentProperties);
=======
attribute.ignoreProperties = {
// informativeProperties
'id': true,
'default': true,
'description': true,
'title': true,
// argumentProperties
'exclusiveMinimum': true,
'exclusiveMaximum': true,
'items': true,
'additionalItems': true,
'properties': true,
'additionalProperties': true,
'patternProperties': true,
'extends': true
};
>>>>>>>
attribute.ignoreProperties = {
// informativeProperties
'id': true,
'default': true,
'description': true,
'title': true,
// argumentProperties
'exclusiveMinimum': true,
'exclusiveMaximum': true,
'additionalItems': true,
};
<<<<<<<
=======
/**
* Tests whether the instance if of a certain type.
* @private
* @param instance
* @param options
* @param propertyName
* @param type
* @return {boolean}
*/
var testType = function (instance, options, propertyName, type) {
switch (type) {
case 'string':
return (typeof instance === 'string');
case 'number':
return (typeof instance === 'number');
case 'integer':
return (typeof instance === 'number') && instance % 1 === 0;
case 'boolean':
return (typeof instance === 'boolean');
// TODO: fix this - see #15
case 'object':
return (instance && (typeof instance) === 'object' && !(instance instanceof Array) && !(instance instanceof Date));
case 'array':
return (instance instanceof Array);
case 'null':
return (instance === null);
case 'date':
return (instance instanceof Date);
case 'any':
return true;
}
if (type && typeof type === 'object') {
var errs = this.validateSchema(instance, type, options, propertyName);
return !(errs && errs.length);
}
return false;
};
/**
* Validates whether the instance if of a certain type
* @param instance
* @param schema
* @param options
* @param propertyName
* @return {String|null}
*/
>>>>>>>
/**
* Validates whether the instance if of a certain type
* @param instance
* @param schema
* @param options
* @param propertyName
* @return {String|null}
*/
<<<<<<<
// Only applicable for strings, ignored otherwise
validators.format = function validateFormat(instance, schema, options, propertyName) {
if(instance===undefined) return;
=======
/**
* Validates whether the instance value is of a certain defined format, when the instance value is a string.
* The following format are supported:
* - date-time
* - date
* - time
* - ip-address
* - ipv6
* - uri
* - color
* - host-name
* - alpha
* - alpha-numeric
* - utc-millisec
* @param instance
* @param schema
* @return {String|null}
*/
validators.format = function validateFormat(instance, schema) {
if (instance === undefined) {
return null;
}
>>>>>>>
/**
* Validates whether the instance value is of a certain defined format, when the instance value is a string.
* The following format are supported:
* - date-time
* - date
* - time
* - ip-address
* - ipv6
* - uri
* - color
* - host-name
* - alpha
* - alpha-numeric
* - utc-millisec
* @param instance
* @param schema
* @return {String|null}
*/
validators.format = function validateFormat(instance, schema, options, propertyName) {
if (instance === undefined) {
return null;
}
<<<<<<<
var result = new ValidatorResult(instance, schema, options, propertyName);
if (!instance || typeof instance!='object') return;
for(var property in schema.dependencies){
if(instance[property]===undefined) continue;
var dep = schema.dependencies[property];
var propPath = propertyName+helpers.makeSuffix(property);
if(typeof dep=='string'){
dep=[dep];
}
if(dep instanceof Array){
dep.forEach(function(prop){
if(instance[prop] === undefined){
result.addError("property "+prop+" not found, required by "+propPath);
}
});
}else{
var errs = this.validateSchema(instance, dep, options, propPath);
if(errs&&errs.errors.length){
result.addError("does not meet dependency required by "+propPath);
result.importErrors(errs);
=======
if (!instance || typeof instance !== 'object') {
return null;
}
var property;
for (property in schema.dependencies) {
if (schema.dependencies.hasOwnProperty(property)) {
if (instance[property] === undefined) {
continue;
}
var dep = schema.dependencies[property];
var propPath = propertyName + helpers.makeSuffix(property);
if (typeof dep === 'string') {
dep = [dep];
}
if (dep instanceof Array) {
var i, len = dep.length;
for (i = 0, len; i < len; i++) {
if (instance[dep[i]] === undefined) {
return " property " + dep[i] + " not found, required by " + propPath;
}
}
} else {
var errs = this.validateSchema(instance, dep, options, propPath);
if (errs && errs.length) {
return "does not meet dependency required by " + propPath;
}
>>>>>>>
var result = new ValidatorResult(instance, schema, options, propertyName);
if (!instance || typeof instance!='object') return;
for(var property in schema.dependencies){
if(instance[property]===undefined) continue;
var dep = schema.dependencies[property];
var propPath = propertyName+helpers.makeSuffix(property);
if(typeof dep=='string'){
dep=[dep];
}
if(dep instanceof Array){
dep.forEach(function(prop){
if(instance[prop] === undefined){
result.addError("property "+prop+" not found, required by "+propPath);
}
});
}else{
var errs = this.validateSchema(instance, dep, options, propPath);
if(errs&&errs.errors.length){
result.addError("does not meet dependency required by "+propPath);
result.importErrors(errs);
<<<<<<<
var self = this;
var result = new ValidatorResult(instance, schema, options, propertyName);
var types = (schema.disallow instanceof Array)?schema.disallow:[schema.disallow];
types.forEach(function(type){
if(self.testType(instance, schema, options, propertyName, type)){
var schemaId = type&&type.id&&('<'+type.id+'>') || type.toString();
result.addError("is of prohibited type " + schemaId);
}
});
return result;
=======
var types = (schema.disallow instanceof Array) ? schema.disallow : [schema.disallow];
if (types.some(testType.bind(this, instance, options, propertyName))) {
return "is of prohibited type " + schema.type;
}
return null;
>>>>>>>
var self = this;
var result = new ValidatorResult(instance, schema, options, propertyName);
var types = (schema.disallow instanceof Array)?schema.disallow:[schema.disallow];
types.forEach(function(type){
if(self.testType(instance, schema, options, propertyName, type)){
var schemaId = type&&type.id&&('<'+type.id+'>') || type.toString();
result.addError("is of prohibited type " + schemaId);
}
});
return result; |
<<<<<<<
describe("libjoynr-js.integration.end2end.datatypes", function() {
var datatypesProxy;
var abstractTest = new End2EndAbstractTest("End2EndDatatypesTest", "TestEnd2EndDatatypesProviderProcess");
=======
describe("libjoynr-js.integration.end2end.datatypes", () => {
let datatypesProxy;
const abstractTest = new End2EndAbstractTest("End2EndDatatypesTest", true);
>>>>>>>
describe("libjoynr-js.integration.end2end.datatypes", () => {
let datatypesProxy;
const abstractTest = new End2EndAbstractTest("End2EndDatatypesTest", "TestEnd2EndDatatypesProviderProcess"); |
<<<<<<<
=======
/**
* @name MessageRouter#route
* @function
*
* @param {JoynrMessage}
* joynrMessage
* @returns {Object} A+ promise object
*/
this.route =
function route(joynrMessage) {
var now = Date.now();
if (now > joynrMessage.expiryDate) {
var errorMsg = "Received expired message. Dropping the message. ID: " + joynrMessage.msgId;
log.warn(errorMsg + ", expiryDate: " + joynrMessage.expiryDate + ", now: " + now);
return Promise.reject(new JoynrRuntimeException({ detailMessage: errorMsg }));
}
log.debug("Route message. ID: " + joynrMessage.msgId + ", expiryDate: " + joynrMessage.expiryDate + ", now: " + now);
registerGlobalRoutingEntryIfRequired(joynrMessage);
function forwardToRouteInternal(address) {
return routeInternal(address, joynrMessage);
}
if (joynrMessage.type === JoynrMessage.JOYNRMESSAGE_TYPE_MULTICAST) {
return Promise.all(getAddressesForMulticast(joynrMessage).map(forwardToRouteInternal));
}
var participantId = joynrMessage.to;
var address = routingTable[participantId];
if (address !== undefined) {
return routeInternal(address, joynrMessage);
}
return resolveNextHopInternal(participantId).then(forwardToRouteInternal);
};
/**
* Registers the next hop with this specific participant Id
*
* @name RoutingTable#addNextHop
* @function
*
* @param {String}
* participantId
* @param {InProcessAddress|BrowserAddress|ChannelAddress}
* address the address to register
* @param {boolean}
* isGloballyVisible
*/
this.addNextHop =
function addNextHop(participantId, address, isGloballyVisible) {
if (!isReady()) {
log.debug("addNextHop: ignore call as message router is already shut down");
return Promise.reject(new Error("message router is already shut down"));
}
// store the address of the participantId persistently
routingTable[participantId] = address;
var serializedAddress = JSONSerializer.stringify(address);
var promise;
if (serializedAddress === undefined
|| serializedAddress === null || serializedAddress === "{}") {
log.info("addNextHop: HOP address "
+ serializedAddress
+ " will not be persisted for participant id: "
+ participantId);
} else {
persistency.setItem(
that.getStorageKey(participantId),
serializedAddress);
}
function parentResolver(resolve, reject){
queuedAddNextHopCalls[queuedAddNextHopCalls.length] =
{
participantId : participantId,
isGloballyVisible: isGloballyVisible,
resolve : resolve,
reject : reject
};
}
if (routingProxy !== undefined) {
// register remotely
promise = that.addNextHopToParentRoutingTable(participantId, isGloballyVisible);
} else if (parentMessageRouterAddress !== undefined) {
promise = new Promise(parentResolver);
} else {
promise = Promise.resolve();
}
that.participantRegistered(participantId);
return promise;
};
/**
* Adds a new receiver for the identified multicasts.
*
* @name RoutingTable#addMulticastReceiver
* @function
*
* @param {Object}
* parameters - object containing parameters
* @param {String}
* parameters.multicastId
* @param {String}
* parameters.subscriberParticipantId
* @param {String}
* parameters.providerParticipantId
*/
this.addMulticastReceiver = function addMulticastReceiver(parameters) {
//1. handle call in local router
//1.a store receiver in multicastReceiverRegistry
var multicastIdPattern = multicastWildcardRegexFactory.createIdPattern(parameters.multicastId);
var providerAddress = routingTable[parameters.providerParticipantId];
if (multicastReceiversRegistry[multicastIdPattern] === undefined) {
multicastReceiversRegistry[multicastIdPattern] = [];
//1.b the first receiver for this multicastId -> inform MessagingSkeleton about receiver
var skeleton = messagingSkeletonFactory.getSkeleton(providerAddress);
if (skeleton !== undefined && skeleton.registerMulticastSubscription !== undefined) {
skeleton.registerMulticastSubscription(parameters.multicastId);
}
}
multicastReceiversRegistry[multicastIdPattern].push(parameters.subscriberParticipantId);
//2. forward call to parent router (if available)
if (parentMessageRouterAddress === undefined || providerAddress === undefined || providerAddress instanceof InProcessAddress) {
return Promise.resolve();
}
if (routingProxy !== undefined) {
return routingProxy.addMulticastReceiver(parameters);
}
function addMulticastReceiverResolver(resolve, reject){
queuedAddMulticastReceiverCalls[queuedAddMulticastReceiverCalls.length] =
{
parameters: parameters,
resolve : resolve,
reject : reject
};
}
return new Promise(addMulticastReceiverResolver);
};
/**
* Removes a receiver for the identified multicasts.
*
* @name RoutingTable#removeMulticastReceiver
* @function
*
* @param {Object}
* parameters - object containing parameters
* @param {String}
* parameters.multicastId
* @param {String}
* parameters.subscriberParticipantId
* @param {String}
* parameters.providerParticipantId
*/
this.removeMulticastReceiver = function removeMulticastReceiver(parameters) {
//1. handle call in local router
//1.a remove receiver from multicastReceiverRegistry
var multicastIdPattern = multicastWildcardRegexFactory.createIdPattern(parameters.multicastId);
var providerAddress = routingTable[parameters.providerParticipantId];
if (multicastReceiversRegistry[multicastIdPattern] !== undefined) {
var i, receivers = multicastReceiversRegistry[multicastIdPattern];
for (i = 0; i < receivers.length; i++) {
if (receivers[i] === parameters.subscriberParticipantId) {
receivers.splice(i, 1);
break;
}
}
if (receivers.length === 0) {
delete multicastReceiversRegistry[multicastIdPattern];
//1.b no receiver anymore for this multicastId -> inform MessagingSkeleton about removed receiver
var skeleton = messagingSkeletonFactory.getSkeleton(providerAddress);
if (skeleton !== undefined && skeleton.unregisterMulticastSubscription !== undefined) {
skeleton.unregisterMulticastSubscription(parameters.multicastId);
}
}
}
//2. forward call to parent router (if available)
if (parentMessageRouterAddress === undefined || providerAddress === undefined || providerAddress instanceof InProcessAddress) {
return Promise.resolve();
}
if (routingProxy !== undefined) {
return routingProxy.removeMulticastReceiver(parameters);
}
function removeMulticastReceiverResolver(resolve, reject){
queuedRemoveMulticastReceiverCalls[queuedRemoveMulticastReceiverCalls.length] =
{
parameters: parameters,
resolve : resolve,
reject : reject
};
}
return new Promise(removeMulticastReceiverResolver);
};
/**
* @function MessageRouter#participantRegistered
*
* @param {String} participantId
*
* @returns {Promise} a Promise object
*/
this.participantRegistered =
function participantRegistered(participantId) {
var i, msgContainer, messageQueue =
settings.messageQueue.getAndRemoveMessages(participantId);
function handleError(error) {
log.error("queued message could not be sent to " + participantId + ", error: " + error
+ (error instanceof JoynrException ? " " + error.detailMessage : ""));
}
if (messageQueue !== undefined) {
i = messageQueue.length;
while (i--) {
try {
that.route(messageQueue[i])
.catch (handleError);
} catch (error) {
handleError(error);
}
}
}
};
/**
* Tell the message router that the given participantId is known. The message router
* checks internally if an address is already present in the routing table. If not,
* it adds the parentMessageRouterAddress to the routing table for this participantId.
* @function MessageRouter#setToKnown
*
* @param {String} participantId
*
* @returns void
*/
this.setToKnown = function setToKnown(participantId) {
if (!isReady()) {
log.debug("setToKnown: ignore call as message router is already shut down");
return;
}
//if not already set
if (routingTable[participantId] === undefined) {
if (parentMessageRouterAddress !== undefined) {
routingTable[participantId] = parentMessageRouterAddress;
}
}
};
this.hasMulticastReceivers = function() {
return Object.keys(multicastReceiversRegistry).length > 0;
};
/**
* Shutdown the message router
*
* @function
* @name MessageRouter#shutdown
*/
this.shutdown = function shutdown() {
function rejectCall(call) {
call.reject(new Error("Message Router has been shut down"));
}
if (queuedAddNextHopCalls !== undefined) {
queuedAddNextHopCalls.forEach(rejectCall);
queuedAddNextHopCalls = [];
}
if (queuedRemoveNextHopCalls !== undefined) {
queuedRemoveNextHopCalls.forEach(rejectCall);
queuedRemoveNextHopCalls = [];
}
if (queuedAddMulticastReceiverCalls !== undefined) {
queuedAddMulticastReceiverCalls.forEach(rejectCall);
queuedAddMulticastReceiverCalls = [];
}
if (queuedRemoveMulticastReceiverCalls !== undefined) {
queuedRemoveMulticastReceiverCalls.forEach(rejectCall);
queuedRemoveMulticastReceiverCalls = [];
}
started = false;
settings.messageQueue.shutdown();
};
>>>>>>> |
<<<<<<<
/*jslint es5: true, nomen: true */
=======
/*jslint es5: true, node: true, node: true */
>>>>>>>
/*jslint es5: true, nomen: true, node: true */
<<<<<<<
define(
"joynr/messaging/mqtt/SharedMqttClient",
[
"global/Promise",
"global/Mqtt",
"joynr/messaging/JoynrMessage",
"joynr/messaging/MessagingQosEffort",
"joynr/util/JSONSerializer",
"joynr/util/LongTimer",
"joynr/util/Typing",
"joynr/system/LoggerFactory"
],
function(Promise, Mqtt, JoynrMessage, MessagingQosEffort, JSONSerializer, LongTimer, Typing, LoggerFactory) {
var log = LoggerFactory.getLogger("joynr.messaging.mqtt.SharedMqttClient");
/**
* @param {mqtt}
* client to use for sending messages
* @param {Array}
* queuedMessages
*/
function sendQueuedMessages(client, queuedMessages) {
var queued, topic;
while (queuedMessages.length) {
queued = queuedMessages.shift();
try {
client.publish(queued.topic, JSONSerializer.stringify(queued.message), queued.options);
queued.resolve();
// Error is thrown if the connection is no longer open
} catch (e) {
// so add the message back to the front of the queue
queuedMessages.unshift(queued);
throw e;
=======
var Promise = require('../../../global/Promise');
var Mqtt = require('../../../global/Mqtt');
var JoynrMessage = require('../JoynrMessage');
var MessagingQosEffort = require('../MessagingQosEffort');
var JsonSerializer = require('../../util/JSONSerializer');
var LongTimer = require('../../util/LongTimer');
var Typing = require('../../util/Typing');
var LoggerFactory = require('../../system/LoggerFactory');
module.exports = (function (Promise, Mqtt, JoynrMessage, MessagingQosEffort, JSONSerializer, LongTimer, Typing, LoggerFactory) {
var log = LoggerFactory.getLogger("joynr.messaging.mqtt.SharedMqttClient");
/**
* @param {mqtt}
* client to use for sending messages
* @param {Array}
* queuedMessages
*/
function sendQueuedMessages(client, queuedMessages) {
var queued, topic;
while (queuedMessages.length) {
queued = queuedMessages.shift();
try {
client.publish(queued.topic, JSONSerializer.stringify(queued.message), queued.options);
queued.resolve();
// Error is thrown if the connection is no longer open
} catch (e) {
// so add the message back to the front of the queue
queuedMessages.unshift(queued);
throw e;
}
>>>>>>>
var Promise = require('../../../global/Promise');
var Mqtt = require('../../../global/Mqtt');
var JoynrMessage = require('../JoynrMessage');
var MessagingQosEffort = require('../MessagingQosEffort');
var JsonSerializer = require('../../util/JSONSerializer');
var LongTimer = require('../../util/LongTimer');
var Typing = require('../../util/Typing');
var LoggerFactory = require('../../system/LoggerFactory');
module.exports = (function (Promise, Mqtt, JoynrMessage, MessagingQosEffort, JSONSerializer, LongTimer, Typing, LoggerFactory) {
var log = LoggerFactory.getLogger("joynr.messaging.mqtt.SharedMqttClient");
/**
* @param {mqtt}
* client to use for sending messages
* @param {Array}
* queuedMessages
*/
function sendQueuedMessages(client, queuedMessages) {
var queued, topic;
while (queuedMessages.length) {
queued = queuedMessages.shift();
try {
client.publish(queued.topic, JSONSerializer.stringify(queued.message), queued.options);
queued.resolve();
// Error is thrown if the connection is no longer open
} catch (e) {
// so add the message back to the front of the queue
queuedMessages.unshift(queued);
throw e;
<<<<<<<
return SharedMqttClient;
});
=======
/**
* @name SharedMqttClient
* @constructor
* @param {Object}
* settings
* @param {MqttAddress}
* settings.address to be used to connect to mqtt broker
*/
var SharedMqttClient =
function SharedMqttClient(settings) {
Typing.checkProperty(settings, "Object", "settings");
Typing.checkProperty(
settings.address,
"MqttAddress",
"settings.address");
var client = null;
var address = settings.address;
var onmessageCallback = null;
var queuedMessages = [];
var onOpen;
var resolve;
var closed = false;
var connected = false;
var onConnectedPromise = new Promise(function(resolveTrigger) {
resolve = resolveTrigger;
});
var qosLevel = SharedMqttClient.DEFAULT_QOS_LEVEL;
if (settings.provisioning.qosLevel !== undefined) {
qosLevel = settings.provisioning.qosLevel;
}
var queuedSubscriptions = [];
var queuedUnsubscriptions = [];
var onMessage = function(topic, payload) {
if (onmessageCallback !== undefined) {
onmessageCallback(topic, new JoynrMessage(JSON.parse(payload.toString())));
}
};
var resetConnection = function resetConnection() {
if (closed) {
return;
}
client = new Mqtt.connect(address.brokerUri);
client.on('connect', onOpen);
client.on('message', onMessage);
};
this.onConnected = function() {
return onConnectedPromise;
};
// send all queued messages, requeuing to the front in case of a problem
onOpen = function onOpen() {
try {
connected = true;
sendQueuedMessages(client, queuedMessages);
sendQueuedUnsubscriptions(client, queuedUnsubscriptions);
sendQueuedSubscriptions(client, queuedSubscriptions, qosLevel).then(resolve);
} catch (e) {
resetConnection();
}
};
resetConnection();
/**
* @name SharedMqttClient#send
* @function
* @param {String}
* topic the topic to publish the message
* @param {JoynrMessage}
* joynrMessage the joynr message to transmit
*/
this.send = function send(topic, joynrMessage) {
var sendQosLevel = qosLevel;
if (MessagingQosEffort.BEST_EFFORT === joynrMessage.effort) {
sendQosLevel = SharedMqttClient.BEST_EFFORT_QOS_LEVEL;
}
return sendMessage(client, topic, joynrMessage, sendQosLevel, queuedMessages).catch(function(e1) {
resetConnection();
});
};
/**
* @name SharedMqttClient#close
* @function
*/
this.close = function close() {
closed = true;
if (client !== null && client.end) {
client.end();
}
};
this.subscribe = function(topic) {
if (connected) {
client.subscribe(topic, { qos : qosLevel} );
} else {
queuedSubscriptions.push(topic);
}
};
this.unsubscribe = function(topic) {
if (connected) {
client.unsubscribe(topic);
} else {
queuedUnsubscriptions.push(topic);
}
};
// using the defineProperty syntax for onmessage to be able to keep
// the same API as WebSocket but have a setter function called when
// the attribute is set.
Object.defineProperty(this, "onmessage", {
set : function(newCallback) {
onmessageCallback = newCallback;
if (typeof newCallback !== "function") {
throw new Error(
"onmessage callback must be a function, but instead was of type "
+ typeof newCallback);
}
},
get : function() {
return onmessageCallback;
},
enumerable : false,
configurable : false
});
};
SharedMqttClient.DEFAULT_QOS_LEVEL = 1;
SharedMqttClient.BEST_EFFORT_QOS_LEVEL = 0;
return SharedMqttClient;
}(Promise, Mqtt, JoynrMessage, MessagingQosEffort, JsonSerializer, LongTimer, Typing, LoggerFactory));
>>>>>>>
return SharedMqttClient;
}(Promise, Mqtt, JoynrMessage, MessagingQosEffort, JsonSerializer, LongTimer, Typing, LoggerFactory)); |
<<<<<<<
/*jslint es5: true, nomen: true */
=======
/*jslint node: true */
>>>>>>>
/*jslint es5: true, nomen: true, node: true */ |
<<<<<<<
// because the generated code uses require('joynr') without knowing the location, will work only
// when joynr is a submodule and is placed inside node_modules folder. In order to emulate this
// behavior the require function is adapted here in order to always return the correct joynr while
// running tests.
var mod = require("module");
var joynr = require("../classes/joynr");
var path = require("path");
var req = mod.prototype.require;
mod.prototype.require = function(md) {
if (md === "joynr") {
return joynr;
}
// mock localStorage
if (md.endsWith("LocalStorageNode")) {
var appDir = path.dirname(require.main.filename);
return req.call(this, appDir + "/node_integration/LocalStorageMock.js");
}
if (
md.startsWith("joynr/vehicle") ||
md.startsWith("joynr/datatypes") ||
md.startsWith("joynr/tests") ||
md.startsWith("joynr/provisioning")
) {
return req.call(this, "../" + md);
}
if (md.startsWith("joynr")) {
return req.call(this, "../../classes/" + md);
}
if (md === "joynr/Runtime") {
return req.call(this, "joynr/Runtime.inprocess");
}
return req.apply(this, arguments);
};
console.log("require config setup");
var CompatibleProvidersTest = require("../test-classes/node_integration/CompatibleProvidersTest.js");
var End2EndRPCTest = require("../test-classes/node_integration/End2EndRPCTest.js");
var End2EndSubscriptionTest = require("../test-classes/node_integration/End2EndSubscriptionTest.js");
var End2EndDatatypesTest = require("../test-classes/node_integration/End2EndDatatypesTest.js");
var IncompatibleProviderTest = require("../test-classes/node_integration/IncompatibleProviderTest.js");
var LocalDiscoveryTest = require("../test-classes/node_integration/LocalDiscoveryTest");
=======
>>>>>>> |
<<<<<<<
/*jslint es5: true, nomen: true */
=======
/*jslint es5: true, node: true, node: true */
>>>>>>>
/*jslint es5: true, nomen: true, node: true */
<<<<<<<
define(
"joynr/messaging/channel/LongPollingChannelMessageReceiver",
[
"global/Promise",
"uuid",
"joynr/messaging/JoynrMessage",
"JsonParser",
"joynr/messaging/MessagingQos",
"joynr/system/DiagnosticTags",
"joynr/system/LoggerFactory",
"joynr/util/UtilInternal",
"joynr/util/LongTimer"
],
function(
Promise,
uuid,
JoynrMessage,
JsonParser,
MessagingQos,
DiagnosticTags,
LoggerFactory,
Util,
LongTimer) {
var log = LoggerFactory.getLogger("joynr.messaging.LongPollingChannelMessageReceiver");
var storagePrefix = "joynr.channels";
/**
* LongPollingChannelMessageReceiver handles the long poll to the bounce proxy.
*
* @name LongPollingChannelMessageReceiver
* @constructor
*
* @param {Object}
* settings an object containing required input for LongPollingChannelMessageReceiver
* @param {String}
* settings.bounceProxyUrl an object describing the bounce proxy URL
* @param {CommunicationModule}
* settings.communicationModule the API required by the LongPollingChannelMessageReceiver to perform XMLHTTPRequests
* socket communication
* @param {Object}
* settings.channelQos parameters specifying the qos requirements for the channel (creation)
* @param {Number}
* settings.channelQos.creationTimeout_ms max time to create a channel
* @param {Number}
* settings.channelQos.creationRetryDelay_ms retry interval after a failing channel creation
*
* @returns the LongPollingChannelMessageReceiver
*/
function LongPollingChannelMessageReceiver(settings) {
this._persistency = settings.persistency;
this._channelOpMessagingQos = new MessagingQos();
this._communicationModule = settings.communicationModule;
this._bounceProxyChannelBaseUrl = settings.bounceProxyUrl + "channels/";
this._channelCreationTimeout_ms = settings.channelQos && settings.channelQos.creationTimeout_ms ? settings.channelQos.creationTimeout_ms : 1000 * 60 * 60 * 24; // default: 1 day
this._channelCreationRetryDelay_ms = settings.channelQos && settings.channelQos.creationRetryDelay_ms ? settings.channelQos.creationRetryDelay_ms : 1000 * 30; // default: 30s
}
/**
* Retrieve the receiverId for the given channelId
*
* @name LongPollingChannelMessageReceiver#getReceiverId
* @function
* @private
*/
LongPollingChannelMessageReceiver.prototype._getReceiverId = function(channelId) {
var receiverId =
this._persistency.getItem(storagePrefix + "." + channelId + ".receiverId");
if (receiverId === undefined || receiverId === null) {
receiverId = "tid-" + uuid();
this._persistency.setItem(
storagePrefix + "." + channelId + ".receiverId",
receiverId);
}
return receiverId;
};
LongPollingChannelMessageReceiver.prototype._callCreate = function callCreate(){
var that = this;
var createChannelUrl = this._bounceProxyChannelBaseUrl
+ "?ccid="
+ encodeURIComponent(this._channelId);
var receiverId = this._getReceiverId(this._channelId);
function callCreateOnSuccess(xhr) {
that._channelUrl = xhr.getResponseHeader("Location");
if (!that._channelUrl) {
that._channelUrl = xhr.responseText;
=======
var Promise = require('../../../global/Promise');
var uuid = require('../../../lib/uuid-annotated');
var JoynrMessage = require('../JoynrMessage');
var JsonParser = require('../../../lib/JsonParser');
var MessagingQos = require('../MessagingQos');
var DiagnosticTags = require('../../system/DiagnosticTags');
var LoggerFactory = require('../../system/LoggerFactory');
var UtilInternal = require('../../util/UtilInternal');
var LongTimer = require('../../util/LongTimer');
module.exports = (function (Promise, uuid, JoynrMessage, JsonParser, MessagingQos, DiagnosticTags, LoggerFactory, Util, LongTimer) {
/**
* LongPollingChannelMessageReceiver handles the long poll to the bounce proxy.
*
* @name LongPollingChannelMessageReceiver
* @constructor
*
* @param {Object}
* settings an object containing required input for LongPollingChannelMessageReceiver
* @param {String}
* settings.bounceProxyUrl an object describing the bounce proxy URL
* @param {CommunicationModule}
* settings.communicationModule the API required by the LongPollingChannelMessageReceiver to perform XMLHTTPRequests
* socket communication
* @param {Object}
* settings.channelQos parameters specifying the qos requirements for the channel (creation)
* @param {Number}
* settings.channelQos.creationTimeout_ms max time to create a channel
* @param {Number}
* settings.channelQos.creationRetryDelay_ms retry interval after a failing channel creation
*
* @returns the LongPollingChannelMessageReceiver
*/
function LongPollingChannelMessageReceiver(settings) {
var storagePrefix = "joynr.channels";
var persistency = settings.persistency;
var onReceive;
var channelOpMessagingQos = new MessagingQos();
var channelId, channelUrl;
var communicationModule = settings.communicationModule;
var log = LoggerFactory.getLogger("joynr.messaging.LongPollingChannelMessageReceiver");
var bounceProxyChannelBaseUrl = settings.bounceProxyUrl + "channels/";
var channelCreationTimeout_ms = settings.channelQos && settings.channelQos.creationTimeout_ms ? settings.channelQos.creationTimeout_ms : 1000*60*60*24; // default: 1 day
var channelCreationRetryDelay_ms = settings.channelQos && settings.channelQos.creationRetryDelay_ms ? settings.channelQos.creationRetryDelay_ms : 1000*30; // default: 30s
var createChannelTimestamp;
/**
* Retrieve the receiverId for the given channelId
*
* @name LongPollingChannelMessageReceiver#getReceiverId
* @function
* @private
*/
function getReceiverId(channelId) {
var receiverId =
persistency.getItem(storagePrefix + "." + channelId + ".receiverId");
if (receiverId === undefined || receiverId === null) {
receiverId = "tid-" + uuid();
persistency.setItem(
storagePrefix + "." + channelId + ".receiverId",
receiverId);
}
return receiverId;
>>>>>>>
var Promise = require('../../../global/Promise');
var uuid = require('../../../lib/uuid-annotated');
var JoynrMessage = require('../JoynrMessage');
var JsonParser = require('../../../lib/JsonParser');
var MessagingQos = require('../MessagingQos');
var DiagnosticTags = require('../../system/DiagnosticTags');
var LoggerFactory = require('../../system/LoggerFactory');
var UtilInternal = require('../../util/UtilInternal');
var LongTimer = require('../../util/LongTimer');
module.exports = (function (Promise, uuid, JoynrMessage, JsonParser, MessagingQos, DiagnosticTags, LoggerFactory, Util, LongTimer) {
var log = LoggerFactory.getLogger("joynr.messaging.LongPollingChannelMessageReceiver");
var storagePrefix = "joynr.channels";
/**
* LongPollingChannelMessageReceiver handles the long poll to the bounce proxy.
*
* @name LongPollingChannelMessageReceiver
* @constructor
*
* @param {Object}
* settings an object containing required input for LongPollingChannelMessageReceiver
* @param {String}
* settings.bounceProxyUrl an object describing the bounce proxy URL
* @param {CommunicationModule}
* settings.communicationModule the API required by the LongPollingChannelMessageReceiver to perform XMLHTTPRequests
* socket communication
* @param {Object}
* settings.channelQos parameters specifying the qos requirements for the channel (creation)
* @param {Number}
* settings.channelQos.creationTimeout_ms max time to create a channel
* @param {Number}
* settings.channelQos.creationRetryDelay_ms retry interval after a failing channel creation
*
* @returns the LongPollingChannelMessageReceiver
*/
function LongPollingChannelMessageReceiver(settings) {
this._persistency = settings.persistency;
this._channelOpMessagingQos = new MessagingQos();
this._communicationModule = settings.communicationModule;
this._bounceProxyChannelBaseUrl = settings.bounceProxyUrl + "channels/";
this._channelCreationTimeout_ms = settings.channelQos && settings.channelQos.creationTimeout_ms ? settings.channelQos.creationTimeout_ms : 1000 * 60 * 60 * 24; // default: 1 day
this._channelCreationRetryDelay_ms = settings.channelQos && settings.channelQos.creationRetryDelay_ms ? settings.channelQos.creationRetryDelay_ms : 1000 * 30; // default: 30s
}
/**
* Retrieve the receiverId for the given channelId
*
* @name LongPollingChannelMessageReceiver#getReceiverId
* @function
* @private
*/
LongPollingChannelMessageReceiver.prototype._getReceiverId = function(channelId) {
var receiverId =
this._persistency.getItem(storagePrefix + "." + channelId + ".receiverId");
if (receiverId === undefined || receiverId === null) {
receiverId = "tid-" + uuid();
this._persistency.setItem(
storagePrefix + "." + channelId + ".receiverId",
receiverId);
}
return receiverId;
};
LongPollingChannelMessageReceiver.prototype._callCreate = function callCreate(){
var that = this;
var createChannelUrl = this._bounceProxyChannelBaseUrl
+ "?ccid="
+ encodeURIComponent(this._channelId);
var receiverId = this._getReceiverId(this._channelId);
function callCreateOnSuccess(xhr) {
that._channelUrl = xhr.getResponseHeader("Location");
if (!that._channelUrl) {
that._channelUrl = xhr.responseText;
<<<<<<<
this._channelId = theChannelId;
this._createChannelTimestamp = Date.now();
function _channelCreationRetryHandler(resolve, reject) {
LongTimer.setTimeout(that._createInternal.bind(that), that._channelCreationRetryDelay_ms, resolve, reject);
}
function _callCreateOnError (xhr, errorType) {
that._logChannelCreationError(xhr);
if (that._createChannelTimestamp + that._channelCreationTimeout_ms <= Date.now()) {
throw new Error("Error creating channel");
} else {
return new Promise(_channelCreationRetryHandler);
}
}
return this._callCreate().catch(_callCreateOnError);
};
return LongPollingChannelMessageReceiver;
});
=======
return LongPollingChannelMessageReceiver;
}(Promise, uuid, JoynrMessage, JsonParser, MessagingQos, DiagnosticTags, LoggerFactory, UtilInternal, LongTimer));
>>>>>>>
this._channelId = theChannelId;
this._createChannelTimestamp = Date.now();
function _channelCreationRetryHandler(resolve, reject) {
LongTimer.setTimeout(that._createInternal.bind(that), that._channelCreationRetryDelay_ms, resolve, reject);
}
function _callCreateOnError (xhr, errorType) {
that._logChannelCreationError(xhr);
if (that._createChannelTimestamp + that._channelCreationTimeout_ms <= Date.now()) {
throw new Error("Error creating channel");
} else {
return new Promise(_channelCreationRetryHandler);
}
}
return this._callCreate().catch(_callCreateOnError);
};
return LongPollingChannelMessageReceiver;
}(Promise, uuid, JoynrMessage, JsonParser, MessagingQos, DiagnosticTags, LoggerFactory, UtilInternal, LongTimer)); |
<<<<<<<
/*jslint es5: true, nomen: true */
=======
/*jslint node: true */
>>>>>>>
/*jslint es5: true, nomen: true, node: true */ |
<<<<<<<
/*jslint es5: true, nomen: true */
=======
/*jslint node: true */
>>>>>>>
/*jslint es5: true, nomen: true, node: true */
<<<<<<<
define("joynr/capabilities/CapabilitiesRegistrar", [
"global/Promise",
"joynr/util/UtilInternal",
"joynr/types/DiscoveryEntry",
"joynr/types/ProviderScope",
"joynr/capabilities/ParticipantIdStorage",
"joynr/types/Version"
], function(Promise, Util, DiscoveryEntry, ProviderScope, ParticipantIdStorage, Version) {
var ONE_DAY_MS = 24 * 60 * 60 * 1000;
=======
var Promise = require('../../global/Promise');
var UtilInternal = require('../util/UtilInternal');
var DiscoveryEntry = require('../../joynr/types/DiscoveryEntry');
var ProviderScope = require('../../joynr/types/ProviderScope');
var ParticipantIdStorage = require('./ParticipantIdStorage');
var Version = require('../../joynr/types/Version');
module.exports =
(function(Promise, Util, DiscoveryEntry, ProviderScope, ParticipantIdStorage, Version) {
var defaultExpiryIntervalMs = 6 * 7 * 24 * 60 * 60 * 1000; // 6 Weeks
>>>>>>>
var Promise = require('../../global/Promise');
var UtilInternal = require('../util/UtilInternal');
var DiscoveryEntry = require('../../joynr/types/DiscoveryEntry');
var ProviderScope = require('../../joynr/types/ProviderScope');
var ParticipantIdStorage = require('./ParticipantIdStorage');
var Version = require('../../joynr/types/Version');
module.exports =
(function(Promise, Util, DiscoveryEntry, ProviderScope, ParticipantIdStorage, Version) {
var defaultExpiryIntervalMs = 6 * 7 * 24 * 60 * 60 * 1000; // 6 Weeks
<<<<<<<
// if provider has at least one attribute, add it as publication provider
this._publicationManager.addPublicationProvider(participantId, provider);
=======
// register routing address at routingTable
var isGloballyVisible = providerQos.scope === ProviderScope.GLOBAL;
var messageRouterPromise =
messageRouter.addNextHop(
participantId,
libjoynrMessagingAddress,
isGloballyVisible);
>>>>>>>
// if provider has at least one attribute, add it as publication provider
this._publicationManager.addPublicationProvider(participantId, provider);
<<<<<<<
function registerProviderFinished() {
return participantId;
}
=======
var discoveryStubPromise = discoveryStub.add(new DiscoveryEntry({
providerVersion : new Version({
majorVersion : provider.constructor.MAJOR_VERSION,
minorVersion : provider.constructor.MINOR_VERSION
}),
domain : domain,
interfaceName : provider.interfaceName,
participantId : participantId,
qos : providerQos,
publicKeyId : defaultPublicKeyId,
expiryDateMs : expiryDateMs || Date.now() + defaultExpiryIntervalMs,
lastSeenDateMs : Date.now()
}));
>>>>>>>
function registerProviderFinished() {
return participantId;
} |
<<<<<<<
'site-connection-lost',
this.receiveSiteConnectionLost.bind(this)
=======
'site-did-lose-connection',
this.receiveDisconnectSite.bind(this)
>>>>>>>
'site-did-lose-connection',
this.receiveSiteConnectionLost.bind(this)
<<<<<<<
'site-connection-lost',
this.receiveSiteConnectionLost.bind(this)
)
}
subscribeToSiteDidLeaveEvents () {
return this.pubSubGateway.subscribe(
`/portals/${this.id}`,
'site-did-leave',
this.receiveSiteDidLeave.bind(this)
=======
'site-did-lose-connection',
this.receiveDisconnectSite.bind(this)
>>>>>>>
'site-did-lose-connection',
this.receiveSiteConnectionLost.bind(this)
)
}
subscribeToSiteDidLeaveEvents () {
return this.pubSubGateway.subscribe(
`/portals/${this.id}`,
'site-did-leave',
this.receiveSiteDidLeave.bind(this) |
<<<<<<<
this.router.notify({channelId: `/portals/${this.id}`, body: updateMessage.serializeBinary()})
=======
getLocalActiveEditorProxy () {
return this.activeEditorProxyForSiteId(this.siteId)
}
activeEditorProxyForSiteId (siteId) {
const leaderId = this.resolveLeaderSiteId(siteId)
const followState = this.resolveFollowState(siteId)
if (followState === FollowState.RETRACTED) {
return this.activeEditorProxiesBySiteId.get(leaderId)
} else {
return this.activeEditorProxiesBySiteId.get(siteId)
>>>>>>>
getLocalActiveEditorProxy () {
return this.activeEditorProxyForSiteId(this.siteId)
}
activeEditorProxyForSiteId (siteId) {
const leaderId = this.resolveLeaderSiteId(siteId)
const followState = this.resolveFollowState(siteId)
if (followState === FollowState.RETRACTED) {
return this.activeEditorProxiesBySiteId.get(leaderId)
} else {
return this.activeEditorProxiesBySiteId.get(siteId)
<<<<<<<
async receiveUpdate ({body}) {
const updateMessage = Messages.PortalUpdate.deserializeBinary(body)
=======
async receiveUpdate ({senderId, message}) {
const updateMessage = Messages.PortalUpdate.deserializeBinary(message)
>>>>>>>
async receiveUpdate ({senderId, body}) {
const updateMessage = Messages.PortalUpdate.deserializeBinary(body)
<<<<<<<
if (bufferProxyId && !this.bufferProxiesById.has(bufferProxyId)) {
const response = await this.router.request({recipientId: this.hostPeerId, channelId: `/buffers/${bufferProxyId}`})
if (!response.ok) return
const bufferProxyMessage = Messages.BufferProxy.deserializeBinary(response.body)
this.deserializeBufferProxy(bufferProxyMessage)
}
=======
>>>>>>>
<<<<<<<
let editorProxy = this.editorProxiesById.get(editorProxyId)
if (editorProxyId && !this.editorProxiesById.has(editorProxyId)) {
const response = await this.router.request({recipientId: this.hostPeerId, channelId: `/editors/${editorProxyId}`})
if (!response.ok) return
=======
>>>>>>> |
<<<<<<<
=======
var workers = [];
>>>>>>>
var workers = [];
<<<<<<<
=======
var killer = function() {
log('exiting.');
for(var i in workers) {
var worker = workers[i];
worker.removeAllListeners(); // Prevent from master respawn
try {
worker.kill();
} catch(excep) {
// do nothing, as the error is probably that the process does no longer exist
}
}
workers = [];
netBinding.close(server_socket);
process.removeAllListeners();
process.nextTick(function() {
process.exit();
});
}
>>>>>>>
var killer = function() {
log('exiting.');
for(var i in workers) {
var worker = workers[i];
worker.removeAllListeners(); // Prevent from master respawn
try {
worker.kill();
} catch(excep) {
// do nothing, as the error is probably that the process does no longer exist
}
}
workers = [];
netBinding.close(server_socket);
process.removeAllListeners();
process.nextTick(function() {
process.exit();
});
}
<<<<<<<
process.on('SIGINT', stop);
process.on('SIGHUP', stop);
process.on('SIGTERM', stop);
=======
process.on('SIGINT', killer);
process.on('SIGHUP', killer);
process.on('SIGTERM', killer);
>>>>>>>
process.on('SIGINT', killer);
process.on('SIGHUP', killer);
process.on('SIGTERM', killer);
<<<<<<<
=======
>>>>>>> |
<<<<<<<
import withFirebaseAuth from "react-with-firebase-auth";
import * as firebaseApp from "firebase/app";
import 'firebase/auth';
import CloseIcon from '@material-ui/icons/Close';
=======
import { isMapsApiEnabled } from '../featureFlags.js';
>>>>>>>
import { isMapsApiEnabled } from '../featureFlags.js';
import CloseIcon from '@material-ui/icons/Close';
<<<<<<<
setEntries(value.docs.map(doc => ({...doc.data().d, id: doc.id})));
=======
setEntries(value.docs.map(doc => ({ ...doc.data().d, id: doc.id })));
setFilteredEntries(value.docs.map(doc => ({ ...doc.data().d, id: doc.id })));
>>>>>>>
setEntries(value.docs.map(doc => ({...doc.data().d, id: doc.id})));
setFilteredEntries(value.docs.map(doc => ({ ...doc.data().d, id: doc.id })));
<<<<<<<
geocodeByAddress(address)
.then(results => getLatLng(results[0]))
.then(coordinates => {
const query = geocollection.near({
center: new fb.app.firestore.GeoPoint(coordinates.lat, coordinates.lng),
radius: 30
});
query.get().then((value) => {
// All GeoDocument returned by GeoQuery, like the GeoDocument added above
console.log(value.docs)
setEntries(value.docs.map(doc => ({...doc.data(), id: doc.id})));
setSearchCompleted(true);
});
})
.catch(error => console.error('Error', error));
=======
if (isMapsApiEnabled) {
geocodeByAddress(address)
.then(results => getLatLng(results[0]))
.then(coordinates => {
const query = geocollection.near({ center: new fb.app.firestore.GeoPoint(coordinates.lat, coordinates.lng), radius: 30 });
query.get().then((value) => {
// All GeoDocument returned by GeoQuery, like the GeoDocument added above
console.log(value.docs[0].data())
setEntries(value.docs.map(doc => ({ ...doc.data(), id: doc.id })));
setFilteredEntries(value.docs.map(doc => ({ ...doc.data(), id: doc.id })));
setSearchCompleted(true);
});
})
.catch(error => console.error('Error', error));
}
>>>>>>>
if (isMapsApiEnabled) {
geocodeByAddress(address)
.then(results => getLatLng(results[0]))
.then(coordinates => {
const query = geocollection.near({ center: new fb.app.firestore.GeoPoint(coordinates.lat, coordinates.lng), radius: 30 });
query.get().then((value) => {
// All GeoDocument returned by GeoQuery, like the GeoDocument added above
console.log(value.docs[0].data())
setEntries(value.docs.map(doc => ({ ...doc.data(), id: doc.id })));
setFilteredEntries(value.docs.map(doc => ({ ...doc.data(), id: doc.id })));
setSearchCompleted(true);
});
})
.catch(error => console.error('Error', error));
}
<<<<<<<
<div className="pt-3">
<LocationInput onChange={setLocation} value={location} onSelect={handleSelect}/>
=======
<div className="py-3">
<LocationInput onChange={handleChange} value={location} onSelect={handleSelect}/>
>>>>>>>
<div className="pt-3">
<LocationInput onChange={handleChange} value={location} onSelect={handleSelect}/>
<<<<<<<
<NotifyMe location={location}/>
{entries.length === 0 ? <NoHelpNeeded /> : entries.map(entry => (
<Entry key={entry.id} {...entry}/>))}
=======
{entries.length === 0 ? (!searchCompleted || location.length === 0 ?
<span>Bitte gib deinen Standort ein.</span> :
<span className="my-5 font-open-sans text-gray-800">In {location} gibt es aktuell keine Anfragen.</span>) : filteredEntries.map(
entry => (<Entry key={entry.id} {...entry}/>))}
>>>>>>>
<NotifyMe location={location}/>
{entries.length === 0 ? <NoHelpNeeded /> : filteredEntries.map(
entry => (
<Entry key={entry.id} {...entry}/>))} |
<<<<<<<
var stampit = require('stampit')
var ModbusServerCore = require('./modbus-server-core.js')
var StateMachine = require('stampit-state-machine')
var net = require('net')
var ClientSocket = require('./modbus-tcp-server-client.js')
=======
'use strict'
var stampit = require('stampit')
var ModbusServerCore = require('./modbus-server-core.js')
var StateMachine = require('stampit-state-machine')
var net = require('net')
>>>>>>>
'use strict'
var stampit = require('stampit')
var ModbusServerCore = require('./modbus-server-core.js')
var StateMachine = require('stampit-state-machine')
var net = require('net')
var ClientSocket = require('./modbus-tcp-server-client.js')
<<<<<<<
.compose(ModbusServerCore)
.compose(StateMachine)
.init(function () {
let server
let socketCount = 0
let socketList = []
let fifo = []
let clients = []
let init = function () {
if (!this.port) {
this.port = 502;
}
if (!this.hostname) {
this.hostname = '0.0.0.0';
}
server = net.createServer();
server.on('connection', function (s) {
this.log.debug('new connection', s.address());
clients.push(s);
initiateSocket(s);
}.bind(this));
server.listen(this.port, this.hostname, function (err) {
if (err) {
this.log.debug('error while listening', err);
this.emit('error', err);
return;
}
}.bind(this));
this.log.debug('server is listening on port', this.hostname + ':' + this.port);
this.on('newState_ready', flush);
this.setState('ready');
}.bind(this);
var flush = function () {
if (this.inState('processing')) {
return;
}
if (fifo.length === 0) {
return;
}
this.setState('processing');
var current = fifo.shift();
this.onData(current.pdu, function (response) {
this.log.debug('sending tcp data');
var head = Buffer.allocUnsafe(7);
head.writeUInt16BE(current.request.trans_id, 0);
head.writeUInt16BE(current.request.protocol_ver, 2);
head.writeUInt16BE(response.length + 1, 4);
head.writeUInt8(current.request.unit_id, 6);
var pkt = Buffer.concat([head, response]);
current.socket.write(pkt);
this.setState('ready');
}.bind(this));
}.bind(this);
var initiateSocket = function (socket) {
socketCount += 1
let socketId = socketList.length
let request_handler = function (req) {
fifo.push(req);
flush();
}
let remove_handler = function () {
socketList[socketId] = undefined
/* remove undefined on the end of the array */
for (let i = socketList.length - 1; i >= 0; i -= 1) {
let cur = socketList[i];
if (cur !== undefined)
break
socketList.splice(i, 1);
}
console.log(socketList)
}
let client_socket = ClientSocket({
socket: socket,
socketId: socketId,
onRequest: request_handler,
onEnd: remove_handler
})
socketList.push(client_socket)
}.bind(this);
this.close = function (cb) {
for(var c in clients) {
clients[c].destroy();
}
server.close(function() {
server.unref();
if(cb) { cb(); }
});
};
init();
});
=======
.compose(ModbusServerCore)
.compose(StateMachine)
.init(function () {
var server
var socketCount = 0
var fifo = []
var clients = []
var init = function () {
if (!this.port) {
this.port = 502
}
if (!this.hostname) {
this.hostname = '0.0.0.0'
}
server = net.createServer()
server.on('connection', function (s) {
this.log.debug('new connection', s.address())
clients.push(s)
initiateSocket(s)
}.bind(this))
server.listen(this.port, this.hostname, function (err) {
if (err) {
this.log.debug('error while listening', err)
this.emit('error', err)
return
}
}.bind(this))
this.log.debug('server is listening on port', this.hostname + ':' + this.port)
this.on('newState_ready', flush)
this.setState('ready')
}.bind(this)
var onSocketEnd = function (socket, socketId) {
return function () {
this.log.debug('connection closed, socket', socketId)
}.bind(this)
}.bind(this)
var onSocketData = function (socket, socketId) {
return function (data) {
this.log.debug('received data socket', socketId, data.byteLength)
// 1. extract mbap
var mbap = data.slice(0, 0 + 7)
var len = mbap.readUInt16BE(4)
var request = {
trans_id: mbap.readUInt16BE(0),
protocol_ver: mbap.readUInt16BE(2),
unit_id: mbap.readUInt8(6)
}
// 2. extract pdu
var pdu = data.slice(7, 7 + len - 1)
// emit data event and let the
// listener handle the pdu
fifo.push({ request: request, pdu: pdu, socket: socket })
flush()
}.bind(this)
}.bind(this)
var flush = function () {
if (this.inState('processing')) {
return
}
if (fifo.length === 0) {
return
}
this.setState('processing')
var current = fifo.shift()
this.onData(current.pdu, function (response) {
this.log.debug('sending tcp data')
var head = Buffer.allocUnsafe(7)
head.writeUInt16BE(current.request.trans_id, 0)
head.writeUInt16BE(current.request.protocol_ver, 2)
head.writeUInt16BE(response.length + 1, 4)
head.writeUInt8(current.request.unit_id, 6)
var pkt = Buffer.concat([head, response])
current.socket.write(pkt)
this.setState('ready')
}.bind(this))
}.bind(this)
var onSocketError = function (socket, socketCount) {
return function (e) {
this.logError('Socker error', e)
}.bind(this)
}.bind(this)
var initiateSocket = function (socket) {
socketCount += 1
socket.on('end', onSocketEnd(socket, socketCount))
socket.on('data', onSocketData(socket, socketCount))
socket.on('error', onSocketError(socket, socketCount))
}
this.close = function (cb) {
for (var c in clients) {
clients[c].destroy()
}
server.close(function () {
server.unref()
if (cb) { cb() }
})
}
init()
})
>>>>>>>
.compose(ModbusServerCore)
.compose(StateMachine)
.init(function () {
let server
let socketCount = 0
let socketList = []
let fifo = []
let clients = []
let init = function () {
if (!this.port) {
this.port = 502;
}
if (!this.hostname) {
this.hostname = '0.0.0.0';
}
server = net.createServer();
server.on('connection', function (s) {
this.log.debug('new connection', s.address());
clients.push(s);
initiateSocket(s);
}.bind(this));
server.listen(this.port, this.hostname, function (err) {
if (err) {
this.log.debug('error while listening', err);
this.emit('error', err);
return;
}
}.bind(this));
this.log.debug('server is listening on port', this.hostname + ':' + this.port);
this.on('newState_ready', flush);
this.setState('ready');
}.bind(this);
var flush = function () {
if (this.inState('processing')) {
return;
}
if (fifo.length === 0) {
return;
}
this.setState('processing');
var current = fifo.shift();
this.onData(current.pdu, function (response) {
this.log.debug('sending tcp data');
var head = Buffer.allocUnsafe(7);
head.writeUInt16BE(current.request.trans_id, 0);
head.writeUInt16BE(current.request.protocol_ver, 2);
head.writeUInt16BE(response.length + 1, 4);
head.writeUInt8(current.request.unit_id, 6);
var pkt = Buffer.concat([head, response]);
current.socket.write(pkt);
this.setState('ready');
}.bind(this));
}.bind(this);
var initiateSocket = function (socket) {
socketCount += 1
let socketId = socketList.length
let request_handler = function (req) {
fifo.push(req);
flush();
}
let remove_handler = function () {
socketList[socketId] = undefined
/* remove undefined on the end of the array */
for (let i = socketList.length - 1; i >= 0; i -= 1) {
let cur = socketList[i];
if (cur !== undefined)
break
socketList.splice(i, 1);
}
console.log(socketList)
}
let client_socket = ClientSocket({
socket: socket,
socketId: socketId,
onRequest: request_handler,
onEnd: remove_handler
})
socketList.push(client_socket)
}.bind(this);
this.close = function (cb) {
for(var c in clients) {
clients[c].destroy();
}
server.close(function() {
server.unref();
if(cb) { cb(); }
});
};
init();
}); |
<<<<<<<
=======
const configuration = tslint.Configuration.findConfiguration(null, '.');
const linterOptions = { fix: false, formatter: 'json', rulesDirectory: 'build/lib/tslint' };
>>>>>>>
<<<<<<<
if (file.relative.startsWith('src/')) { // only lint files in src program
linter.lint(file.relative, contents, configuration.results);
=======
const linter = new tslint.Linter(linterOptions);
linter.lint(file.relative, contents, configuration.results);
const result = linter.getResult();
if (result.failures.length > 0) {
reportFailures(result.failures);
errorCount += result.failures.length;
>>>>>>>
if (file.relative.startsWith('src/')) { // only lint files in src program
linter.lint(file.relative, contents, configuration.results); |
<<<<<<<
// TODO@Ben Electron 2.0.x: force srgb color profile (for https://github.com/Microsoft/vscode/issues/51791)
app.commandLine.appendSwitch('force-color-profile', 'srgb');
let fs = require('fs');
let path = require('path');
let minimist = require('minimist');
let paths = require('./paths');
=======
const minimist = require('minimist');
const paths = require('./paths');
>>>>>>>
// TODO@Ben Electron 2.0.x: force srgb color profile (for https://github.com/Microsoft/vscode/issues/51791)
app.commandLine.appendSwitch('force-color-profile', 'srgb');
const minimist = require('minimist');
const paths = require('./paths'); |
<<<<<<<
eventPokemon: [
{"generation":6,"level":50,"isHidden":false,"moves":["waterfall","earthquake","icefang","dragondance"],"pokeball":"cherishball"}
],
=======
viableDoublesMoves: {"dragondance":1,"waterfall":1,"earthquake":1,"bounce":1,"taunt":1,"protect":1,"thunderwave":1,"stoneedge":1,"substitute":1,"icefang":1},
>>>>>>>
viableDoublesMoves: {"dragondance":1,"waterfall":1,"earthquake":1,"bounce":1,"taunt":1,"protect":1,"thunderwave":1,"stoneedge":1,"substitute":1,"icefang":1},
eventPokemon: [
{"generation":6,"level":50,"isHidden":false,"moves":["waterfall","earthquake","icefang","dragondance"],"pokeball":"cherishball"}
],
<<<<<<<
tier: "UU"
=======
viableDoublesMoves: {"protect":1,"triattack":1,"darkpulse":1,"hiddenpowerfighting":1,"agility":1,"trick":1,"nastyplot":1},
tier: "Limbo C"
>>>>>>>
viableDoublesMoves: {"protect":1,"triattack":1,"darkpulse":1,"hiddenpowerfighting":1,"agility":1,"trick":1,"nastyplot":1},
tier: "UU"
<<<<<<<
tier: "NU"
=======
viableDoublesMoves: {"shellsmash":1,"muddywater":1,"icebeam":1,"earthpower":1,"hiddenpowerelectric":1,"protect":1,"toxicspikes":1,"stealthrock":1,"hydropump":1},
tier: "Limbo"
>>>>>>>
viableDoublesMoves: {"shellsmash":1,"muddywater":1,"icebeam":1,"earthpower":1,"hiddenpowerelectric":1,"protect":1,"toxicspikes":1,"stealthrock":1,"hydropump":1},
tier: "NU"
<<<<<<<
tier: "RU"
=======
viableDoublesMoves: {"aquajet":1,"stoneedge":1,"protect":1,"rockslide":1,"swordsdance":1,"waterfall":1,"superpower":1,"feint":1},
tier: "Limbo"
>>>>>>>
viableDoublesMoves: {"aquajet":1,"stoneedge":1,"protect":1,"rockslide":1,"swordsdance":1,"waterfall":1,"superpower":1,"feint":1},
tier: "RU" |
<<<<<<<
viableMoves: {"scald":1,"aquatail":1,"zenheadbutt":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1},
=======
viableMoves: {"scald":1,"aquatail":1,"zenheadbutt":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1,"trick":1},
viableDoublesMoves: {"scald":1,"aquatail":1,"zenheadbutt":1,"thunderwave":1,"slackoff":1,"trickroom":1,"protect":1},
>>>>>>>
viableMoves: {"scald":1,"aquatail":1,"zenheadbutt":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1},
viableDoublesMoves: {"scald":1,"aquatail":1,"zenheadbutt":1,"thunderwave":1,"slackoff":1,"trickroom":1,"protect":1},
<<<<<<<
viableMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"calmmind":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1,"psyshock":1},
=======
viableMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"calmmind":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1,"trick":1,"psyshock":1},
viableDoublesMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"thunderwave":1,"slackoff":1,"trickroom":1,"protect":1,"psyshock":1},
>>>>>>>
viableMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"calmmind":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1,"psyshock":1},
viableDoublesMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"thunderwave":1,"slackoff":1,"trickroom":1,"protect":1,"psyshock":1},
<<<<<<<
viableMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"calmmind":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1,"nastyplot":1,"dragontail":1,"psyshock":1},
=======
viableMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"calmmind":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1,"trick":1,"nastyplot":1,"dragontail":1,"psyshock":1},
viableDoublesMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"thunderwave":1,"slackoff":1,"trickroom":1,"protect":1,"psyshock":1},
>>>>>>>
viableMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"calmmind":1,"thunderwave":1,"toxic":1,"slackoff":1,"trickroom":1,"nastyplot":1,"dragontail":1,"psyshock":1},
viableDoublesMoves: {"scald":1,"fireblast":1,"icebeam":1,"psychic":1,"grassknot":1,"thunderwave":1,"slackoff":1,"trickroom":1,"protect":1,"psyshock":1}, |
<<<<<<<
this.send('|init|chat\n|title|'+this.title+'\n'+userList+'\n'+this.log.slice(-25).join('\n'), connection);
if (global.Tournaments && Tournaments.getTournament(this.id))
Tournaments.getTournament(this.id).update(user);
=======
var modchat = this.getModchatNote();
this.send('|init|chat\n|title|'+this.title+'\n'+userList+'\n'+this.logGetLast(25).join('\n')+modchat, connection);
>>>>>>>
var modchat = this.getModchatNote();
this.send('|init|chat\n|title|'+this.title+'\n'+userList+'\n'+this.logGetLast(25).join('\n')+modchat, connection);
if (global.Tournaments && Tournaments.getTournament(this.id))
Tournaments.getTournament(this.id).update(user);
<<<<<<<
this.send('|init|chat\n|title|'+this.title+'\n'+userList+'\n'+this.log.slice(-100).join('\n'), connection);
if (global.Tournaments && Tournaments.getTournament(this.id))
Tournaments.getTournament(this.id).update(user);
=======
var modchat = this.getModchatNote();
this.send('|init|chat\n|title|'+this.title+'\n'+userList+'\n'+this.logGetLast(100).join('\n')+modchat, connection);
>>>>>>>
var modchat = this.getModchatNote();
this.send('|init|chat\n|title|'+this.title+'\n'+userList+'\n'+this.logGetLast(100).join('\n')+modchat, connection);
if (global.Tournaments && Tournaments.getTournament(this.id))
Tournaments.getTournament(this.id).update(user); |
<<<<<<<
code = uglifyJs.minify(code).code;
if(!checkContractLength(code.length)){
cb(null);
return;
}
let deployBlock = new EcmaContractDeployBlock(code, {
randomSeed: random.int(0, 10000),
from: wallet.id,
resourceRent: String(resourceRent)
});
deployBlock = wallet.signBlock(deployBlock);
=======
code = uglifyJs.minify(code).code;
deployBlock = new EcmaContractDeployBlock(code, {
randomSeed: random.int(0, 10000),
from: wallet.id,
resourceRent: String(resourceRent)
});
deployBlock = wallet.signBlock(deployBlock);
} else {
deployBlock = code
}
>>>>>>>
code = uglifyJs.minify(code).code;
if(!checkContractLength(code.length)){
cb(null);
return;
}
deployBlock = new EcmaContractDeployBlock(code, {
randomSeed: random.int(0, 10000),
from: wallet.id,
resourceRent: String(resourceRent)
});
deployBlock = wallet.signBlock(deployBlock);
} else {
deployBlock = code
} |
<<<<<<<
resolve: async (parent, args, context, resolveInfo) => {
const users = await joinMonster(resolveInfo, context, sql => dbCall(sql, knex, context), options)
return users.sort((a, b) => a.id - b.id)
=======
args: {
ids: { type: new GraphQLList(GraphQLInt) }
},
where: (table, args) => args.ids ? `${table}.id IN (${args.ids.join(',')})` : null,
resolve: (parent, args, context, resolveInfo) => {
return joinMonster(resolveInfo, context, sql => {
// place the SQL query in the response headers. ONLY for debugging. Don't do this in production
if (context) {
context.set('X-SQL-Preview', sql.replace(/\n/g, '%0A'))
}
return knex.raw(sql).then(result => {
// knex returns different objects based on the dialect...
if (options.dialect === 'mysql') {
return result[0]
}
return result
})
}, options)
>>>>>>>
args: {
ids: { type: new GraphQLList(GraphQLInt) }
},
where: (table, args) => args.ids ? `${table}.id IN (${args.ids.join(',')})` : null,
resolve: async (parent, args, context, resolveInfo) => {
const users = await joinMonster(resolveInfo, context, sql => dbCall(sql, knex, context), options)
return users.sort((a, b) => a.id - b.id) |
<<<<<<<
const handler = deferToType.constructor.name === 'GraphQLObjectType' ? handleSelections : handleUnionSelections
handler.call(this, children, selection.selectionSet.selections, deferToType, namespace, depth, options)
=======
handleSelections(children, selection.selectionSet.selections, deferToType, namespace, depth, options, context)
>>>>>>>
const handler = deferToType.constructor.name === 'GraphQLObjectType' ? handleSelections : handleUnionSelections
handler.call(this, children, selection.selectionSet.selections, deferToType, namespace, depth, options, context)
<<<<<<<
const handler = deferToType.constructor.name === 'GraphQLObjectType' ? handleSelections : handleUnionSelections
handler.call(this, children, fragment.selectionSet.selections, deferToType, namespace, depth, options)
=======
handleSelections(children, fragment.selectionSet.selections, deferToType, namespace, depth, options, context)
>>>>>>>
const handler = deferToType.constructor.name === 'GraphQLObjectType' ? handleSelections : handleUnionSelections
handler.call(this, children, fragment.selectionSet.selections, deferToType, namespace, depth, options, context) |
<<<<<<<
function handleUnionSelections(sqlASTNode, children, selections, gqlType, namespace, depth, options) {
=======
function handleUnionSelections(children, selections, gqlType, namespace, depth, options, context) {
>>>>>>>
function handleUnionSelections(sqlASTNode, children, selections, gqlType, namespace, depth, options, context) {
<<<<<<<
const deferredType = this.schema._typeMap[selectionNameOfType]
const deferToObjectType = deferredType.constructor.name === 'GraphQLObjectType'
const handler = deferToObjectType ? handleSelections : handleUnionSelections
if (deferToObjectType) {
const typedChildren = sqlASTNode.typedChildren
children = typedChildren[deferredType.name] = typedChildren[deferredType.name] || []
}
handler.call(this, sqlASTNode, children, selection.selectionSet.selections, deferredType, namespace, depth, options)
=======
const deferToType = this.schema._typeMap[selectionNameOfType]
const handler = deferToType.constructor.name === 'GraphQLObjectType' ? handleSelections : handleUnionSelections
handler.call(this, children, selection.selectionSet.selections, deferToType, namespace, depth, options, context)
>>>>>>>
const deferredType = this.schema._typeMap[selectionNameOfType]
const deferToObjectType = deferredType.constructor.name === 'GraphQLObjectType'
const handler = deferToObjectType ? handleSelections : handleUnionSelections
if (deferToObjectType) {
const typedChildren = sqlASTNode.typedChildren
children = typedChildren[deferredType.name] = typedChildren[deferredType.name] || []
}
handler.call(this, sqlASTNode, children, selection.selectionSet.selections, deferredType, namespace, depth, options, context)
<<<<<<<
const deferredType = this.schema._typeMap[fragmentNameOfType ]
const deferToObjectType = deferredType.constructor.name === 'GraphQLObjectType'
const handler = deferToObjectType ? handleSelections : handleUnionSelections
handler.call(this, sqlASTNode, children, fragment.selectionSet.selections, deferredType, namespace, depth, options)
=======
const deferToType = this.schema._typeMap[fragmentNameOfType ]
const handler = deferToType.constructor.name === 'GraphQLObjectType' ? handleSelections : handleUnionSelections
handler.call(this, children, fragment.selectionSet.selections, deferToType, namespace, depth, options, context)
>>>>>>>
const deferredType = this.schema._typeMap[fragmentNameOfType ]
const deferToObjectType = deferredType.constructor.name === 'GraphQLObjectType'
const handler = deferToObjectType ? handleSelections : handleUnionSelections
if (deferToObjectType) {
const typedChildren = sqlASTNode.typedChildren
children = typedChildren[deferredType.name] = typedChildren[deferredType.name] || []
}
handler.call(this, sqlASTNode, children, fragment.selectionSet.selections, deferredType, namespace, depth, options, context)
<<<<<<<
function handleSelections(sqlASTNode, children, selections, gqlType, namespace, depth, options) {
=======
function handleSelections(children, selections, gqlType, namespace, depth, options, context) {
>>>>>>>
function handleSelections(sqlASTNode, children, selections, gqlType, namespace, depth, options, context) {
<<<<<<<
handleSelections.call(this, sqlASTNode, children, selection.selectionSet.selections, gqlType, namespace, depth, options)
=======
handleSelections.call(this, children, selection.selectionSet.selections, gqlType, namespace, depth, options, context)
>>>>>>>
handleSelections.call(this, sqlASTNode, children, selection.selectionSet.selections, gqlType, namespace, depth, options, context)
<<<<<<<
handleSelections.call(this, sqlASTNode, children, fragment.selectionSet.selections, gqlType, namespace, depth, options)
=======
handleSelections.call(this, children, fragment.selectionSet.selections, gqlType, namespace, depth, options, context)
>>>>>>>
handleSelections.call(this, sqlASTNode, children, fragment.selectionSet.selections, gqlType, namespace, depth, options, context) |
<<<<<<<
module.exports = stampit()
.compose(ModbusCore)
.init(function () {
var SerialPort = require('serialport'),
serialport;
var buffer = new Buffer(0);
var init = function () {
this.setState('init');
if (!this.portName) {
throw new Error('No portname.');
}
if (!this.baudRate) {
this.baudRate = 9600; // the most are working with 9600
}
=======
var stampit = require('stampit')
var crc = require('crc')
var ModbusCore = require('./modbus-client-core.js')
>>>>>>>
var stampit = require('stampit')
var crc = require('crc')
var ModbusCore = require('./modbus-client-core.js')
<<<<<<<
function toStrArray(buf) {
if (!buf || !buf.length) return '';
var text = '';
for (var i = 0; i < buf.length; i++) {
text += (text ? ',' : '') + buf[i];
}
return text;
}
var onData = function (data) {
this.log.debug('received data ' + data.length + ' bytes');
buffer = Buffer.concat([buffer, data]);
while (buffer.length > 4) {
// 1. there is no mbap
// 2. extract pdu
// 0 - device ID
// 1 - Function CODE
// 2 - Bytes length
// 3.. Data
// checksum.(2 bytes
var len;
var pdu;
// if response for write
if (buffer[1] === 5 || buffer[1] === 6 || buffer[1] === 15 || buffer[1] === 16) {
if (buffer.length < 8) {
break;
}
pdu = buffer.slice(0, 8); // 1 byte device ID + 1 byte FC + 2 bytes address + 2 bytes value + 2 bytes CRC
} else if (buffer[1] > 0 && buffer[1] < 5){
len = buffer[2];
if (buffer.length < len + 5) {
break;
}
pdu = buffer.slice(0, len + 5); // 1 byte deviceID + 1 byte FC + 1 byte length + 2 bytes CRC
} else {
// unknown function code
this.logError('unknown function code: ' + buffer[1]);
// reset buffer and try again
buffer = [];
break;
}
if (crc.crc16modbus(pdu) === 0) { /* PDU is valid if CRC across whole PDU equals 0, else ignore and do nothing */
if (pdu[0] !== this.unitId) {
// answer for wrong device
this.log.debug('received answer for wrong ID ' + buffer[0] + ', expected ' + this.unitId);
}
// emit data event and let the
// listener handle the pdu
this.emit('data', pdu.slice(1, pdu.length - 2));
} else {
this.logError('Wrong CRC for frame: ' + toStrArray(pdu));
// reset buffer and try again
buffer = [];
break;
}
buffer = buffer.slice(pdu.length, buffer.length);
}
}.bind(this);
=======
// TODO: settings - ['brk', 'cts', 'dtr', 'dts', 'rts']
>>>>>>>
// TODO: settings - ['brk', 'cts', 'dtr', 'dts', 'rts']
<<<<<<<
this.close = function () {
serialport.close();
};
=======
let crc16 = crc.crc16modbus(buf)
let crcBuf = Buffer.allocUnsafe(2)
crcBuf.writeUInt16LE(crc16, 0)
var pkt = Buffer.concat([buf, crcBuf])
>>>>>>>
var crc16 = crc.crc16modbus(buf)
var crcBuf = Buffer.allocUnsafe(2)
crcBuf.writeUInt16LE(crc16, 0)
var pkt = Buffer.concat([buf, crcBuf])
<<<<<<<
});
=======
this.close = function () {
serialport.close()
}
init()
})
>>>>>>>
this.close = function () {
serialport.close()
}
init()
}) |
<<<<<<<
var page_num = 1;
var no_more = false;
//无限加载
$(window).scroll(function() {
if(no_more) {
return false;
}
if($(window).scrollTop() + $(window).height() == $(document).height()) {
$('.gallery .footer').show();
page_num++; //next page
$.ajax({
url: basePath + '/explore/page/'+page_num,
type: 'GET',
dataType: 'json'
})
.success(function(data){
if(data.status == SUCCESS_FEED_LOAD){
$(data.events).each(function(){
$('.gallery').append(toBox(this));
});
minigrid('.gallery', '.gallery .box');
} else {
no_more = true;
}
$('.gallery .footer').hide();
})
}
});
function toBox(event){
var box = $('<div class="box"></div>');
//post
if(event.object_type == '0'){
var post_url = basePath + '/post/' + event.object_id;
var post_cover_url = img_base_url + event.content + '?imageView2/2/w/300';
var post = $('<a href="'+post_url+'"><img src="'+post_cover_url+'" /></a>');
box.append(post);
}
//album
else if(event.object_type == '2') {
var album_url = basePath + '/album/'+event.object_id + '/photos';
var album_cover_url = img_base_url + event.title + '?imageView2/2/w/300';
var album = $('<a href="'+album_url+'"><img src="'+album_cover_url+'" /></a>');
box.append(album);
}
//append meta
var meta = $('<div class="meta"></div>');
var content = $('<a href="'+basePath+'/user/'+event.user_id+'">'+
'<img class="ui avatar image" src="'+img_base_url+event.user_avatar+'?imageView2/1/w/48/h/48">'+
'<span>'+event.user_name+'</span>'+
'</a>');
meta.append(content);
box.append(meta);
return box;
}
$(".topbar .header>div").click(function(){
var index=$(this).index();
var explore=$('.gallery:first');
var tags=$('.tags:first');
var users = $('.users:first');
var active_tip=$('.topbar .active');
if(index == 0){
$(explore).fadeIn(300);
$(tags).fadeOut(200);
$(users).fadeOut(200);
$(active_tip).css('left', '19.5%');
} else if(index == 1 ){
$(tags).fadeIn(300);
$(explore).fadeOut(200);
$(users).fadeOut(200);
$(active_tip).css('left', '44%');
} else{
$(explore).fadeOut(300);
$(tags).fadeOut(200);
$(users).fadeIn(200);
$(active_tip).css('left', '69%');
}
});
=======
minigrid('.gallery', '.gallery .box');
window.addEventListener('resize', function(){
minigrid('.gallery', '.gallery .box');
});
//无限加载
$(window).scroll(function() {
if(no_more) {
return false;
}
if($(window).scrollTop() + $(window).height() == $(document).height()) {
$('.gallery .footer').show();
page_num++; //next page
$.ajax({
url: basePath + '/explore/page/'+page_num,
type: 'GET',
dataType: 'json'
})
.success(function(data){
if(data.status == SUCCESS_FEED_LOAD){
$(data.events).each(function(){
$('.gallery').append(toBox(this));
});
minigrid('.gallery', '.gallery .box');
} else {
no_more = true;
}
$('.gallery .footer').hide();
})
}
});
function toBox(event){
var box = $('<div class="box"></div>');
//post
if(event.object_type == '0'){
var post_url = basePath + '/post/' + event.object_id;
var post_cover_url = img_base_url + event.content + '?imageView2/2/w/300';
var post = $('<a href="'+post_url+'"><img src="'+post_cover_url+'" /></a>');
box.append(post);
}
//album
else if(event.object_type == '2') {
var album_url = basePath + '/album/'+event.object_id + '/photos';
var album_cover_url = img_base_url + event.title + '?imageView2/2/w/300';
var album = $('<a href="'+album_url+'"><img src="'+album_cover_url+'" /></a>');
box.append(album);
}
//append meta
var meta = $('<div class="meta"></div>');
var content = $('<a href="'+basePath+'/user/'+event.user_id+'">'+
'<img class="ui avatar image" src="'+img_base_url+event.user_avatar+'?imageView2/1/w/48/h/48">'+
'<span>'+event.user_name+'</span>'+
'</a>');
meta.append(content);
box.append(meta);
return box;
}
$(".topbar .header>div").click(function(){
var index=$(this).index();
var explore=$('.gallery:first');
var tags=$('.tags:first');
var users = $('.users:first');
var active_tip=$('.topbar .active');
if(index == 0){
$(explore).fadeIn(300);
$(tags).fadeOut(200);
$(users).fadeOut(200);
$(active_tip).css('left', '19.5%');
} else if(index == 1 ){
$(tags).fadeIn(300);
$(explore).fadeOut(200);
$(users).fadeOut(200);
$(active_tip).css('left', '44%');
} else{
$(explore).fadeOut(300);
$(tags).fadeOut(200);
$(users).fadeIn(200);
$(active_tip).css('left', '69%');
}
});
>>>>>>>
//无限加载
$(window).scroll(function() {
if(no_more) {
return false;
}
if($(window).scrollTop() + $(window).height() == $(document).height()) {
$('.gallery .footer').show();
page_num++; //next page
$.ajax({
url: basePath + '/explore/page/'+page_num,
type: 'GET',
dataType: 'json'
})
.success(function(data){
if(data.status == SUCCESS_FEED_LOAD){
$(data.events).each(function(){
$('.gallery').append(toBox(this));
});
minigrid('.gallery', '.gallery .box');
} else {
no_more = true;
}
$('.gallery .footer').hide();
})
}
});
function toBox(event){
var box = $('<div class="box"></div>');
//post
if(event.object_type == '0'){
var post_url = basePath + '/post/' + event.object_id;
var post_cover_url = img_base_url + event.content + '?imageView2/2/w/300';
var post = $('<a href="'+post_url+'"><img src="'+post_cover_url+'" /></a>');
box.append(post);
}
//album
else if(event.object_type == '2') {
var album_url = basePath + '/album/'+event.object_id + '/photos';
var album_cover_url = img_base_url + event.title + '?imageView2/2/w/300';
var album = $('<a href="'+album_url+'"><img src="'+album_cover_url+'" /></a>');
box.append(album);
}
//append meta
var meta = $('<div class="meta"></div>');
var content = $('<a href="'+basePath+'/user/'+event.user_id+'">'+
'<img class="ui avatar image" src="'+img_base_url+event.user_avatar+'?imageView2/1/w/48/h/48">'+
'<span>'+event.user_name+'</span>'+
'</a>');
meta.append(content);
box.append(meta);
return box;
}
$(".topbar .header>div").click(function(){
var index=$(this).index();
var explore=$('.gallery:first');
var tags=$('.tags:first');
var users = $('.users:first');
var active_tip=$('.topbar .active');
if(index == 0){
$(explore).fadeIn(300);
$(tags).fadeOut(200);
$(users).fadeOut(200);
$(active_tip).css('left', '19.5%');
} else if(index == 1 ){
$(tags).fadeIn(300);
$(explore).fadeOut(200);
$(users).fadeOut(200);
$(active_tip).css('left', '44%');
} else{
$(explore).fadeOut(300);
$(tags).fadeOut(200);
$(users).fadeIn(200);
$(active_tip).css('left', '69%');
}
}); |
<<<<<<<
* Version: v1.3.25 (01/21/2014) (Demo Version)
=======
* Version: v1.3.26 (01/26/2014)
>>>>>>>
* Version: v1.3.26 (01/26/2014) (Demo Version)
<<<<<<<
var xArray = ['d', 'e', 'm', 'o', ' ', 'v', 'e', 'r', 's', 'i', 'o', 'n'];
var xClass = Math.floor(Math.random()*12317);
$(scrollerNode).parent().append("<i class = 'i" + xClass + "'></i>").append("<i class = 'i" + xClass + "'></i>");
$('.i' + xClass).css({ position: 'absolute', right: '10px', bottom: '10px', zIndex: 1000, fontStyle: 'normal', background: '#fff', opacity: 0.2 }).eq(1).css({ bottom: 'auto', right: 'auto', top: '10px', left: '10px' });
for(var i = 0; i < xArray.length; i++) { $('.i' + xClass).html($('.i' + xClass).html() + xArray[i]); }
$(this).delegate('img', 'dragstart.iosSliderEvent', function(event) { event.preventDefault(); });
=======
if(parseInt($().jquery.split('.').join(''), 10) >= 14.2) {
$(this).delegate('img', 'dragstart.iosSliderEvent', function(event) { event.preventDefault(); });
} else {
$(this).find('img').bind('dragstart.iosSliderEvent', function(event) { event.preventDefault(); });
}
>>>>>>>
var xArray = ['d', 'e', 'm', 'o', ' ', 'v', 'e', 'r', 's', 'i', 'o', 'n'];
var xClass = Math.floor(Math.random()*12317);
$(scrollerNode).parent().append("<i class = 'i" + xClass + "'></i>").append("<i class = 'i" + xClass + "'></i>");
$('.i' + xClass).css({ position: 'absolute', right: '10px', bottom: '10px', zIndex: 1000, fontStyle: 'normal', background: '#fff', opacity: 0.2 }).eq(1).css({ bottom: 'auto', right: 'auto', top: '10px', left: '10px' });
for(var i = 0; i < xArray.length; i++) { $('.i' + xClass).html($('.i' + xClass).html() + xArray[i]); }
if(parseInt($().jquery.split('.').join(''), 10) >= 14.2) {
$(this).delegate('img', 'dragstart.iosSliderEvent', function(event) { event.preventDefault(); });
} else {
$(this).find('img').bind('dragstart.iosSliderEvent', function(event) { event.preventDefault(); });
} |
<<<<<<<
width: 'autoSize',
sortable: true
=======
flex: 1,
sortable: true,
>>>>>>>
flex: 1,
sortable: true |
<<<<<<<
class FileUpload extends React.Component {
static propTypes = {
allowedFileTypes: React.PropTypes.array,
imageUrl: React.PropTypes.string,
imageValidation: React.PropTypes.shape({
exactHeight: React.PropTypes.number,
exactWidth: React.PropTypes.number,
maxHeight: React.PropTypes.number,
maxWidth: React.PropTypes.number,
minHeight: React.PropTypes.number,
minWidth: React.PropTypes.number,
ratioHeight: React.PropTypes.number,
ratioWidth: React.PropTypes.number
=======
const FileUpload = React.createClass({
propTypes: {
allowedFileTypes: PropTypes.array,
imageUrl: PropTypes.string,
imageValidation: PropTypes.shape({
exactHeight: PropTypes.number,
exactWidth: PropTypes.number,
maxHeight: PropTypes.number,
maxWidth: PropTypes.number,
minHeight: PropTypes.number,
minWidth: PropTypes.number,
ratioHeight: PropTypes.number,
ratioWidth: PropTypes.number
>>>>>>>
class FileUpload extends React.Component {
static propTypes = {
allowedFileTypes: PropTypes.array,
imageUrl: PropTypes.string,
imageValidation: PropTypes.shape({
exactHeight: PropTypes.number,
exactWidth: PropTypes.number,
maxHeight: PropTypes.number,
maxWidth: PropTypes.number,
minHeight: PropTypes.number,
minWidth: PropTypes.number,
ratioHeight: PropTypes.number,
ratioWidth: PropTypes.number
<<<<<<<
maxFileSize: React.PropTypes.number,
onFileAdd: React.PropTypes.func.isRequired,
onFileRemove: React.PropTypes.func.isRequired,
onFileValidation: React.PropTypes.func,
style: React.PropTypes.object,
uploadedFile: React.PropTypes.any
};
=======
maxFileSize: PropTypes.number,
onFileAdd: PropTypes.func.isRequired,
onFileRemove: PropTypes.func.isRequired,
onFileValidation: PropTypes.func,
style: PropTypes.object,
uploadedFile: PropTypes.any
},
>>>>>>>
maxFileSize: PropTypes.number,
onFileAdd: PropTypes.func.isRequired,
onFileRemove: PropTypes.func.isRequired,
onFileValidation: PropTypes.func,
style: PropTypes.object,
uploadedFile: PropTypes.any
}; |
<<<<<<<
const _clone = require('lodash/clone');
=======
const _find = require('lodash/find');
>>>>>>>
const _clone = require('lodash/clone');
const _find = require('lodash/find');
<<<<<<<
donutChartData: [],
=======
drawerSiblings: [
{
id: 1,
selected: true
},
{
id: 2,
selected: false
},
{
id: 3,
selected: false
},
{
id: 4,
selected: false
}
],
>>>>>>>
donutChartData: [],
drawerSiblings: [
{
id: 1,
selected: true
},
{
id: 2,
selected: false
},
{
id: 3,
selected: false
},
{
id: 4,
selected: false
}
], |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.