From 322a9e1155ecf5d4e13ba1b07d04bed8048df9ea Mon Sep 17 00:00:00 2001 From: Benjamin Dobler Date: Mon, 19 Feb 2018 20:52:44 +0100 Subject: [PATCH] fix(traverse): fix expand level by making traverse method async --- dist/helpers.d.ts | 5 +- dist/helpers.js | 211 ++++++++++++++++++------- dist/helpers.js.map | 2 +- dist/rsi.server.js | 214 +++++++++++++------------- dist/rsi.server.js.map | 2 +- dist/specs/base.spec.d.ts | 1 + dist/specs/service.registry.spec.d.ts | 1 + dist/specs/util.spec.d.ts | 1 + dist/web.socket.handler.js | 87 ++++++----- dist/web.socket.handler.js.map | 2 +- src/helpers.ts | 24 +-- src/rsi.server.ts | 12 +- src/web.socket.handler.ts | 10 +- 13 files changed, 357 insertions(+), 215 deletions(-) diff --git a/dist/helpers.d.ts b/dist/helpers.d.ts index 96c34f8..8134bcf 100644 --- a/dist/helpers.d.ts +++ b/dist/helpers.d.ts @@ -21,6 +21,7 @@ export declare function pathof(baseUri: string, service: Service, resource: Reso */ export declare function filterByKeys(inputObject: any, keep: string[]): Object; export declare function getEventParams(value: string): any; +export declare function asyncForEach(array: any, callback: any): Promise; export declare class ElementUtil { private availableServices; private serviceMap; @@ -29,7 +30,7 @@ export declare class ElementUtil { name: string; uri: string; }[], serviceMap: any); - getElementById(id: string): any; + getElementById(id: string): Promise; /** * Deep clone object, except for keys that contain RSI-object references. * @@ -38,5 +39,5 @@ export declare class ElementUtil { */ private clone(obj); private isObjectReference(obj); - traverse(obj: any, maxLevel?: any, level?: number): void; + traverse(obj: any, maxLevel?: any, level?: number): Promise; } diff --git a/dist/helpers.js b/dist/helpers.js index d443612..43846c5 100644 --- a/dist/helpers.js +++ b/dist/helpers.js @@ -1,4 +1,39 @@ "use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; Object.defineProperty(exports, "__esModule", { value: true }); var queryString = require("query-string"); var URIREGEX = /^\/(\w+)\/(\w+)\/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fAF]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})?#?\w*\??([\w$=&\(\)\:\,\;\-\+]*)?$/; //Group1: Servicename, Group2: Resourcename, Group3: element id, Group4: queryparameter list @@ -81,24 +116,67 @@ function getEventParams(value) { return parsed; } exports.getEventParams = getEventParams; +function asyncForEach(array, callback) { + return __awaiter(this, void 0, void 0, function () { + var index; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + index = 0; + _a.label = 1; + case 1: + if (!(index < array.length)) return [3 /*break*/, 4]; + return [4 /*yield*/, callback(array[index], index, array)]; + case 2: + _a.sent(); + _a.label = 3; + case 3: + index++; + return [3 /*break*/, 1]; + case 4: return [2 /*return*/]; + } + }); + }); +} +exports.asyncForEach = asyncForEach; var ElementUtil = /** @class */ (function () { function ElementUtil(availableServices, serviceMap) { this.availableServices = availableServices; this.serviceMap = serviceMap; } ElementUtil.prototype.getElementById = function (id) { - var _this = this; - var el; - this.availableServices.forEach(function (s) { - _this.serviceMap[s.name].resources.forEach(function (r) { - var element = r.getElement(id); - if (element && element.data) { - var data = element.data.getValue().data; - el = data; + return __awaiter(this, void 0, void 0, function () { + var _this = this; + var el; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, asyncForEach(this.availableServices, function (s) { return __awaiter(_this, void 0, void 0, function () { + var _this = this; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, asyncForEach(this.serviceMap[s.name].resources, function (r) { return __awaiter(_this, void 0, void 0, function () { + var element, data; + return __generator(this, function (_a) { + element = r.getElement(id); + if (element && element.data) { + data = element.data.getValue().data; + el = data; + } + return [2 /*return*/]; + }); + }); })]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }); })]; + case 1: + _a.sent(); + return [2 /*return*/, this.clone(el)]; } }); }); - return this.clone(el); }; /** * Deep clone object, except for keys that contain RSI-object references. @@ -136,56 +214,85 @@ var ElementUtil = /** @class */ (function () { ElementUtil.prototype.traverse = function (obj, maxLevel, level) { if (maxLevel === void 0) { maxLevel = Number.POSITIVE_INFINITY; } if (level === void 0) { level = 0; } - var byLevel = /^\d+$/.test(maxLevel); - var keywords; - if (!byLevel) { - keywords = maxLevel.split(','); - } - else if (level > maxLevel) { - return; - } - for (var property in obj) { - if (obj.hasOwnProperty(property)) { - if (typeof obj[property] == 'object' && !Array.isArray(obj[property])) { - var expandNode = byLevel ? level < maxLevel : keywords.indexOf(property) != -1; - var fullObj = this.getElementById(obj[property].id); - if (expandNode) { - if (fullObj) { - obj[property] = fullObj; + return __awaiter(this, void 0, void 0, function () { + var byLevel, keywords, _a, _b, _i, property, expandNode, fullObj, i, expandNode, fullObj; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + byLevel = /^\d+$/.test(maxLevel); + if (!byLevel) { + keywords = maxLevel.split(','); } - } - else { - if (fullObj) { - obj[property] = { - id: obj[property].id, - uri: obj[property].uri - }; + else if (level > maxLevel) { + return [2 /*return*/]; } - } - this.traverse(obj[property], maxLevel, level + 1); - } - else if (Array.isArray(obj[property])) { - for (var i = 0; i < obj[property].length; i++) { - if (typeof obj[property][i] == 'object') { - var expandNode = byLevel ? level < maxLevel : keywords.indexOf(property) != -1; - if (expandNode) { - var fullObj = this.getElementById(obj[property][i].id); - if (fullObj) { - obj[property][i] = fullObj; - } + _a = []; + for (_b in obj) + _a.push(_b); + _i = 0; + _c.label = 1; + case 1: + if (!(_i < _a.length)) return [3 /*break*/, 12]; + property = _a[_i]; + if (!obj.hasOwnProperty(property)) return [3 /*break*/, 11]; + if (!(typeof obj[property] == 'object' && !Array.isArray(obj[property]))) return [3 /*break*/, 4]; + expandNode = byLevel ? level < maxLevel : keywords.indexOf(property) != -1; + return [4 /*yield*/, this.getElementById(obj[property].id)]; + case 2: + fullObj = _c.sent(); + if (expandNode) { + if (fullObj) { + obj[property] = fullObj; } - else { - obj[property][i] = { - id: obj[property][i].id, - uri: obj[property][i].uri + } + else { + if (fullObj) { + obj[property] = { + id: obj[property].id, + uri: obj[property].uri }; } - this.traverse(obj[property][i], maxLevel, level + 1); } - } + return [4 /*yield*/, this.traverse(obj[property], maxLevel, level + 1)]; + case 3: + _c.sent(); + return [3 /*break*/, 11]; + case 4: + if (!Array.isArray(obj[property])) return [3 /*break*/, 11]; + i = 0; + _c.label = 5; + case 5: + if (!(i < obj[property].length)) return [3 /*break*/, 11]; + if (!(typeof obj[property][i] == 'object')) return [3 /*break*/, 10]; + expandNode = byLevel ? level < maxLevel : keywords.indexOf(property) != -1; + if (!expandNode) return [3 /*break*/, 7]; + return [4 /*yield*/, this.getElementById(obj[property][i].id)]; + case 6: + fullObj = _c.sent(); + if (fullObj) { + obj[property][i] = fullObj; + } + return [3 /*break*/, 8]; + case 7: + obj[property][i] = { + id: obj[property][i].id, + uri: obj[property][i].uri + }; + _c.label = 8; + case 8: return [4 /*yield*/, this.traverse(obj[property][i], maxLevel, level + 1)]; + case 9: + _c.sent(); + _c.label = 10; + case 10: + i++; + return [3 /*break*/, 5]; + case 11: + _i++; + return [3 /*break*/, 1]; + case 12: return [2 /*return*/]; } - } - } + }); + }); }; return ElementUtil; }()); diff --git a/dist/helpers.js.map b/dist/helpers.js.map index cb56c4d..d6f4728 100644 --- a/dist/helpers.js.map +++ b/dist/helpers.js.map @@ -1 +1 @@ -{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;AACA,0CAA4C;AAI5C,IAAM,QAAQ,GAAG,kIAAkI,CAAC,CAAC,4FAA4F;AAEjP,oBAA2B,KAAa;IACpC;;;;;;;;;;MAUE;IAEF,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CA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AQ,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAA,EAAnC,yBAAmC;wBAC/B,UAAU,GAAY,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;6BACpF,UAAU,EAAV,wBAAU;wBACS,qBAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAA;;wBAA7D,OAAO,GAAQ,SAA8C;wBACjE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;4BACV,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;wBAC/B,CAAC;;;wBAED,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG;4BACf,EAAE,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;4BACvB,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;yBAC5B,CAAC;;4BAEN,qBAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC,CAAC,EAAA;;wBAA1D,SAA0D,CAAC;;;wBAdzB,CAAC,EAAE,CAAA;;;;;;;;;KAoB5D;IAGL,kBAAC;AAAD,CAAC,AAvGD,IAuGC;AAvGY,kCAAW"} \ No newline at end of file diff --git a/dist/rsi.server.js b/dist/rsi.server.js index f537941..7b1dd92 100644 --- a/dist/rsi.server.js +++ b/dist/rsi.server.js @@ -338,26 +338,28 @@ var RsiServer = /** @class */ (function () { return [4 /*yield*/, resource.getElement(req.params.id)]; case 1: element = _a.sent(); - if (element && element.data) { - data = element.data.getValue().data; - // filter the result before responding if need - // ed - if (req.query.hasOwnProperty('$fields')) { - data = helpers_1.filterByKeys(data, ['id', 'name', 'uri'].concat(req.query['$fields'].split(','))); - } - expandLevel = req.query['$expand'] ? req.query['$expand'] : 0; - this.elementUtil.traverse(data, expandLevel, 0); - //respond - res.status(core_2.StatusCode.OK); - res.json({ - status: 'ok', - data: data - }); - } - else { - res.status(404).send(); + if (!(element && element.data)) return [3 /*break*/, 3]; + data = element.data.getValue().data; + // filter the result before responding if need + // ed + if (req.query.hasOwnProperty('$fields')) { + data = helpers_1.filterByKeys(data, ['id', 'name', 'uri'].concat(req.query['$fields'].split(','))); } - return [2 /*return*/]; + expandLevel = req.query['$expand'] ? req.query['$expand'] : 0; + return [4 /*yield*/, this.elementUtil.traverse(data, expandLevel, 0)]; + case 2: + _a.sent(); + //respond + res.status(core_2.StatusCode.OK); + res.json({ + status: 'ok', + data: data + }); + return [3 /*break*/, 4]; + case 3: + res.status(404).send(); + _a.label = 4; + case 4: return [2 /*return*/]; } }); }); }; @@ -398,102 +400,108 @@ var RsiServer = /** @class */ (function () { return [4 /*yield*/, resource.getResource(parseNumberOrId(req.query.$offset), parseNumberOrId(req.query.$limit))]; case 1: elements = _a.sent(); - if (elements) { - resp = elements.data.map(function (value) { - return value.getValue().data; - }); - expandLevel_1 = req.query['$expand'] ? req.query['$expand'] : 0; - resp = resp.map(function (x) { - _this.elementUtil.traverse(x, expandLevel_1, 0); - return x; - }); - // Object ref search - for (propName in req.query) { - if (req.query.hasOwnProperty(propName)) { - if (propName.charAt(0) != '$') { - resp = resp.filter(function (item) { - if (!item.hasOwnProperty(propName)) { - return false; - } - if (typeof item[propName] === 'object') { - if (item[propName].id === req.query[propName]) { - return true; - } - } - else if (item[propName] === req.query[propName]) { + if (!elements) return [3 /*break*/, 3]; + resp = elements.data.map(function (value) { + return value.getValue().data; + }); + expandLevel_1 = req.query['$expand'] ? req.query['$expand'] : 0; + return [4 /*yield*/, Promise.all(resp.map(function (x) { return __awaiter(_this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.elementUtil.traverse(x, expandLevel_1, 0)]; + case 1: + _a.sent(); + return [2 /*return*/, x]; + } + }); + }); }))]; + case 2: + resp = _a.sent(); + // Object ref search + for (propName in req.query) { + if (req.query.hasOwnProperty(propName)) { + if (propName.charAt(0) != '$') { + resp = resp.filter(function (item) { + if (!item.hasOwnProperty(propName)) { + return false; + } + if (typeof item[propName] === 'object') { + if (item[propName].id === req.query[propName]) { return true; } - }); - } + } + else if (item[propName] === req.query[propName]) { + return true; + } + }); } } - // $q Freesearch - if (req.query.hasOwnProperty('$q')) { - resp = resp.filter(function (item) { - var stringValue = JSON.stringify(item); - if (stringValue.indexOf(req.query['$q']) != -1) { - return item; - } - }); - } - // $fields filtering - if (req.query.hasOwnProperty('$fields')) { - fieldsList_1 = req.query['$fields']; - medatoryFields_1 = ['name', 'id', 'uri']; - resp = resp.map(function (item) { - var newItem = {}; - for (var i in item) { - if (fieldsList_1.indexOf(i) != -1 || medatoryFields_1.indexOf(i) != -1) { - newItem[i] = item[i]; - } + } + // $q Freesearch + if (req.query.hasOwnProperty('$q')) { + resp = resp.filter(function (item) { + var stringValue = JSON.stringify(item); + if (stringValue.indexOf(req.query['$q']) != -1) { + return item; + } + }); + } + // $fields filtering + if (req.query.hasOwnProperty('$fields')) { + fieldsList_1 = req.query['$fields']; + medatoryFields_1 = ['name', 'id', 'uri']; + resp = resp.map(function (item) { + var newItem = {}; + for (var i in item) { + if (fieldsList_1.indexOf(i) != -1 || medatoryFields_1.indexOf(i) != -1) { + newItem[i] = item[i]; } - return newItem; - }); + } + return newItem; + }); + } + // $sorting + if (req.query.hasOwnProperty('$sortby')) { + sort_1 = req.query['$sortby']; + dec_1 = 1; + if (sort_1.indexOf('-') === 0) { + sort_1 = sort_1.substring(1); + dec_1 = -1; } - // $sorting - if (req.query.hasOwnProperty('$sortby')) { - sort_1 = req.query['$sortby']; - console.log("Sort result ", sort_1); + if (sort_1.indexOf('+') === 0) { + sort_1 = sort_1.substring(1); dec_1 = 1; - if (sort_1.indexOf('-') === 0) { - sort_1 = sort_1.substring(1); - dec_1 = -1; + } + resp = resp.sort(function (a, b) { + var val1 = 'z'; + var val2 = 'z'; + if (a.hasOwnProperty(sort_1)) { + val1 = a[sort_1]; } - if (sort_1.indexOf('+') === 0) { - sort_1 = sort_1.substring(1); - dec_1 = 1; + if (b.hasOwnProperty(sort_1)) { + val2 = b[sort_1]; } - resp = resp.sort(function (a, b) { - var val1 = 'z'; - var val2 = 'z'; - if (a.hasOwnProperty(sort_1)) { - val1 = a[sort_1]; - } - if (b.hasOwnProperty(sort_1)) { - val2 = b[sort_1]; - } - val1 = val1.toLowerCase(); - val2 = val2.toLowerCase(); - if (val1 < val2) { - return -1 * dec_1; - } - if (val1 > val2) { - return 1 * dec_1; - } - return 0; - }); - } - res.status(core_2.StatusCode.OK); - res.json({ - status: 'ok', - data: resp + val1 = val1.toLowerCase(); + val2 = val2.toLowerCase(); + if (val1 < val2) { + return -1 * dec_1; + } + if (val1 > val2) { + return 1 * dec_1; + } + return 0; }); - return [2 /*return*/]; - } - else { - res.status(core_2.StatusCode.NOT_FOUND).send('Not found'); } + res.status(core_2.StatusCode.OK); + res.json({ + status: 'ok', + data: resp + }); return [2 /*return*/]; + case 3: + res.status(core_2.StatusCode.NOT_FOUND).send('Not found'); + _a.label = 4; + case 4: return [2 /*return*/]; } }); }); }; diff --git a/dist/rsi.server.js.map b/dist/rsi.server.js.map index 2cb7849..0694f891 100644 --- a/dist/rsi.server.js.map +++ b/dist/rsi.server.js.map @@ -1 +1 @@ -{"version":3,"file":"rsi.server.js","sourceRoot":"","sources":["../src/rsi.server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAuD;AACvD,2CAAyC;AACzC,kCAAmE;AACnE,2DAAiD;AACjD,yDAAmD;AAEnD,qCAA0E;AAG1E,iCAAmC;AAGnC;;GAEG;AACH;IAgBE;QAAA,iBAEC;QAhBO,WA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ts b/dist/specs/base.spec.d.ts index e69de29..cb0ff5c 100644 --- a/dist/specs/base.spec.d.ts +++ b/dist/specs/base.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/specs/service.registry.spec.d.ts b/dist/specs/service.registry.spec.d.ts index e69de29..cb0ff5c 100644 --- a/dist/specs/service.registry.spec.d.ts +++ b/dist/specs/service.registry.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/specs/util.spec.d.ts b/dist/specs/util.spec.d.ts index e69de29..cb0ff5c 100644 --- a/dist/specs/util.spec.d.ts +++ b/dist/specs/util.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/web.socket.handler.js b/dist/web.socket.handler.js index 0c0a138..fa7f3d9 100644 --- a/dist/web.socket.handler.js +++ b/dist/web.socket.handler.js @@ -141,18 +141,27 @@ var WsHandler = /** @class */ (function () { else { subscription$ = subject_1; } - this._subscriptions[rsiWebSocket.id][msg.event] = subscription$.subscribe(function (data) { - var params = helpers_1.getEventParams(msg.event); - var d = data.data; - if (params.$fields) { - var fields = params.$fields.split(','); - d = helpers_1.filterByKeys(d, ['id', 'name', 'uri'].concat(fields)); - } - var expandLevel = params.$expand ? params.$expand : 0; - _this.elementUtil.traverse(d, expandLevel, 0); - if (!rsiWebSocket.sendData(msg.event, d)) - subject_1.complete(); - }, function (err) { + this._subscriptions[rsiWebSocket.id][msg.event] = subscription$.subscribe(function (data) { return __awaiter(_this, void 0, void 0, function () { + var params, d, fields, expandLevel; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + params = helpers_1.getEventParams(msg.event); + d = data.data; + if (params.$fields) { + fields = params.$fields.split(','); + d = helpers_1.filterByKeys(d, ['id', 'name', 'uri'].concat(fields)); + } + expandLevel = params.$expand ? params.$expand : 0; + return [4 /*yield*/, this.elementUtil.traverse(d, expandLevel, 0)]; + case 1: + _a.sent(); + if (!rsiWebSocket.sendData(msg.event, d)) + subject_1.complete(); + return [2 /*return*/]; + } + }); + }); }, function (err) { if (!rsiWebSocket.sendError(msg.event, core_1.StatusCode.INTERNAL_SERVER_ERROR, new Error(err))) subject_1.complete(); }); @@ -198,32 +207,40 @@ var WsHandler = /** @class */ (function () { case 0: return [4 /*yield*/, this.resource.getResource()]; case 1: elements = _a.sent(); - if (elements) { - resp = elements.data.map(function (value) { - return value.getValue().data; + if (!elements) return [3 /*break*/, 3]; + resp = elements.data.map(function (value) { + return value.getValue().data; + }); + params_1 = helpers_1.getEventParams(msg.event); + expandLevel_1 = params_1.$expand ? params_1.$expand : 0; + if (params_1.$q) { + resp = resp.filter(function (item) { + var stringValue = JSON.stringify(item); + if (stringValue.indexOf(params_1.$q) != -1) { + return item; + } }); - params_1 = helpers_1.getEventParams(msg.event); - expandLevel_1 = params_1.$expand ? params_1.$expand : 0; - if (params_1.$q) { - resp = resp.filter(function (item) { - var stringValue = JSON.stringify(item); - if (stringValue.indexOf(params_1.$q) != -1) { - return item; + } + return [4 /*yield*/, Promise.all(resp.map(function (x) { return __awaiter(_this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.elementUtil.traverse(x, expandLevel_1, 0)]; + case 1: + _a.sent(); + return [2 /*return*/, x]; } }); - } - resp = resp.map(function (x) { - _this.elementUtil.traverse(x, expandLevel_1, 0); - return x; - }); - if (!rsiWebSocket.sendData(msg.event, resp)) - this.resource.change.complete(); - } - else { - if (!rsiWebSocket.sendError(msg.event, core_1.StatusCode.NOT_FOUND, new Error('Not found'))) - this.resource.change.complete(); - } - return [2 /*return*/]; + }); }))]; + case 2: + resp = _a.sent(); + if (!rsiWebSocket.sendData(msg.event, resp)) + this.resource.change.complete(); + return [3 /*break*/, 4]; + case 3: + if (!rsiWebSocket.sendError(msg.event, core_1.StatusCode.NOT_FOUND, new Error('Not found'))) + this.resource.change.complete(); + _a.label = 4; + case 4: return [2 /*return*/]; } }); }); }, function (err) { diff --git a/dist/web.socket.handler.js.map b/dist/web.socket.handler.js.map index 21f5c4a..81253a9 100644 --- a/dist/web.socket.handler.js.map +++ b/dist/web.socket.handler.js.map @@ -1 +1 @@ -{"version":3,"file":"web.socket.handler.js","sourceRoot":"","sources":["../src/web.socket.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAkF;AAElF,kCAAmF;AAGnF,8CAA6C;AAE7C;IAGI,mBAAoB,OAAgB,EAAU,QAAkB,EAAU,WAAwB;QAAlG,iBAEC;QAFmB,YAAO,GAAP,OAAO,CAAS;QAAU,aAAQ,GAAR,QAAQ,CAAU;QAAU,gBAAW,GAAX,WAAW,CAAa;QAF1F,mBAAc,GAAQ,EAAE,CAAC;QAqBjC;;;;WAIG;QACH,yBAAoB,GAAG,UAAC,YAA0B;YAC9C,EAAE,CAAC,CAAC,KAAI,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBACvC,IAAI,aAAa,GAAQ,KAAI,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;gBAC9D,GAAG,CAAC,CAAC,IAAI,IAAI,IAAI,aAAa,CAAC,CAAC,CAAC;oBAC7B,aAAa,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;gBACtC,CAAC;gBACD,OAAO,KAAI,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YAChD,CAAC;QACL,CAAC,CAAC;QAEF;;;;;;WAMG;QACH,4BAAuB,GAAG,UAAC,GAA8B,EAAE,aAA2B;YAClF,IAAI,QAAQ,GAAG,oBAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAErC,KAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,KAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,8BAA8B;YAEnH,EAAE,CAAC,CAAC,KAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,GA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,CAAC;YAC9H,CAAC,CAAC,CAAC;QACf,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,iBAAU,CAAC,eAAe,EAAE,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAChG,CAAC;IACL,CAAC;IAGL,gBAAC;AAAD,CAAC,AAhMD,IAgMC;AAhMY,8BAAS"} \ No newline at end of file diff --git a/src/helpers.ts b/src/helpers.ts index 08b032c..3ffde02 100755 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -96,16 +96,23 @@ export function getEventParams(value: string) { } +export async function asyncForEach(array, callback) { + for (let index = 0; index < array.length; index++) { + await callback(array[index], index, array) + } +} + + export class ElementUtil { constructor(private availableServices: { id: string; name: string; uri: string }[], private serviceMap: any) { } - public getElementById(id: string): any { + public async getElementById(id: string): Promise { let el: any; - this.availableServices.forEach((s: any) => { - this.serviceMap[s.name].resources.forEach((r: Resource) => { + await asyncForEach(this.availableServices, async (s: any) => { + await asyncForEach(this.serviceMap[s.name].resources, async (r: Resource) => { let element: any = r.getElement(id); if (element && element.data) { let data = (>element.data).getValue().data; @@ -148,7 +155,7 @@ export class ElementUtil { return obj.hasOwnProperty('id') && obj.hasOwnProperty('uri'); } - public traverse(obj: any, maxLevel: any = Number.POSITIVE_INFINITY, level: number = 0) { + public async traverse(obj: any, maxLevel: any = Number.POSITIVE_INFINITY, level: number = 0) { const byLevel: boolean = /^\d+$/.test(maxLevel); let keywords: Array; if (!byLevel) { @@ -160,8 +167,7 @@ export class ElementUtil { if (obj.hasOwnProperty(property)) { if (typeof obj[property] == 'object' && !Array.isArray(obj[property])) { let expandNode: boolean = byLevel ? level < maxLevel : keywords.indexOf(property) != -1; - let fullObj: any = this.getElementById(obj[property].id); - + let fullObj: any = await this.getElementById(obj[property].id); if (expandNode) { if (fullObj) { obj[property] = fullObj; @@ -175,13 +181,13 @@ export class ElementUtil { } } - this.traverse(obj[property], maxLevel, level + 1); + await this.traverse(obj[property], maxLevel, level + 1); } else if (Array.isArray(obj[property])) { for (let i = 0; i < obj[property].length; i++) { if (typeof obj[property][i] == 'object') { let expandNode: boolean = byLevel ? level < maxLevel : keywords.indexOf(property) != -1; if (expandNode) { - let fullObj: any = this.getElementById(obj[property][i].id); + let fullObj: any = await this.getElementById(obj[property][i].id); if (fullObj) { obj[property][i] = fullObj; } @@ -191,7 +197,7 @@ export class ElementUtil { uri: obj[property][i].uri }; } - this.traverse(obj[property][i], maxLevel, level + 1); + await this.traverse(obj[property][i], maxLevel, level + 1); } } } diff --git a/src/rsi.server.ts b/src/rsi.server.ts index 401435a..b3d8028 100755 --- a/src/rsi.server.ts +++ b/src/rsi.server.ts @@ -244,7 +244,7 @@ export class RsiServer { } const expandLevel: any = req.query['$expand'] ? req.query['$expand'] : 0; - this.elementUtil.traverse(data, expandLevel, 0); + await this.elementUtil.traverse(data, expandLevel, 0); //respond res.status(StatusCode.OK); @@ -298,11 +298,12 @@ export class RsiServer { // enrich object refs + $expand handling const expandLevel: any = req.query['$expand'] ? req.query['$expand'] : 0; - resp = resp.map((x: any) => { - this.elementUtil.traverse(x, expandLevel, 0); + resp = await Promise.all(resp.map(async (x: any) => { + await this.elementUtil.traverse(x, expandLevel, 0); return x; - }); - + })); + + // Object ref search for (var propName in req.query) { if (req.query.hasOwnProperty(propName)) { @@ -351,7 +352,6 @@ export class RsiServer { // $sorting if (req.query.hasOwnProperty('$sortby')) { let sort: string = req.query['$sortby']; - console.log("Sort result ", sort ); let dec:number = 1; if (sort.indexOf('-') === 0) { sort = sort.substring(1); diff --git a/src/web.socket.handler.ts b/src/web.socket.handler.ts index b5035cd..aaccc24 100755 --- a/src/web.socket.handler.ts +++ b/src/web.socket.handler.ts @@ -111,7 +111,7 @@ export class WsHandler { subscription$ = subject; } - this._subscriptions[rsiWebSocket.id][msg.event] = subscription$.subscribe((data: any) => { + this._subscriptions[rsiWebSocket.id][msg.event] = subscription$.subscribe(async (data: any) => { const params = getEventParams(msg.event); let d: any = data.data; @@ -121,7 +121,7 @@ export class WsHandler { } const expandLevel: any = params.$expand ? params.$expand : 0; - this.elementUtil.traverse(d, expandLevel, 0); + await this.elementUtil.traverse(d, expandLevel, 0); if (!rsiWebSocket.sendData(msg.event, d)) subject.complete(); @@ -177,10 +177,10 @@ export class WsHandler { }); } - resp = resp.map((x: any) => { - this.elementUtil.traverse(x, expandLevel, 0); + resp = await Promise.all(resp.map(async (x: any) => { + await this.elementUtil.traverse(x, expandLevel, 0); return x; - }); + })); if (!rsiWebSocket.sendData(msg.event, resp)) this.resource.change.complete(); }