@dronedeploy/rocos-js-sdk 3.0.11 → 3.0.13
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/api/StreamRegister.d.ts +3 -3
- package/cjs/api/StreamRegister.js +6 -6
- package/cjs/api/streams/telemetry/TelemetryStreamAbstract.js +8 -7
- package/cjs/helpers/kscript/Context.d.ts +14 -8
- package/cjs/helpers/kscript/Context.js +59 -22
- package/cjs/helpers/kscript/kscript.js +53 -1
- package/cjs/helpers/kscript/nodes/Identifier.js +1 -1
- package/cjs/helpers/kscript/nodes/Node.d.ts +0 -1
- package/cjs/helpers/kscript/nodes/Node.js +0 -1
- package/cjs/helpers/kscript/nodes/Program.js +8 -5
- package/cjs/helpers/kscript/nodes/VariableDeclaration.d.ts +8 -0
- package/cjs/helpers/kscript/nodes/VariableDeclaration.js +43 -0
- package/cjs/helpers/kscript/nodes/expressions/ArrowFunctionExpression.js +11 -4
- package/cjs/helpers/kscript/nodes/expressions/AssignmentExpression.d.ts +8 -0
- package/cjs/helpers/kscript/nodes/expressions/AssignmentExpression.js +33 -0
- package/cjs/helpers/kscript/nodes/expressions/BinaryExpression.d.ts +2 -0
- package/cjs/helpers/kscript/nodes/expressions/BinaryExpression.js +16 -0
- package/cjs/helpers/kscript/nodes/expressions/LogicalExpression.js +1 -1
- package/cjs/helpers/kscript/nodes/expressions/NewExpression.d.ts +9 -0
- package/cjs/helpers/kscript/nodes/expressions/NewExpression.js +44 -0
- package/cjs/helpers/kscript/nodes/expressions/index.d.ts +2 -1
- package/cjs/helpers/kscript/nodes/expressions/index.js +5 -3
- package/cjs/helpers/kscript/nodes/nodeTypes.d.ts +9 -1
- package/cjs/helpers/kscript/nodes/nodeTypes.js +9 -1
- package/cjs/helpers/kscript/nodes/statements/BlockStatement.d.ts +8 -0
- package/cjs/helpers/kscript/nodes/statements/BlockStatement.js +29 -0
- package/cjs/helpers/kscript/nodes/statements/ReturnStatement.d.ts +12 -0
- package/cjs/helpers/kscript/nodes/statements/ReturnStatement.js +33 -0
- package/cjs/helpers/kscript/nodes/statements/SwitchStatement.d.ts +9 -0
- package/cjs/helpers/kscript/nodes/statements/SwitchStatement.js +52 -0
- package/cjs/helpers/kscript/nodes/statements/index.d.ts +4 -0
- package/cjs/helpers/kscript/nodes/statements/index.js +14 -0
- package/cjs/services/BaseStreamService.js +1 -1
- package/cjs/services/WebRTCSignallingService.js +1 -2
- package/esm/api/StreamRegister.d.ts +3 -3
- package/esm/api/StreamRegister.js +6 -6
- package/esm/api/streams/telemetry/TelemetryStreamAbstract.js +8 -7
- package/esm/helpers/kscript/Context.d.ts +14 -8
- package/esm/helpers/kscript/Context.js +59 -22
- package/esm/helpers/kscript/kscript.js +53 -1
- package/esm/helpers/kscript/nodes/Identifier.js +1 -1
- package/esm/helpers/kscript/nodes/Node.d.ts +0 -1
- package/esm/helpers/kscript/nodes/Node.js +0 -1
- package/esm/helpers/kscript/nodes/Program.js +8 -5
- package/esm/helpers/kscript/nodes/VariableDeclaration.d.ts +8 -0
- package/esm/helpers/kscript/nodes/VariableDeclaration.js +37 -0
- package/esm/helpers/kscript/nodes/expressions/ArrowFunctionExpression.js +11 -4
- package/esm/helpers/kscript/nodes/expressions/AssignmentExpression.d.ts +8 -0
- package/esm/helpers/kscript/nodes/expressions/AssignmentExpression.js +27 -0
- package/esm/helpers/kscript/nodes/expressions/BinaryExpression.d.ts +2 -0
- package/esm/helpers/kscript/nodes/expressions/BinaryExpression.js +16 -0
- package/esm/helpers/kscript/nodes/expressions/LogicalExpression.js +1 -1
- package/esm/helpers/kscript/nodes/expressions/NewExpression.d.ts +9 -0
- package/esm/helpers/kscript/nodes/expressions/NewExpression.js +38 -0
- package/esm/helpers/kscript/nodes/expressions/index.d.ts +2 -1
- package/esm/helpers/kscript/nodes/expressions/index.js +2 -1
- package/esm/helpers/kscript/nodes/nodeTypes.d.ts +9 -1
- package/esm/helpers/kscript/nodes/nodeTypes.js +9 -1
- package/esm/helpers/kscript/nodes/statements/BlockStatement.d.ts +8 -0
- package/esm/helpers/kscript/nodes/statements/BlockStatement.js +23 -0
- package/esm/helpers/kscript/nodes/statements/ReturnStatement.d.ts +12 -0
- package/esm/helpers/kscript/nodes/statements/ReturnStatement.js +25 -0
- package/esm/helpers/kscript/nodes/statements/SwitchStatement.d.ts +9 -0
- package/esm/helpers/kscript/nodes/statements/SwitchStatement.js +46 -0
- package/esm/helpers/kscript/nodes/statements/index.d.ts +4 -0
- package/esm/helpers/kscript/nodes/statements/index.js +4 -0
- package/esm/services/BaseStreamService.js +1 -1
- package/esm/services/WebRTCSignallingService.js +1 -2
- package/package.json +1 -1
- /package/cjs/helpers/kscript/nodes/{expressions → statements}/ExpressionStatement.d.ts +0 -0
- /package/cjs/helpers/kscript/nodes/{expressions → statements}/ExpressionStatement.js +0 -0
- /package/esm/helpers/kscript/nodes/{expressions → statements}/ExpressionStatement.d.ts +0 -0
- /package/esm/helpers/kscript/nodes/{expressions → statements}/ExpressionStatement.js +0 -0
@@ -1,4 +1,5 @@
|
|
1
1
|
import Node from '../Node';
|
2
|
+
import { ReturnStatementError } from '../statements/ReturnStatement';
|
2
3
|
import { construct } from '../../utils';
|
3
4
|
/** Represents an arrow function expression.
|
4
5
|
*
|
@@ -17,8 +18,6 @@ export default class ArrowFunctionExpressionNode extends Node {
|
|
17
18
|
validate(validateChildren = false) {
|
18
19
|
if (!this.context.isFunctionCallAllowed)
|
19
20
|
throw new Error('functions are not allowed');
|
20
|
-
if (!this.node.expression)
|
21
|
-
throw new Error('functions must be an expression');
|
22
21
|
if (this.node.async)
|
23
22
|
throw new Error('async functions are not supported');
|
24
23
|
if (!validateChildren) {
|
@@ -34,8 +33,16 @@ export default class ArrowFunctionExpressionNode extends Node {
|
|
34
33
|
const index = this.params.indexOf(param);
|
35
34
|
scope.set(param.name, args?.[index]);
|
36
35
|
}
|
37
|
-
const newContext = this.context.
|
38
|
-
|
36
|
+
const newContext = this.context.newChild(scope);
|
37
|
+
try {
|
38
|
+
return construct(this.node.body, newContext).run();
|
39
|
+
}
|
40
|
+
catch (e) {
|
41
|
+
if (e instanceof ReturnStatementError) {
|
42
|
+
return e.value;
|
43
|
+
}
|
44
|
+
throw e;
|
45
|
+
}
|
39
46
|
};
|
40
47
|
}
|
41
48
|
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { AnyNode, AssignmentExpression } from 'acorn';
|
2
|
+
import Context from '../../Context';
|
3
|
+
import Node from '../Node';
|
4
|
+
export default class AssignmentExpressionNode extends Node<AssignmentExpression> {
|
5
|
+
constructor(node: AnyNode, context: Context);
|
6
|
+
validate(validateChildren?: boolean): void;
|
7
|
+
run(): unknown;
|
8
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import Node from '../Node';
|
2
|
+
import { construct } from '../../utils';
|
3
|
+
export default class AssignmentExpressionNode extends Node {
|
4
|
+
constructor(node, context) {
|
5
|
+
super(node, context, 'AssignmentExpression');
|
6
|
+
}
|
7
|
+
validate(validateChildren = false) {
|
8
|
+
if (this.node.operator !== '=') {
|
9
|
+
throw new Error('Only = operator is supported');
|
10
|
+
}
|
11
|
+
if (this.node.left.type !== 'Identifier') {
|
12
|
+
throw new Error('Left side of assignment must be an identifier');
|
13
|
+
}
|
14
|
+
if (!validateChildren) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
construct(this.node.left, this.context).validate(true);
|
18
|
+
construct(this.node.right, this.context).validate(true);
|
19
|
+
}
|
20
|
+
run() {
|
21
|
+
this.validate();
|
22
|
+
const identifier = this.node.left.name;
|
23
|
+
const right = construct(this.node.right, this.context).run();
|
24
|
+
this.context.set(identifier, right);
|
25
|
+
return right;
|
26
|
+
}
|
27
|
+
}
|
@@ -9,12 +9,14 @@ export default class BinaryExpressionNode extends Node<BinaryExpression> {
|
|
9
9
|
private static readonly EQUALITY_OPERATORS;
|
10
10
|
private static readonly COMPARISON_OPERATORS;
|
11
11
|
private static readonly ARITHMETIC_OPERATORS;
|
12
|
+
private static readonly BITWISE_OPERATORS;
|
12
13
|
private static readonly IN_OPERATOR;
|
13
14
|
private static readonly SUPPORTED_OPERATORS;
|
14
15
|
constructor(node: AnyNode, context: Context);
|
15
16
|
validate(validateChildren?: boolean): void;
|
16
17
|
run(): unknown;
|
17
18
|
private operate;
|
19
|
+
private bitwise;
|
18
20
|
private arithmetic;
|
19
21
|
private comparison;
|
20
22
|
private equality;
|
@@ -33,11 +33,25 @@ class BinaryExpressionNode extends Node {
|
|
33
33
|
if (BinaryExpressionNode.ARITHMETIC_OPERATORS.has(this.node.operator)) {
|
34
34
|
return this.arithmetic(this.node.operator, left, right);
|
35
35
|
}
|
36
|
+
if (BinaryExpressionNode.BITWISE_OPERATORS.has(this.node.operator)) {
|
37
|
+
return this.bitwise(this.node.operator, left, right);
|
38
|
+
}
|
36
39
|
if (this.node.operator === BinaryExpressionNode.IN_OPERATOR) {
|
37
40
|
return this.checkIn(left, right);
|
38
41
|
}
|
39
42
|
throw new Error(`Unsupported operator: ${this.node.operator}`);
|
40
43
|
}
|
44
|
+
bitwise(operator, left, right) {
|
45
|
+
if (typeof left !== 'number' || typeof right !== 'number') {
|
46
|
+
throw new Error('Bitwise operators are only supported for numbers');
|
47
|
+
}
|
48
|
+
switch (operator) {
|
49
|
+
case '<<':
|
50
|
+
return left << right;
|
51
|
+
case '>>':
|
52
|
+
return left >> right;
|
53
|
+
}
|
54
|
+
}
|
41
55
|
arithmetic(operator, left, right) {
|
42
56
|
if (operator === '+' && (typeof left === 'string' || typeof right === 'string')) {
|
43
57
|
return `${left}${right}`;
|
@@ -106,11 +120,13 @@ BinaryExpressionNode.ARITHMETIC_OPERATORS = new Set([
|
|
106
120
|
'%',
|
107
121
|
'**',
|
108
122
|
]);
|
123
|
+
BinaryExpressionNode.BITWISE_OPERATORS = new Set(['<<', '>>']);
|
109
124
|
BinaryExpressionNode.IN_OPERATOR = 'in';
|
110
125
|
BinaryExpressionNode.SUPPORTED_OPERATORS = new Set([
|
111
126
|
...BinaryExpressionNode.EQUALITY_OPERATORS,
|
112
127
|
...BinaryExpressionNode.COMPARISON_OPERATORS,
|
113
128
|
...BinaryExpressionNode.ARITHMETIC_OPERATORS,
|
129
|
+
...BinaryExpressionNode.BITWISE_OPERATORS,
|
114
130
|
BinaryExpressionNode.IN_OPERATOR,
|
115
131
|
]);
|
116
132
|
export default BinaryExpressionNode;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { AnyNode, NewExpression } from 'acorn';
|
2
|
+
import Context from '../../Context';
|
3
|
+
import Node from '../Node';
|
4
|
+
export default class NewExpressionNode extends Node<NewExpression> {
|
5
|
+
constructor(node: AnyNode, context: Context);
|
6
|
+
validate(validateChildren?: boolean): void;
|
7
|
+
run(): unknown;
|
8
|
+
private spreadArgs;
|
9
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import Node from '../Node';
|
2
|
+
import { construct } from '../../utils';
|
3
|
+
export default class NewExpressionNode extends Node {
|
4
|
+
constructor(node, context) {
|
5
|
+
super(node, context, 'NewExpression');
|
6
|
+
}
|
7
|
+
validate(validateChildren = false) {
|
8
|
+
if (!this.context.isFunctionCallAllowed)
|
9
|
+
throw new Error('Constructors are not allowed');
|
10
|
+
if (!validateChildren) {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
construct(this.node.callee, this.context).validate(true);
|
14
|
+
for (const arg of this.node.arguments) {
|
15
|
+
construct(arg, this.context).validate(true);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
run() {
|
19
|
+
this.validate();
|
20
|
+
const callee = construct(this.node.callee, this.context).run();
|
21
|
+
if (typeof callee !== 'function') {
|
22
|
+
throw new Error('callee is not a function');
|
23
|
+
}
|
24
|
+
const args = this.spreadArgs(this.node.arguments);
|
25
|
+
return new (Function.prototype.bind.apply(callee, [null, ...args]))();
|
26
|
+
}
|
27
|
+
spreadArgs(args) {
|
28
|
+
return args.reduce((acc, arg) => {
|
29
|
+
if (arg.type === 'SpreadElement') {
|
30
|
+
acc.push(...construct(arg.argument, this.context).run());
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
acc.push(construct(arg, this.context).run());
|
34
|
+
}
|
35
|
+
return acc;
|
36
|
+
}, []);
|
37
|
+
}
|
38
|
+
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
export { default as ExpressionStatement } from './ExpressionStatement';
|
2
1
|
export { default as ArrayExpression } from './ArrayExpression';
|
3
2
|
export { default as ObjectExpression } from './ObjectExpression';
|
4
3
|
export { default as BinaryExpression } from './BinaryExpression';
|
@@ -9,3 +8,5 @@ export { default as CallExpression } from './CallExpression';
|
|
9
8
|
export { default as ArrowFunctionExpression } from './ArrowFunctionExpression';
|
10
9
|
export { default as MemberExpression } from './MemberExpression';
|
11
10
|
export { default as ChainExpression } from './ChainExpression';
|
11
|
+
export { default as NewExpression } from './NewExpression';
|
12
|
+
export { default as AssignmentExpression } from './AssignmentExpression';
|
@@ -1,4 +1,3 @@
|
|
1
|
-
export { default as ExpressionStatement } from './ExpressionStatement';
|
2
1
|
export { default as ArrayExpression } from './ArrayExpression';
|
3
2
|
export { default as ObjectExpression } from './ObjectExpression';
|
4
3
|
export { default as BinaryExpression } from './BinaryExpression';
|
@@ -9,3 +8,5 @@ export { default as CallExpression } from './CallExpression';
|
|
9
8
|
export { default as ArrowFunctionExpression } from './ArrowFunctionExpression';
|
10
9
|
export { default as MemberExpression } from './MemberExpression';
|
11
10
|
export { default as ChainExpression } from './ChainExpression';
|
11
|
+
export { default as NewExpression } from './NewExpression';
|
12
|
+
export { default as AssignmentExpression } from './AssignmentExpression';
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { ArrayExpression, ArrowFunctionExpression, BinaryExpression, CallExpression, ChainExpression, ConditionalExpression,
|
1
|
+
import { ArrayExpression, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, CallExpression, ChainExpression, ConditionalExpression, LogicalExpression, MemberExpression, NewExpression, ObjectExpression, UnaryExpression } from './expressions';
|
2
|
+
import { BlockStatement, ExpressionStatement, ReturnStatement, SwitchStatement } from './statements';
|
2
3
|
import { AnyNode } from 'acorn';
|
3
4
|
import type Context from '../Context';
|
4
5
|
import Identifier from './Identifier';
|
@@ -6,6 +7,7 @@ import Literal from './Literal';
|
|
6
7
|
import Node from './Node';
|
7
8
|
import Program from './Program';
|
8
9
|
import TemplateLiteral from './TemplateLiteral';
|
10
|
+
import VariableDeclaration from './VariableDeclaration';
|
9
11
|
type NodeConstructor = {
|
10
12
|
new (node: AnyNode, scope: Context): Node<AnyNode>;
|
11
13
|
};
|
@@ -27,6 +29,12 @@ declare const nodes: {
|
|
27
29
|
readonly CallExpression: typeof CallExpression;
|
28
30
|
readonly MemberExpression: typeof MemberExpression;
|
29
31
|
readonly ChainExpression: typeof ChainExpression;
|
32
|
+
readonly NewExpression: typeof NewExpression;
|
33
|
+
readonly BlockStatement: typeof BlockStatement;
|
34
|
+
readonly ReturnStatement: typeof ReturnStatement;
|
35
|
+
readonly VariableDeclaration: typeof VariableDeclaration;
|
36
|
+
readonly AssignmentExpression: typeof AssignmentExpression;
|
37
|
+
readonly SwitchStatement: typeof SwitchStatement;
|
30
38
|
};
|
31
39
|
export type NodeType = keyof typeof nodes;
|
32
40
|
declare const _default: NodeMap;
|
@@ -1,8 +1,10 @@
|
|
1
|
-
import { ArrayExpression, ArrowFunctionExpression, BinaryExpression, CallExpression, ChainExpression, ConditionalExpression,
|
1
|
+
import { ArrayExpression, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, CallExpression, ChainExpression, ConditionalExpression, LogicalExpression, MemberExpression, NewExpression, ObjectExpression, UnaryExpression, } from './expressions';
|
2
|
+
import { BlockStatement, ExpressionStatement, ReturnStatement, SwitchStatement } from './statements';
|
2
3
|
import Identifier from './Identifier';
|
3
4
|
import Literal from './Literal';
|
4
5
|
import Program from './Program';
|
5
6
|
import TemplateLiteral from './TemplateLiteral';
|
7
|
+
import VariableDeclaration from './VariableDeclaration';
|
6
8
|
const nodes = {
|
7
9
|
Program,
|
8
10
|
Literal,
|
@@ -20,5 +22,11 @@ const nodes = {
|
|
20
22
|
CallExpression,
|
21
23
|
MemberExpression,
|
22
24
|
ChainExpression,
|
25
|
+
NewExpression,
|
26
|
+
BlockStatement,
|
27
|
+
ReturnStatement,
|
28
|
+
VariableDeclaration,
|
29
|
+
AssignmentExpression,
|
30
|
+
SwitchStatement,
|
23
31
|
};
|
24
32
|
export default new Map(Object.entries(nodes));
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { AnyNode, BlockStatement } from 'acorn';
|
2
|
+
import Context from '../../Context';
|
3
|
+
import Node from '../Node';
|
4
|
+
export default class BlockStatementNode extends Node<BlockStatement> {
|
5
|
+
constructor(node: AnyNode, context: Context);
|
6
|
+
validate(validateChildren?: boolean): void;
|
7
|
+
run(): unknown;
|
8
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import Node from '../Node';
|
2
|
+
import { construct } from '../../utils';
|
3
|
+
export default class BlockStatementNode extends Node {
|
4
|
+
constructor(node, context) {
|
5
|
+
super(node, context.newChild(), 'BlockStatement');
|
6
|
+
}
|
7
|
+
validate(validateChildren = false) {
|
8
|
+
if (!validateChildren) {
|
9
|
+
return;
|
10
|
+
}
|
11
|
+
for (const statement of this.node.body) {
|
12
|
+
construct(statement, this.context).validate(true);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
run() {
|
16
|
+
this.validate();
|
17
|
+
let result;
|
18
|
+
for (const statement of this.node.body) {
|
19
|
+
result = construct(statement, this.context).run();
|
20
|
+
}
|
21
|
+
return result;
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { AnyNode, ReturnStatement } from 'acorn';
|
2
|
+
import type Context from '../../Context';
|
3
|
+
import Node from '../Node';
|
4
|
+
export declare class ReturnStatementError extends Error {
|
5
|
+
readonly value: unknown;
|
6
|
+
constructor(value: unknown);
|
7
|
+
}
|
8
|
+
export default class ReturnStatementNode extends Node<ReturnStatement> {
|
9
|
+
constructor(node: AnyNode, context: Context);
|
10
|
+
validate(validateChildren?: boolean): void;
|
11
|
+
run(): unknown;
|
12
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import Node from '../Node';
|
2
|
+
import { construct } from '../../utils';
|
3
|
+
export class ReturnStatementError extends Error {
|
4
|
+
constructor(value) {
|
5
|
+
super('Illegal return statement');
|
6
|
+
this.value = value;
|
7
|
+
}
|
8
|
+
}
|
9
|
+
export default class ReturnStatementNode extends Node {
|
10
|
+
constructor(node, context) {
|
11
|
+
super(node, context, 'ReturnStatement');
|
12
|
+
}
|
13
|
+
validate(validateChildren = false) {
|
14
|
+
const arg = this.node.argument;
|
15
|
+
if (!validateChildren || arg === undefined || arg === null) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
construct(arg, this.context).validate(true);
|
19
|
+
}
|
20
|
+
run() {
|
21
|
+
this.validate();
|
22
|
+
const result = this.node.argument ? construct(this.node.argument, this.context).run() : undefined;
|
23
|
+
throw new ReturnStatementError(result);
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { AnyNode, SwitchStatement } from 'acorn';
|
2
|
+
import Context from '../../Context';
|
3
|
+
import Node from '../Node';
|
4
|
+
export default class SwitchStatementNode extends Node<SwitchStatement> {
|
5
|
+
constructor(node: AnyNode, context: Context);
|
6
|
+
private test_match;
|
7
|
+
validate(validateChildren?: boolean): void;
|
8
|
+
run(): unknown;
|
9
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import Node from '../Node';
|
2
|
+
import { construct } from '../../utils';
|
3
|
+
export default class SwitchStatementNode extends Node {
|
4
|
+
constructor(node, context) {
|
5
|
+
super(node, context, 'SwitchStatement');
|
6
|
+
}
|
7
|
+
test_match(test, discriminant) {
|
8
|
+
if (!test) {
|
9
|
+
return true;
|
10
|
+
}
|
11
|
+
const testValue = construct(test, this.context).run();
|
12
|
+
return testValue === discriminant;
|
13
|
+
}
|
14
|
+
validate(validateChildren = false) {
|
15
|
+
if (!validateChildren) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
construct(this.node.discriminant, this.context).validate(true);
|
19
|
+
for (const c of this.node.cases) {
|
20
|
+
if (c.test) {
|
21
|
+
construct(c.test, this.context).validate(true);
|
22
|
+
}
|
23
|
+
for (const s of c.consequent) {
|
24
|
+
construct(s, this.context).validate(true);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
run() {
|
29
|
+
this.validate();
|
30
|
+
const discriminant = construct(this.node.discriminant, this.context).run();
|
31
|
+
let result;
|
32
|
+
let matched = false;
|
33
|
+
for (const c of this.node.cases) {
|
34
|
+
if (!matched && this.test_match(c.test, discriminant)) {
|
35
|
+
matched = true;
|
36
|
+
}
|
37
|
+
if (!matched) {
|
38
|
+
continue;
|
39
|
+
}
|
40
|
+
for (const s of c.consequent) {
|
41
|
+
result = construct(s, this.context).run();
|
42
|
+
}
|
43
|
+
}
|
44
|
+
return result;
|
45
|
+
}
|
46
|
+
}
|
@@ -41,7 +41,7 @@ export class BaseStreamService {
|
|
41
41
|
this.status = msg === SubscriberStatusEnum.STOPPED || msg === SubscriberStatusEnum.ALIVE;
|
42
42
|
this.status$.next(msg);
|
43
43
|
});
|
44
|
-
|
44
|
+
streamRegister.addStream(stream);
|
45
45
|
await this.initStream(stream);
|
46
46
|
}
|
47
47
|
return { stream, isNew };
|
@@ -50,8 +50,7 @@ export class WebRTCSignallingService {
|
|
50
50
|
this.status = msg === SubscriberStatusEnum.STOPPED || msg === SubscriberStatusEnum.ALIVE;
|
51
51
|
this.status$.next(msg);
|
52
52
|
});
|
53
|
-
|
54
|
-
await streamRegister.addStream(stream);
|
53
|
+
streamRegister.addStream(stream);
|
55
54
|
await this.initStream(stream);
|
56
55
|
}
|
57
56
|
return stream;
|
package/package.json
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|