@mikw99/node-emberplus-custom 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +4 -0
- package/lib/ber.d.ts +42 -0
- package/lib/ber.js +237 -0
- package/lib/ber.js.map +1 -0
- package/lib/client/ember-client-logs.d.ts +4 -0
- package/lib/client/ember-client-logs.js +214 -0
- package/lib/client/ember-client-logs.js.map +1 -0
- package/lib/client/ember-client.d.ts +62 -0
- package/lib/client/ember-client.events.d.ts +8 -0
- package/lib/client/ember-client.events.js +12 -0
- package/lib/client/ember-client.events.js.map +1 -0
- package/lib/client/ember-client.js +678 -0
- package/lib/client/ember-client.js.map +1 -0
- package/lib/client/ember-client.request.d.ts +12 -0
- package/lib/client/ember-client.request.js +22 -0
- package/lib/client/ember-client.request.js.map +1 -0
- package/lib/common/command.d.ts +37 -0
- package/lib/common/command.js +95 -0
- package/lib/common/command.js.map +1 -0
- package/lib/common/common.d.ts +71 -0
- package/lib/common/common.js +310 -0
- package/lib/common/common.js.map +1 -0
- package/lib/common/constants.d.ts +10 -0
- package/lib/common/constants.js +13 -0
- package/lib/common/constants.js.map +1 -0
- package/lib/common/element.base.d.ts +13 -0
- package/lib/common/element.base.js +36 -0
- package/lib/common/element.base.js.map +1 -0
- package/lib/common/element.d.ts +6 -0
- package/lib/common/element.js +23 -0
- package/lib/common/element.js.map +1 -0
- package/lib/common/function/function-argument.d.ts +26 -0
- package/lib/common/function/function-argument.js +75 -0
- package/lib/common/function/function-argument.js.map +1 -0
- package/lib/common/function/function-contents.d.ts +30 -0
- package/lib/common/function/function-contents.js +138 -0
- package/lib/common/function/function-contents.js.map +1 -0
- package/lib/common/function/function.d.ts +31 -0
- package/lib/common/function/function.js +75 -0
- package/lib/common/function/function.js.map +1 -0
- package/lib/common/function/qualified-function.d.ts +19 -0
- package/lib/common/function/qualified-function.js +73 -0
- package/lib/common/function/qualified-function.js.map +1 -0
- package/lib/common/invocation-result.d.ts +23 -0
- package/lib/common/invocation-result.js +101 -0
- package/lib/common/invocation-result.js.map +1 -0
- package/lib/common/invocation.d.ts +20 -0
- package/lib/common/invocation.js +73 -0
- package/lib/common/invocation.js.map +1 -0
- package/lib/common/label.d.ts +14 -0
- package/lib/common/label.js +55 -0
- package/lib/common/label.js.map +1 -0
- package/lib/common/matrix/matrix-connection.d.ts +26 -0
- package/lib/common/matrix/matrix-connection.js +123 -0
- package/lib/common/matrix/matrix-connection.js.map +1 -0
- package/lib/common/matrix/matrix-contents.d.ts +38 -0
- package/lib/common/matrix/matrix-contents.js +173 -0
- package/lib/common/matrix/matrix-contents.js.map +1 -0
- package/lib/common/matrix/matrix-disposition.d.ts +9 -0
- package/lib/common/matrix/matrix-disposition.js +14 -0
- package/lib/common/matrix/matrix-disposition.js.map +1 -0
- package/lib/common/matrix/matrix-mode.d.ts +8 -0
- package/lib/common/matrix/matrix-mode.js +23 -0
- package/lib/common/matrix/matrix-mode.js.map +1 -0
- package/lib/common/matrix/matrix-node.d.ts +13 -0
- package/lib/common/matrix/matrix-node.js +90 -0
- package/lib/common/matrix/matrix-node.js.map +1 -0
- package/lib/common/matrix/matrix-operation.d.ts +8 -0
- package/lib/common/matrix/matrix-operation.js +13 -0
- package/lib/common/matrix/matrix-operation.js.map +1 -0
- package/lib/common/matrix/matrix-type.d.ts +9 -0
- package/lib/common/matrix/matrix-type.js +24 -0
- package/lib/common/matrix/matrix-type.js.map +1 -0
- package/lib/common/matrix/matrix.d.ts +91 -0
- package/lib/common/matrix/matrix.js +429 -0
- package/lib/common/matrix/matrix.js.map +1 -0
- package/lib/common/matrix/qualified-matrix.d.ts +17 -0
- package/lib/common/matrix/qualified-matrix.js +97 -0
- package/lib/common/matrix/qualified-matrix.js.map +1 -0
- package/lib/common/node-contents.d.ts +24 -0
- package/lib/common/node-contents.js +87 -0
- package/lib/common/node-contents.js.map +1 -0
- package/lib/common/node.d.ts +27 -0
- package/lib/common/node.js +67 -0
- package/lib/common/node.js.map +1 -0
- package/lib/common/parameter-access.d.ts +10 -0
- package/lib/common/parameter-access.js +25 -0
- package/lib/common/parameter-access.js.map +1 -0
- package/lib/common/parameter-contents.d.ts +55 -0
- package/lib/common/parameter-contents.js +167 -0
- package/lib/common/parameter-contents.js.map +1 -0
- package/lib/common/parameter-type.d.ts +15 -0
- package/lib/common/parameter-type.js +54 -0
- package/lib/common/parameter-type.js.map +1 -0
- package/lib/common/parameter.d.ts +76 -0
- package/lib/common/parameter.js +174 -0
- package/lib/common/parameter.js.map +1 -0
- package/lib/common/qualified-element.d.ts +10 -0
- package/lib/common/qualified-element.js +36 -0
- package/lib/common/qualified-element.js.map +1 -0
- package/lib/common/qualified-node.d.ts +16 -0
- package/lib/common/qualified-node.js +67 -0
- package/lib/common/qualified-node.js.map +1 -0
- package/lib/common/qualified-parameter.d.ts +52 -0
- package/lib/common/qualified-parameter.js +177 -0
- package/lib/common/qualified-parameter.js.map +1 -0
- package/lib/common/qualified-template.d.ts +17 -0
- package/lib/common/qualified-template.js +58 -0
- package/lib/common/qualified-template.js.map +1 -0
- package/lib/common/stream/stream-collection.d.ts +20 -0
- package/lib/common/stream/stream-collection.js +57 -0
- package/lib/common/stream/stream-collection.js.map +1 -0
- package/lib/common/stream/stream-description.d.ts +15 -0
- package/lib/common/stream/stream-description.js +45 -0
- package/lib/common/stream/stream-description.js.map +1 -0
- package/lib/common/stream/stream-entry.d.ts +15 -0
- package/lib/common/stream/stream-entry.js +49 -0
- package/lib/common/stream/stream-entry.js.map +1 -0
- package/lib/common/stream/stream-format.d.ts +23 -0
- package/lib/common/stream/stream-format.js +28 -0
- package/lib/common/stream/stream-format.js.map +1 -0
- package/lib/common/string-integer-collection.d.ts +12 -0
- package/lib/common/string-integer-collection.js +51 -0
- package/lib/common/string-integer-collection.js.map +1 -0
- package/lib/common/string-integer-pair.d.ts +18 -0
- package/lib/common/string-integer-pair.js +67 -0
- package/lib/common/string-integer-pair.js.map +1 -0
- package/lib/common/template-element.d.ts +12 -0
- package/lib/common/template-element.js +53 -0
- package/lib/common/template-element.js.map +1 -0
- package/lib/common/template.d.ts +16 -0
- package/lib/common/template.js +58 -0
- package/lib/common/template.js.map +1 -0
- package/lib/common/tree-node.d.ts +85 -0
- package/lib/common/tree-node.js +461 -0
- package/lib/common/tree-node.js.map +1 -0
- package/lib/error/errors.d.ts +57 -0
- package/lib/error/errors.js +150 -0
- package/lib/error/errors.js.map +1 -0
- package/lib/fixture/utils.d.ts +7 -0
- package/lib/fixture/utils.js +185 -0
- package/lib/fixture/utils.js.map +1 -0
- package/lib/index.d.ts +41 -0
- package/lib/index.js +15 -0
- package/lib/index.js.map +1 -0
- package/lib/logging/logging.service.d.ts +45 -0
- package/lib/logging/logging.service.js +110 -0
- package/lib/logging/logging.service.js.map +1 -0
- package/lib/server/client-request.d.ts +9 -0
- package/lib/server/client-request.js +10 -0
- package/lib/server/client-request.js.map +1 -0
- package/lib/server/element-handlers.d.ts +20 -0
- package/lib/server/element-handlers.js +105 -0
- package/lib/server/element-handlers.js.map +1 -0
- package/lib/server/ember-server.d.ts +84 -0
- package/lib/server/ember-server.events.d.ts +23 -0
- package/lib/server/ember-server.events.js +46 -0
- package/lib/server/ember-server.events.js.map +1 -0
- package/lib/server/ember-server.interface.d.ts +26 -0
- package/lib/server/ember-server.interface.js +3 -0
- package/lib/server/ember-server.interface.js.map +1 -0
- package/lib/server/ember-server.js +422 -0
- package/lib/server/ember-server.js.map +1 -0
- package/lib/server/ember-server.logs.d.ts +4 -0
- package/lib/server/ember-server.logs.js +274 -0
- package/lib/server/ember-server.logs.js.map +1 -0
- package/lib/server/json.parser.d.ts +13 -0
- package/lib/server/json.parser.js +209 -0
- package/lib/server/json.parser.js.map +1 -0
- package/lib/server/matrix.handlers.d.ts +10 -0
- package/lib/server/matrix.handlers.js +103 -0
- package/lib/server/matrix.handlers.js.map +1 -0
- package/lib/server/node.handlers.d.ts +12 -0
- package/lib/server/node.handlers.js +85 -0
- package/lib/server/node.handlers.js.map +1 -0
- package/lib/server/qualified.handlers.d.ts +15 -0
- package/lib/server/qualified.handlers.js +54 -0
- package/lib/server/qualified.handlers.js.map +1 -0
- package/lib/socket/s101.client.d.ts +17 -0
- package/lib/socket/s101.client.js +53 -0
- package/lib/socket/s101.client.js.map +1 -0
- package/lib/socket/s101.codec.d.ts +32 -0
- package/lib/socket/s101.codec.js +301 -0
- package/lib/socket/s101.codec.js.map +1 -0
- package/lib/socket/s101.packet-stats.socket.d.ts +31 -0
- package/lib/socket/s101.packet-stats.socket.js +74 -0
- package/lib/socket/s101.packet-stats.socket.js.map +1 -0
- package/lib/socket/s101.server.d.ts +28 -0
- package/lib/socket/s101.server.js +87 -0
- package/lib/socket/s101.server.js.map +1 -0
- package/lib/socket/s101.socket.d.ts +75 -0
- package/lib/socket/s101.socket.js +300 -0
- package/lib/socket/s101.socket.js.map +1 -0
- package/lib/socket/stats-collector.d.ts +19 -0
- package/lib/socket/stats-collector.js +63 -0
- package/lib/socket/stats-collector.js.map +1 -0
- package/lib/tools/debug.d.ts +2 -0
- package/lib/tools/debug.js +21 -0
- package/lib/tools/debug.js.map +1 -0
- package/lib/tools/jsontree.d.ts +1 -0
- package/lib/tools/jsontree.js +36 -0
- package/lib/tools/jsontree.js.map +1 -0
- package/lib/tools/monitoring-client.d.ts +2 -0
- package/lib/tools/monitoring-client.js +186 -0
- package/lib/tools/monitoring-client.js.map +1 -0
- package/lib/tools/serve.d.ts +1 -0
- package/lib/tools/serve.js +129 -0
- package/lib/tools/serve.js.map +1 -0
- package/package.json +105 -0
@@ -0,0 +1,678 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
12
|
+
if (mod && mod.__esModule) return mod;
|
13
|
+
var result = {};
|
14
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
15
|
+
result["default"] = mod;
|
16
|
+
return result;
|
17
|
+
};
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
19
|
+
const events_1 = require("events");
|
20
|
+
const s101_client_1 = require("../socket/s101.client");
|
21
|
+
const BER = __importStar(require("../ber"));
|
22
|
+
const ember_client_request_1 = require("./ember-client.request");
|
23
|
+
const s101_client_2 = require("../socket/s101.client");
|
24
|
+
const ember_client_events_1 = require("./ember-client.events");
|
25
|
+
const errors_1 = require("../error/errors");
|
26
|
+
const tree_node_1 = require("../common/tree-node");
|
27
|
+
const invocation_result_1 = require("../common/invocation-result");
|
28
|
+
const matrix_operation_1 = require("../common/matrix/matrix-operation");
|
29
|
+
const matrix_connection_1 = require("../common/matrix/matrix-connection");
|
30
|
+
const stream_collection_1 = require("../common/stream/stream-collection");
|
31
|
+
const stream_entry_1 = require("../common/stream/stream-entry");
|
32
|
+
const ember_client_logs_1 = require("./ember-client-logs");
|
33
|
+
const parameter_contents_1 = require("../common/parameter-contents");
|
34
|
+
const common_1 = require("../common/common");
|
35
|
+
exports.DEFAULT_PORT = 9000;
|
36
|
+
exports.DEFAULT_TIMEOUT = 3000;
|
37
|
+
class EmberClient extends events_1.EventEmitter {
|
38
|
+
constructor(options) {
|
39
|
+
super();
|
40
|
+
this.timeoutValue = options.timeoutValue || exports.DEFAULT_TIMEOUT;
|
41
|
+
this._host = options.host;
|
42
|
+
this._port = options.port || exports.DEFAULT_PORT;
|
43
|
+
this._logger = options.logger;
|
44
|
+
this._pendingRequests = [];
|
45
|
+
this._activeRequest = null;
|
46
|
+
this._timeout = null;
|
47
|
+
this._callback = undefined;
|
48
|
+
this._requestID = 0;
|
49
|
+
this._streams = new stream_collection_1.StreamCollection();
|
50
|
+
this.root = new tree_node_1.TreeNode();
|
51
|
+
this.socket = new s101_client_1.S101Client(this._host, this._port);
|
52
|
+
this.socket.on(s101_client_2.S101ClientEvent.CONNECTING, () => {
|
53
|
+
this.emit(ember_client_events_1.EmberClientEvent.CONNECTING);
|
54
|
+
});
|
55
|
+
this.socket.on(s101_client_2.S101ClientEvent.CONNECTED, () => {
|
56
|
+
this.emit(ember_client_events_1.EmberClientEvent.CONNECTED);
|
57
|
+
this.socket.startDeadTimer();
|
58
|
+
if (this._callback != null) {
|
59
|
+
this._callback();
|
60
|
+
}
|
61
|
+
});
|
62
|
+
this.socket.on(s101_client_2.S101ClientEvent.DISCONNECTED, () => {
|
63
|
+
this.emit(ember_client_events_1.EmberClientEvent.DISCONNECTED);
|
64
|
+
});
|
65
|
+
this.socket.on(s101_client_2.S101ClientEvent.ERROR, e => {
|
66
|
+
if (this._callback != null) {
|
67
|
+
this._callback(e);
|
68
|
+
}
|
69
|
+
this.emit(ember_client_events_1.EmberClientEvent.ERROR, e);
|
70
|
+
});
|
71
|
+
this.socket.on(s101_client_2.S101ClientEvent.EMBER_TREE, root => {
|
72
|
+
var _a;
|
73
|
+
try {
|
74
|
+
if (root instanceof invocation_result_1.InvocationResult) {
|
75
|
+
this.emit(ember_client_events_1.EmberClientEvent.INVOCATION_RESULT, root);
|
76
|
+
if (this._callback) {
|
77
|
+
this._callback(undefined, root);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
else if (root instanceof tree_node_1.TreeNode) {
|
81
|
+
this.handleRoot(root);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
catch (e) {
|
85
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.INVALID_EMBER_MESSAGE_RECEIVED(e));
|
86
|
+
if (this._callback) {
|
87
|
+
this._callback(e);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
});
|
91
|
+
}
|
92
|
+
get logger() {
|
93
|
+
return this._logger;
|
94
|
+
}
|
95
|
+
static isDirectSubPathOf(path, parent) {
|
96
|
+
return path === parent || (path.lastIndexOf('.') === parent.length && path.startsWith(parent));
|
97
|
+
}
|
98
|
+
connectAsync(timeout = 2) {
|
99
|
+
return new Promise((resolve, reject) => {
|
100
|
+
var _a;
|
101
|
+
this._callback = e => {
|
102
|
+
var _a, _b;
|
103
|
+
this._callback = undefined;
|
104
|
+
if (e === undefined) {
|
105
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.CONNECTED(this.socket.remoteAddress));
|
106
|
+
return resolve();
|
107
|
+
}
|
108
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.log(ember_client_logs_1.ClientLogs.CONNECTION_FAILED(this.socket.remoteAddress, e));
|
109
|
+
return reject(e);
|
110
|
+
};
|
111
|
+
if (this.socket.isConnected()) {
|
112
|
+
throw new errors_1.S101SocketError('Already connected');
|
113
|
+
}
|
114
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.CONNECTING(`${this._host}:${this._port}`));
|
115
|
+
this.socket.connect(timeout);
|
116
|
+
});
|
117
|
+
}
|
118
|
+
disconnectAsync() {
|
119
|
+
var _a;
|
120
|
+
if (this.isConnected()) {
|
121
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.DISCONNECTING(this.socket.remoteAddress));
|
122
|
+
return this.socket.disconnectAsync();
|
123
|
+
}
|
124
|
+
return Promise.resolve();
|
125
|
+
}
|
126
|
+
expandAsync(node, callback) {
|
127
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
129
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.EXPANDING_NODE(node));
|
130
|
+
let errors = [];
|
131
|
+
if ((_b = node) === null || _b === void 0 ? void 0 : _b.isTemplate()) {
|
132
|
+
(_c = this.logger) === null || _c === void 0 ? void 0 : _c.log(ember_client_logs_1.ClientLogs.EXPAND_NODE_COMPLETE(node));
|
133
|
+
return;
|
134
|
+
}
|
135
|
+
if (node != null && (node.isParameter() || node.isMatrix() || node.isFunction())) {
|
136
|
+
yield this.getDirectoryAsync(node, callback);
|
137
|
+
if (node.isMatrix()) {
|
138
|
+
const matrix = node;
|
139
|
+
if (matrix.parametersLocation) {
|
140
|
+
let paramRoot = common_1.createTreeBranch(this.root, matrix.parametersLocation);
|
141
|
+
yield this.getDirectoryAsync(paramRoot, callback);
|
142
|
+
paramRoot = this.root.getElementByPath(matrix.parametersLocation);
|
143
|
+
try {
|
144
|
+
yield this.expandAsync(paramRoot, callback);
|
145
|
+
}
|
146
|
+
catch (e) {
|
147
|
+
if (e instanceof errors_1.ErrorMultipleError) {
|
148
|
+
errors = errors.concat(e.errors);
|
149
|
+
}
|
150
|
+
else {
|
151
|
+
(_d = this.logger) === null || _d === void 0 ? void 0 : _d.log(ember_client_logs_1.ClientLogs.EXPAND_NODE_ERROR(paramRoot, e));
|
152
|
+
errors.push(e);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
}
|
156
|
+
if (matrix.labels != null) {
|
157
|
+
for (const label of matrix.labels) {
|
158
|
+
let labelRoot = common_1.createTreeBranch(this.root, label.basePath);
|
159
|
+
yield this.getDirectoryAsync(labelRoot, callback);
|
160
|
+
labelRoot = this.root.getElementByPath(label.basePath);
|
161
|
+
labelRoot = labelRoot.toQualified();
|
162
|
+
yield this.expandAsync(labelRoot, callback);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
const res = yield this.getDirectoryAsync(node, callback);
|
169
|
+
if (res == null) {
|
170
|
+
(_e = this.logger) === null || _e === void 0 ? void 0 : _e.log(ember_client_logs_1.ClientLogs.EXPAND_WITH_NO_CHILD(node));
|
171
|
+
return;
|
172
|
+
}
|
173
|
+
const children = (_f = res) === null || _f === void 0 ? void 0 : _f.getChildren();
|
174
|
+
if (children == null) {
|
175
|
+
(_g = this.logger) === null || _g === void 0 ? void 0 : _g.log(ember_client_logs_1.ClientLogs.EXPAND_WITH_NO_CHILD(node));
|
176
|
+
return;
|
177
|
+
}
|
178
|
+
for (const child of children) {
|
179
|
+
try {
|
180
|
+
yield this.expandAsync(child, callback);
|
181
|
+
}
|
182
|
+
catch (e) {
|
183
|
+
if (e instanceof errors_1.ErrorMultipleError) {
|
184
|
+
errors = errors.concat(e.errors);
|
185
|
+
}
|
186
|
+
else {
|
187
|
+
(_h = this.logger) === null || _h === void 0 ? void 0 : _h.log(ember_client_logs_1.ClientLogs.EXPAND_NODE_ERROR(child, e));
|
188
|
+
errors.push(e);
|
189
|
+
}
|
190
|
+
}
|
191
|
+
}
|
192
|
+
(_j = this.logger) === null || _j === void 0 ? void 0 : _j.log(ember_client_logs_1.ClientLogs.EXPAND_NODE_COMPLETE(node));
|
193
|
+
if (errors.length > 0) {
|
194
|
+
throw new errors_1.ErrorMultipleError(errors);
|
195
|
+
}
|
196
|
+
});
|
197
|
+
}
|
198
|
+
getDirectoryAsync(qNode, callback) {
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
200
|
+
if (qNode == null) {
|
201
|
+
this.root.clear();
|
202
|
+
qNode = this.root;
|
203
|
+
}
|
204
|
+
const response = yield this.makeRequestAsync(() => {
|
205
|
+
var _a;
|
206
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.GETDIRECTORY_SENDING_QUERY(qNode));
|
207
|
+
const data = qNode.getDirectory(callback);
|
208
|
+
this.socket.sendBERNode(qNode.getDirectory(callback));
|
209
|
+
}, (err, node) => {
|
210
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
211
|
+
const requestedPath = qNode.getPath();
|
212
|
+
if (err) {
|
213
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.GETDIRECTORY_ERROR(err));
|
214
|
+
throw err;
|
215
|
+
}
|
216
|
+
if (!qNode.isQualified() && qNode.isRoot()) {
|
217
|
+
const elements = qNode.getChildren();
|
218
|
+
if (elements == null || elements.length === 0) {
|
219
|
+
throw new errors_1.InvalidEmberResponseError('Get root directory');
|
220
|
+
}
|
221
|
+
const nodeElements = (_b = node) === null || _b === void 0 ? void 0 : _b.getChildren();
|
222
|
+
if (nodeElements != null
|
223
|
+
&& nodeElements.every((el) => el._parent instanceof tree_node_1.TreeNode)) {
|
224
|
+
(_c = this.logger) === null || _c === void 0 ? void 0 : _c.log(ember_client_logs_1.ClientLogs.GETDIRECTORY_RESPONSE(node));
|
225
|
+
return node;
|
226
|
+
}
|
227
|
+
else {
|
228
|
+
throw new errors_1.InvalidEmberResponseError(`getDirectory ${requestedPath}`);
|
229
|
+
}
|
230
|
+
}
|
231
|
+
else if (node.getElementByPath(requestedPath) != null) {
|
232
|
+
(_d = this.logger) === null || _d === void 0 ? void 0 : _d.log(ember_client_logs_1.ClientLogs.GETDIRECTORY_RESPONSE(node));
|
233
|
+
if (node.isStream()) {
|
234
|
+
const streamIdentifier = node.streamIdentifier;
|
235
|
+
const streamEntry = this._streams.getEntry(streamIdentifier);
|
236
|
+
if (streamEntry != null && streamEntry.value !== requestedPath) {
|
237
|
+
(_e = this.logger) === null || _e === void 0 ? void 0 : _e.log(ember_client_logs_1.ClientLogs.DUPLICATE_STREAM_IDENTIFIER(streamIdentifier, requestedPath, streamEntry.value));
|
238
|
+
}
|
239
|
+
else {
|
240
|
+
(_f = this.logger) === null || _f === void 0 ? void 0 : _f.log(ember_client_logs_1.ClientLogs.ADDING_STREAM_IDENTIFIER(streamIdentifier, requestedPath));
|
241
|
+
this._streams.addEntry(new stream_entry_1.StreamEntry(streamIdentifier, requestedPath));
|
242
|
+
}
|
243
|
+
}
|
244
|
+
return node;
|
245
|
+
}
|
246
|
+
else {
|
247
|
+
const nodeElements = (_g = node) === null || _g === void 0 ? void 0 : _g.getChildren();
|
248
|
+
if (nodeElements != null &&
|
249
|
+
((qNode.isMatrix() &&
|
250
|
+
nodeElements.length === 1 &&
|
251
|
+
nodeElements[0].getPath() === requestedPath) ||
|
252
|
+
(!qNode.isMatrix() &&
|
253
|
+
nodeElements.every((el) => EmberClient.isDirectSubPathOf(el.getPath(), requestedPath))))) {
|
254
|
+
(_h = this.logger) === null || _h === void 0 ? void 0 : _h.log(ember_client_logs_1.ClientLogs.GETDIRECTORY_RESPONSE(node));
|
255
|
+
return node;
|
256
|
+
}
|
257
|
+
else {
|
258
|
+
(_j = this.logger) === null || _j === void 0 ? void 0 : _j.log(ember_client_logs_1.ClientLogs.GETDIRECTORY_UNEXPECTED_RESPONSE(qNode, node));
|
259
|
+
return undefined;
|
260
|
+
}
|
261
|
+
}
|
262
|
+
}, qNode);
|
263
|
+
return response;
|
264
|
+
});
|
265
|
+
}
|
266
|
+
getElementByPathAsync(path, callback) {
|
267
|
+
var _a, _b;
|
268
|
+
return __awaiter(this, void 0, void 0, function* () {
|
269
|
+
const pathError = new errors_1.PathDiscoveryFailureError(path);
|
270
|
+
const TYPE_NUM = 1;
|
271
|
+
const TYPE_ID = 2;
|
272
|
+
let type = TYPE_NUM;
|
273
|
+
let pathArray = [];
|
274
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.GET_ELEMENT_REQUEST(path));
|
275
|
+
if (path.indexOf('/') >= 0) {
|
276
|
+
type = TYPE_ID;
|
277
|
+
pathArray = path.split('/');
|
278
|
+
}
|
279
|
+
else {
|
280
|
+
pathArray = path.split('.');
|
281
|
+
if (pathArray.length === 1) {
|
282
|
+
if (isNaN(Number(pathArray[0]))) {
|
283
|
+
type = TYPE_ID;
|
284
|
+
}
|
285
|
+
}
|
286
|
+
}
|
287
|
+
let pos = 0;
|
288
|
+
let lastMissingPos = -1;
|
289
|
+
let currentNode = this.root;
|
290
|
+
const getNext = () => __awaiter(this, void 0, void 0, function* () {
|
291
|
+
let node;
|
292
|
+
if (type === TYPE_NUM) {
|
293
|
+
const number = Number(pathArray[pos]);
|
294
|
+
node = currentNode.getElementByNumber(number);
|
295
|
+
}
|
296
|
+
else {
|
297
|
+
const children = currentNode.getChildren();
|
298
|
+
const identifier = pathArray[pos];
|
299
|
+
if (children != null) {
|
300
|
+
let i = 0;
|
301
|
+
for (i = 0; i < children.length; i++) {
|
302
|
+
node = children[i];
|
303
|
+
if (node.contents != null && node.contents.identifier === identifier) {
|
304
|
+
break;
|
305
|
+
}
|
306
|
+
}
|
307
|
+
if (i >= children.length) {
|
308
|
+
node = null;
|
309
|
+
}
|
310
|
+
}
|
311
|
+
}
|
312
|
+
if (node != null) {
|
313
|
+
pos++;
|
314
|
+
if (pos >= pathArray.length) {
|
315
|
+
yield this.getDirectoryAsync(node, callback);
|
316
|
+
return node;
|
317
|
+
}
|
318
|
+
currentNode = node;
|
319
|
+
return getNext();
|
320
|
+
}
|
321
|
+
if (lastMissingPos === pos) {
|
322
|
+
throw pathError;
|
323
|
+
}
|
324
|
+
lastMissingPos = pos;
|
325
|
+
yield this.getDirectoryAsync(currentNode, callback);
|
326
|
+
return getNext();
|
327
|
+
});
|
328
|
+
const response = yield getNext();
|
329
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.log(ember_client_logs_1.ClientLogs.GET_ELEMENT_RESPONSE(path, response));
|
330
|
+
return response;
|
331
|
+
});
|
332
|
+
}
|
333
|
+
getStats() {
|
334
|
+
return this.socket.getStats();
|
335
|
+
}
|
336
|
+
invokeFunctionAsync(fnNode, params) {
|
337
|
+
return __awaiter(this, void 0, void 0, function* () {
|
338
|
+
const res = yield this.makeRequestAsync(() => {
|
339
|
+
var _a;
|
340
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.INVOCATION_SENDING_QUERY(fnNode));
|
341
|
+
this.socket.sendBERNode(fnNode.invoke(params));
|
342
|
+
}, (err, result) => {
|
343
|
+
var _a, _b;
|
344
|
+
if (err) {
|
345
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.INVOCATION_ERROR(err));
|
346
|
+
throw err;
|
347
|
+
}
|
348
|
+
else {
|
349
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.log(ember_client_logs_1.ClientLogs.INVOCATION_RESULT_RECEIVED(result));
|
350
|
+
return result;
|
351
|
+
}
|
352
|
+
}, fnNode);
|
353
|
+
return res;
|
354
|
+
});
|
355
|
+
}
|
356
|
+
isConnected() {
|
357
|
+
var _a;
|
358
|
+
return (_a = this.socket) === null || _a === void 0 ? void 0 : _a.isConnected();
|
359
|
+
}
|
360
|
+
matrixConnectAsync(matrixNode, targetID, sources) {
|
361
|
+
var _a;
|
362
|
+
return __awaiter(this, void 0, void 0, function* () {
|
363
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.MATRIX_CONNECTION_REQUEST(matrixNode, targetID, sources));
|
364
|
+
return this.matrixOperationAsync(matrixNode, targetID, sources, matrix_operation_1.MatrixOperation.connect);
|
365
|
+
});
|
366
|
+
}
|
367
|
+
matrixDisconnectAsync(matrixNode, targetID, sources) {
|
368
|
+
var _a;
|
369
|
+
return __awaiter(this, void 0, void 0, function* () {
|
370
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.MATRIX_DISCONNECTION_REQUEST(matrixNode, targetID, sources));
|
371
|
+
return this.matrixOperationAsync(matrixNode, targetID, sources, matrix_operation_1.MatrixOperation.disconnect);
|
372
|
+
});
|
373
|
+
}
|
374
|
+
matrixSetConnection(matrixNode, targetID, sources) {
|
375
|
+
var _a;
|
376
|
+
return __awaiter(this, void 0, void 0, function* () {
|
377
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.MATRIX_ABSOLUTE_CONNECTION_REQUEST(matrixNode, targetID, sources));
|
378
|
+
return this.matrixOperationAsync(matrixNode, targetID, sources, matrix_operation_1.MatrixOperation.absolute);
|
379
|
+
});
|
380
|
+
}
|
381
|
+
saveTree(f) {
|
382
|
+
const writer = new BER.ExtendedWriter();
|
383
|
+
this.root.encode(writer);
|
384
|
+
f(writer.buffer);
|
385
|
+
}
|
386
|
+
setLogLevel(logLevel) {
|
387
|
+
var _a;
|
388
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.setLogLevel(logLevel);
|
389
|
+
}
|
390
|
+
|
391
|
+
//new Set Value
|
392
|
+
setValue(node, value, type) {
|
393
|
+
if (!node.isParameter()) {
|
394
|
+
throw new errors_1.InvalidEmberNodeError(node.getPath(), 'not a Parameter');
|
395
|
+
}
|
396
|
+
else {
|
397
|
+
var _a;
|
398
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.SETVALUE_REQUEST(node, value));
|
399
|
+
try {
|
400
|
+
this.socket.sendBERNode(node.setValue(parameter_contents_1.ParameterContents.createParameterContent(value, type)));
|
401
|
+
} catch (err) {
|
402
|
+
console.log(err);
|
403
|
+
}
|
404
|
+
}
|
405
|
+
}
|
406
|
+
|
407
|
+
setValueAsync(node, value, type) {
|
408
|
+
return __awaiter(this, void 0, void 0, function* () {
|
409
|
+
if (!node.isParameter()) {
|
410
|
+
throw new errors_1.InvalidEmberNodeError(node.getPath(), 'not a Parameter');
|
411
|
+
}
|
412
|
+
else {
|
413
|
+
var _a;
|
414
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.SETVALUE_REQUEST(node, value));
|
415
|
+
this.socket.sendBERNode(node.setValue(parameter_contents_1.ParameterContents.createParameterContent(value, type)));
|
416
|
+
}
|
417
|
+
|
418
|
+
return this.makeRequestAsync(() => {
|
419
|
+
var _a;
|
420
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.SETVALUE_REQUEST(node, value));
|
421
|
+
this.socket.sendBERNode(node.setValue(parameter_contents_1.ParameterContents.createParameterContent(value, type)));
|
422
|
+
}, (err, n) => {
|
423
|
+
var _a, _b;
|
424
|
+
if (err) {
|
425
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.SETVALUE_REQUEST_ERROR(node, value));
|
426
|
+
throw err;
|
427
|
+
}
|
428
|
+
else {
|
429
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.log(ember_client_logs_1.ClientLogs.SETVALUE_REQUEST_SUCCESS(node, value));
|
430
|
+
return n;
|
431
|
+
}
|
432
|
+
}, node);
|
433
|
+
});
|
434
|
+
}
|
435
|
+
|
436
|
+
|
437
|
+
subscribeAsync(qNode, callback) {
|
438
|
+
var _a;
|
439
|
+
return __awaiter(this, void 0, void 0, function* () {
|
440
|
+
if ((qNode.isParameter() || qNode.isMatrix()) && qNode.isStream()) {
|
441
|
+
return this.makeRequestAsync(() => {
|
442
|
+
var _a;
|
443
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.SUBSCRIBE_REQUEST(qNode));
|
444
|
+
this.socket.sendBERNode(qNode.subscribe(callback));
|
445
|
+
this._streams.addEntry(new stream_entry_1.StreamEntry(qNode.contents.streamIdentifier, qNode.getPath()));
|
446
|
+
return;
|
447
|
+
}, null, qNode);
|
448
|
+
}
|
449
|
+
else {
|
450
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.INVALID_SUBSCRIBE_REQUEST(qNode));
|
451
|
+
}
|
452
|
+
});
|
453
|
+
}
|
454
|
+
unsubscribeAsync(qNode, callback) {
|
455
|
+
var _a;
|
456
|
+
return __awaiter(this, void 0, void 0, function* () {
|
457
|
+
if (qNode.isParameter() && qNode.isStream()) {
|
458
|
+
return this.makeRequestAsync(() => {
|
459
|
+
var _a;
|
460
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.UNSUBSCRIBE_REQUEST(qNode));
|
461
|
+
this.socket.sendBERNode(qNode.unsubscribe(callback));
|
462
|
+
const entry = this._streams.getEntry(qNode.contents.streamIdentifier);
|
463
|
+
if (entry != null) {
|
464
|
+
this._streams.removeEntry(entry);
|
465
|
+
}
|
466
|
+
}, undefined, qNode);
|
467
|
+
}
|
468
|
+
else {
|
469
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.INVALID_UNSUBSCRIBE_REQUEST(qNode));
|
470
|
+
}
|
471
|
+
});
|
472
|
+
}
|
473
|
+
matrixOperationAsync(matrixNode, targetID, sources, operation = matrix_operation_1.MatrixOperation.connect) {
|
474
|
+
return __awaiter(this, void 0, void 0, function* () {
|
475
|
+
matrixNode.validateConnection(targetID, sources);
|
476
|
+
const connections = {};
|
477
|
+
const targetConnection = new matrix_connection_1.MatrixConnection(targetID);
|
478
|
+
targetConnection.operation = operation;
|
479
|
+
targetConnection.setSources(sources);
|
480
|
+
connections[targetID] = targetConnection;
|
481
|
+
return this.makeRequestAsync(() => {
|
482
|
+
this.socket.sendBERNode(matrixNode.connect(connections));
|
483
|
+
}, (err, node) => {
|
484
|
+
var _a, _b, _c;
|
485
|
+
const requestedPath = matrixNode.getPath();
|
486
|
+
if (err) {
|
487
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.MATRIX_OPERATION_ERROR(matrixNode, targetID, sources));
|
488
|
+
throw err;
|
489
|
+
}
|
490
|
+
if (node == null) {
|
491
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.log(ember_client_logs_1.ClientLogs.MATRIX_OPERATION_UNEXPECTED_ANSWER(matrixNode, targetID, sources));
|
492
|
+
return undefined;
|
493
|
+
}
|
494
|
+
let matrix = null;
|
495
|
+
if (node != null) {
|
496
|
+
matrix = node.getElementByPath(requestedPath);
|
497
|
+
}
|
498
|
+
if (matrix != null && matrix.isMatrix() && matrix.getPath() === requestedPath) {
|
499
|
+
return matrix;
|
500
|
+
}
|
501
|
+
else {
|
502
|
+
(_c = this.logger) === null || _c === void 0 ? void 0 : _c.log(ember_client_logs_1.ClientLogs.MATRIX_OPERATION_UNEXPECTED_ANSWER(matrixNode, targetID, sources));
|
503
|
+
return undefined;
|
504
|
+
}
|
505
|
+
}, matrixNode);
|
506
|
+
});
|
507
|
+
}
|
508
|
+
handleRoot(root) {
|
509
|
+
var _a, _b;
|
510
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.EMBER_MESSAGE_RECEIVED());
|
511
|
+
this.root.update(root);
|
512
|
+
if (root.elements != null) {
|
513
|
+
const elements = root.getChildren();
|
514
|
+
for (let i = 0; i < elements.length; i++) {
|
515
|
+
if (elements[i].isQualified()) {
|
516
|
+
this.handleQualifiedNode(this.root, elements[i]);
|
517
|
+
}
|
518
|
+
else {
|
519
|
+
this.handleNode(this.root, elements[i]);
|
520
|
+
}
|
521
|
+
}
|
522
|
+
}
|
523
|
+
if (root.getStreams() != null) {
|
524
|
+
const streams = root.getStreams();
|
525
|
+
for (const streamEntry of streams) {
|
526
|
+
const pathContainer = this._streams.getEntry(streamEntry.identifier);
|
527
|
+
if (pathContainer == null) {
|
528
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.log(ember_client_logs_1.ClientLogs.UNKOWN_STREAM_RECEIVED(streamEntry.identifier));
|
529
|
+
continue;
|
530
|
+
}
|
531
|
+
const element = this.root.getElementByPath(pathContainer.value);
|
532
|
+
if (element != null && element.isParameter() && element.isStream()
|
533
|
+
&& element.contents.value !== streamEntry.value) {
|
534
|
+
element.contents.value = streamEntry.value;
|
535
|
+
element.updateSubscribers();
|
536
|
+
}
|
537
|
+
}
|
538
|
+
}
|
539
|
+
if (this._callback) {
|
540
|
+
this._callback(null, root);
|
541
|
+
}
|
542
|
+
}
|
543
|
+
finishRequest() {
|
544
|
+
var _a;
|
545
|
+
this.clearTimeout();
|
546
|
+
this._callback = undefined;
|
547
|
+
this._activeRequest = null;
|
548
|
+
try {
|
549
|
+
this.makeRequest();
|
550
|
+
}
|
551
|
+
catch (e) {
|
552
|
+
if (this._callback != null) {
|
553
|
+
this._callback(e);
|
554
|
+
}
|
555
|
+
else {
|
556
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.REQUEST_FAILURE(e));
|
557
|
+
}
|
558
|
+
this.emit(ember_client_events_1.EmberClientEvent.ERROR, e);
|
559
|
+
}
|
560
|
+
}
|
561
|
+
makeRequest() {
|
562
|
+
var _a;
|
563
|
+
if (this._activeRequest == null && this._pendingRequests.length > 0) {
|
564
|
+
this._activeRequest = this._pendingRequests.shift();
|
565
|
+
const req = `${this._requestID++} - ${this._activeRequest.node.getPath()}`;
|
566
|
+
this._activeRequest.timeoutError = new errors_1.EmberTimeoutError(`Request ${req} timed out`);
|
567
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.MAKING_REQUEST());
|
568
|
+
this._timeout = setTimeout(() => {
|
569
|
+
var _a;
|
570
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.REQUEST_FAILURE(this._activeRequest.timeoutError));
|
571
|
+
if (this._callback != null) {
|
572
|
+
this._callback(this._activeRequest.timeoutError);
|
573
|
+
}
|
574
|
+
}, this.timeoutValue);
|
575
|
+
this._activeRequest.func();
|
576
|
+
}
|
577
|
+
}
|
578
|
+
makeRequestAsync(action, cb, node) {
|
579
|
+
return new Promise((resolve, reject) => {
|
580
|
+
const req = new ember_client_request_1.Request(node, () => {
|
581
|
+
if (cb != null) {
|
582
|
+
this._callback = (e, d) => {
|
583
|
+
try {
|
584
|
+
const res = cb(e, d);
|
585
|
+
if (res === undefined) {
|
586
|
+
return;
|
587
|
+
}
|
588
|
+
this.finishRequest();
|
589
|
+
resolve(res);
|
590
|
+
}
|
591
|
+
catch (error) {
|
592
|
+
this.finishRequest();
|
593
|
+
reject(error);
|
594
|
+
}
|
595
|
+
};
|
596
|
+
}
|
597
|
+
try {
|
598
|
+
const res = action();
|
599
|
+
if (cb == null) {
|
600
|
+
this.finishRequest();
|
601
|
+
resolve(res);
|
602
|
+
}
|
603
|
+
}
|
604
|
+
catch (e) {
|
605
|
+
reject(e);
|
606
|
+
}
|
607
|
+
});
|
608
|
+
this._pendingRequests.push(req);
|
609
|
+
this.makeRequest();
|
610
|
+
});
|
611
|
+
}
|
612
|
+
clearTimeout() {
|
613
|
+
if (this._timeout != null) {
|
614
|
+
clearTimeout(this._timeout);
|
615
|
+
this._timeout = null;
|
616
|
+
}
|
617
|
+
}
|
618
|
+
handleNode(parent, node) {
|
619
|
+
if (!(node instanceof tree_node_1.TreeNode)) {
|
620
|
+
throw new errors_1.InvalidEmberNodeError(parent.getPath(), 'children not a valid TreeNode');
|
621
|
+
}
|
622
|
+
let originalNode = parent.getElementByNumber(node.getNumber());
|
623
|
+
if (originalNode == null) {
|
624
|
+
parent.addChild(node);
|
625
|
+
originalNode = node;
|
626
|
+
}
|
627
|
+
else if (originalNode.update(node)) {
|
628
|
+
originalNode.updateSubscribers();
|
629
|
+
this.emit(ember_client_events_1.EmberClientEvent.VALUE_CHANGE, originalNode);
|
630
|
+
}
|
631
|
+
const children = node.getChildren();
|
632
|
+
if (children !== null) {
|
633
|
+
for (let i = 0; i < children.length; i++) {
|
634
|
+
this.handleNode(originalNode, children[i]);
|
635
|
+
}
|
636
|
+
}
|
637
|
+
}
|
638
|
+
handleQualifiedNode(parent, node) {
|
639
|
+
var _a;
|
640
|
+
let element = parent.getElementByPath(node.path);
|
641
|
+
if (element !== null) {
|
642
|
+
if (element.update(node)) {
|
643
|
+
element.updateSubscribers();
|
644
|
+
this.emit(ember_client_events_1.EmberClientEvent.VALUE_CHANGE, element);
|
645
|
+
}
|
646
|
+
}
|
647
|
+
else {
|
648
|
+
const path = node.path.split('.');
|
649
|
+
if (path.length === 1) {
|
650
|
+
this.root.addChild(node);
|
651
|
+
}
|
652
|
+
else {
|
653
|
+
const parentPath = path.slice(0, path.length - 1).join('.');
|
654
|
+
parent = this.root.getElementByPath(parentPath);
|
655
|
+
if (parent == null) {
|
656
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(ember_client_logs_1.ClientLogs.UNKOWN_ELEMENT_RECEIVED(parentPath));
|
657
|
+
return;
|
658
|
+
}
|
659
|
+
parent.addChild(node);
|
660
|
+
parent.update(parent);
|
661
|
+
}
|
662
|
+
element = node;
|
663
|
+
}
|
664
|
+
const children = node.getChildren();
|
665
|
+
if (children !== null) {
|
666
|
+
for (let i = 0; i < children.length; i++) {
|
667
|
+
if (children[i].isQualified()) {
|
668
|
+
this.handleQualifiedNode(element, children[i]);
|
669
|
+
}
|
670
|
+
else {
|
671
|
+
this.handleNode(element, children[i]);
|
672
|
+
}
|
673
|
+
}
|
674
|
+
}
|
675
|
+
}
|
676
|
+
}
|
677
|
+
exports.EmberClient = EmberClient;
|
678
|
+
//# sourceMappingURL=ember-client.js.map
|