oro-sdk 5.3.5 → 5.4.0

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.
@@ -10,20 +10,16 @@ var oroToolbox = require('oro-toolbox');
10
10
  var idbKeyval = require('idb-keyval');
11
11
 
12
12
  function _regeneratorRuntime() {
13
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
14
-
15
13
  _regeneratorRuntime = function () {
16
14
  return exports;
17
15
  };
18
-
19
16
  var exports = {},
20
- Op = Object.prototype,
21
- hasOwn = Op.hasOwnProperty,
22
- $Symbol = "function" == typeof Symbol ? Symbol : {},
23
- iteratorSymbol = $Symbol.iterator || "@@iterator",
24
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
25
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
26
-
17
+ Op = Object.prototype,
18
+ hasOwn = Op.hasOwnProperty,
19
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
20
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
21
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
22
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
27
23
  function define(obj, key, value) {
28
24
  return Object.defineProperty(obj, key, {
29
25
  value: value,
@@ -32,7 +28,6 @@ function _regeneratorRuntime() {
32
28
  writable: !0
33
29
  }), obj[key];
34
30
  }
35
-
36
31
  try {
37
32
  define({}, "");
38
33
  } catch (err) {
@@ -40,40 +35,33 @@ function _regeneratorRuntime() {
40
35
  return obj[key] = value;
41
36
  };
42
37
  }
43
-
44
38
  function wrap(innerFn, outerFn, self, tryLocsList) {
45
39
  var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
46
- generator = Object.create(protoGenerator.prototype),
47
- context = new Context(tryLocsList || []);
40
+ generator = Object.create(protoGenerator.prototype),
41
+ context = new Context(tryLocsList || []);
48
42
  return generator._invoke = function (innerFn, self, context) {
49
43
  var state = "suspendedStart";
50
44
  return function (method, arg) {
51
45
  if ("executing" === state) throw new Error("Generator is already running");
52
-
53
46
  if ("completed" === state) {
54
47
  if ("throw" === method) throw arg;
55
48
  return doneResult();
56
49
  }
57
-
58
50
  for (context.method = method, context.arg = arg;;) {
59
51
  var delegate = context.delegate;
60
-
61
52
  if (delegate) {
62
53
  var delegateResult = maybeInvokeDelegate(delegate, context);
63
-
64
54
  if (delegateResult) {
65
55
  if (delegateResult === ContinueSentinel) continue;
66
56
  return delegateResult;
67
57
  }
68
58
  }
69
-
70
59
  if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
71
60
  if ("suspendedStart" === state) throw state = "completed", context.arg;
72
61
  context.dispatchException(context.arg);
73
62
  } else "return" === context.method && context.abrupt("return", context.arg);
74
63
  state = "executing";
75
64
  var record = tryCatch(innerFn, self, context);
76
-
77
65
  if ("normal" === record.type) {
78
66
  if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
79
67
  return {
@@ -81,13 +69,11 @@ function _regeneratorRuntime() {
81
69
  done: context.done
82
70
  };
83
71
  }
84
-
85
72
  "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
86
73
  }
87
74
  };
88
75
  }(innerFn, self, context), generator;
89
76
  }
90
-
91
77
  function tryCatch(fn, obj, arg) {
92
78
  try {
93
79
  return {
@@ -101,25 +87,19 @@ function _regeneratorRuntime() {
101
87
  };
102
88
  }
103
89
  }
104
-
105
90
  exports.wrap = wrap;
106
91
  var ContinueSentinel = {};
107
-
108
92
  function Generator() {}
109
-
110
93
  function GeneratorFunction() {}
111
-
112
94
  function GeneratorFunctionPrototype() {}
113
-
114
95
  var IteratorPrototype = {};
115
96
  define(IteratorPrototype, iteratorSymbol, function () {
116
97
  return this;
117
98
  });
118
99
  var getProto = Object.getPrototypeOf,
119
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
100
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
120
101
  NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
121
102
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
122
-
123
103
  function defineIteratorMethods(prototype) {
124
104
  ["next", "throw", "return"].forEach(function (method) {
125
105
  define(prototype, method, function (arg) {
@@ -127,14 +107,12 @@ function _regeneratorRuntime() {
127
107
  });
128
108
  });
129
109
  }
130
-
131
110
  function AsyncIterator(generator, PromiseImpl) {
132
111
  function invoke(method, arg, resolve, reject) {
133
112
  var record = tryCatch(generator[method], generator, arg);
134
-
135
113
  if ("throw" !== record.type) {
136
114
  var result = record.arg,
137
- value = result.value;
115
+ value = result.value;
138
116
  return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
139
117
  invoke("next", value, resolve, reject);
140
118
  }, function (err) {
@@ -145,89 +123,71 @@ function _regeneratorRuntime() {
145
123
  return invoke("throw", error, resolve, reject);
146
124
  });
147
125
  }
148
-
149
126
  reject(record.arg);
150
127
  }
151
-
152
128
  var previousPromise;
153
-
154
129
  this._invoke = function (method, arg) {
155
130
  function callInvokeWithMethodAndArg() {
156
131
  return new PromiseImpl(function (resolve, reject) {
157
132
  invoke(method, arg, resolve, reject);
158
133
  });
159
134
  }
160
-
161
135
  return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
162
136
  };
163
137
  }
164
-
165
138
  function maybeInvokeDelegate(delegate, context) {
166
139
  var method = delegate.iterator[context.method];
167
-
168
140
  if (undefined === method) {
169
141
  if (context.delegate = null, "throw" === context.method) {
170
142
  if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
171
143
  context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
172
144
  }
173
-
174
145
  return ContinueSentinel;
175
146
  }
176
-
177
147
  var record = tryCatch(method, delegate.iterator, context.arg);
178
148
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
179
149
  var info = record.arg;
180
150
  return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
181
151
  }
182
-
183
152
  function pushTryEntry(locs) {
184
153
  var entry = {
185
154
  tryLoc: locs[0]
186
155
  };
187
156
  1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
188
157
  }
189
-
190
158
  function resetTryEntry(entry) {
191
159
  var record = entry.completion || {};
192
160
  record.type = "normal", delete record.arg, entry.completion = record;
193
161
  }
194
-
195
162
  function Context(tryLocsList) {
196
163
  this.tryEntries = [{
197
164
  tryLoc: "root"
198
165
  }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
199
166
  }
200
-
201
167
  function values(iterable) {
202
168
  if (iterable) {
203
169
  var iteratorMethod = iterable[iteratorSymbol];
204
170
  if (iteratorMethod) return iteratorMethod.call(iterable);
205
171
  if ("function" == typeof iterable.next) return iterable;
206
-
207
172
  if (!isNaN(iterable.length)) {
208
173
  var i = -1,
209
- next = function next() {
210
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
211
-
212
- return next.value = undefined, next.done = !0, next;
213
- };
214
-
174
+ next = function next() {
175
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
176
+ return next.value = undefined, next.done = !0, next;
177
+ };
215
178
  return next.next = next;
216
179
  }
217
180
  }
218
-
219
181
  return {
220
182
  next: doneResult
221
183
  };
222
184
  }
223
-
224
185
  function doneResult() {
225
186
  return {
226
187
  value: undefined,
227
188
  done: !0
228
189
  };
229
190
  }
230
-
231
191
  return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
232
192
  var ctor = "function" == typeof genFun && genFun.constructor;
233
193
  return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
@@ -251,15 +211,12 @@ function _regeneratorRuntime() {
251
211
  return "[object Generator]";
252
212
  }), exports.keys = function (object) {
253
213
  var keys = [];
254
-
255
214
  for (var key in object) keys.push(key);
256
-
257
215
  return keys.reverse(), function next() {
258
216
  for (; keys.length;) {
259
217
  var key = keys.pop();
260
218
  if (key in object) return next.value = key, next.done = !1, next;
261
219
  }
262
-
263
220
  return next.done = !0, next;
264
221
  };
265
222
  }, exports.values = values, Context.prototype = {
@@ -276,20 +233,16 @@ function _regeneratorRuntime() {
276
233
  dispatchException: function (exception) {
277
234
  if (this.done) throw exception;
278
235
  var context = this;
279
-
280
236
  function handle(loc, caught) {
281
237
  return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
282
238
  }
283
-
284
239
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
285
240
  var entry = this.tryEntries[i],
286
- record = entry.completion;
241
+ record = entry.completion;
287
242
  if ("root" === entry.tryLoc) return handle("end");
288
-
289
243
  if (entry.tryLoc <= this.prev) {
290
244
  var hasCatch = hasOwn.call(entry, "catchLoc"),
291
- hasFinally = hasOwn.call(entry, "finallyLoc");
292
-
245
+ hasFinally = hasOwn.call(entry, "finallyLoc");
293
246
  if (hasCatch && hasFinally) {
294
247
  if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
295
248
  if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
@@ -305,13 +258,11 @@ function _regeneratorRuntime() {
305
258
  abrupt: function (type, arg) {
306
259
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
307
260
  var entry = this.tryEntries[i];
308
-
309
261
  if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
310
262
  var finallyEntry = entry;
311
263
  break;
312
264
  }
313
265
  }
314
-
315
266
  finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
316
267
  var record = finallyEntry ? finallyEntry.completion : {};
317
268
  return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
@@ -329,19 +280,15 @@ function _regeneratorRuntime() {
329
280
  catch: function (tryLoc) {
330
281
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
331
282
  var entry = this.tryEntries[i];
332
-
333
283
  if (entry.tryLoc === tryLoc) {
334
284
  var record = entry.completion;
335
-
336
285
  if ("throw" === record.type) {
337
286
  var thrown = record.arg;
338
287
  resetTryEntry(entry);
339
288
  }
340
-
341
289
  return thrown;
342
290
  }
343
291
  }
344
-
345
292
  throw new Error("illegal catch attempt");
346
293
  },
347
294
  delegateYield: function (iterable, resultName, nextLoc) {
@@ -353,55 +300,47 @@ function _regeneratorRuntime() {
353
300
  }
354
301
  }, exports;
355
302
  }
356
-
357
303
  function _wrapRegExp() {
358
304
  _wrapRegExp = function (re, groups) {
359
305
  return new BabelRegExp(re, void 0, groups);
360
306
  };
361
-
362
307
  var _super = RegExp.prototype,
363
- _groups = new WeakMap();
364
-
308
+ _groups = new WeakMap();
365
309
  function BabelRegExp(re, flags, groups) {
366
310
  var _this = new RegExp(re, flags);
367
-
368
311
  return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype);
369
312
  }
370
-
371
313
  function buildGroups(result, re) {
372
314
  var g = _groups.get(re);
373
-
374
315
  return Object.keys(g).reduce(function (groups, name) {
375
- return groups[name] = result[g[name]], groups;
316
+ var i = g[name];
317
+ if ("number" == typeof i) groups[name] = result[i];else {
318
+ for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;
319
+ groups[name] = result[i[k]];
320
+ }
321
+ return groups;
376
322
  }, Object.create(null));
377
323
  }
378
-
379
324
  return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
380
325
  var result = _super.exec.call(this, str);
381
-
382
326
  return result && (result.groups = buildGroups(result, this)), result;
383
327
  }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
384
328
  if ("string" == typeof substitution) {
385
329
  var groups = _groups.get(this);
386
-
387
330
  return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
388
331
  return "$" + groups[name];
389
332
  }));
390
333
  }
391
-
392
334
  if ("function" == typeof substitution) {
393
335
  var _this = this;
394
-
395
336
  return _super[Symbol.replace].call(this, str, function () {
396
337
  var args = arguments;
397
338
  return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
398
339
  });
399
340
  }
400
-
401
341
  return _super[Symbol.replace].call(this, str, substitution);
402
342
  }, _wrapRegExp.apply(this, arguments);
403
343
  }
404
-
405
344
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
406
345
  try {
407
346
  var info = gen[key](arg);
@@ -410,57 +349,46 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
410
349
  reject(error);
411
350
  return;
412
351
  }
413
-
414
352
  if (info.done) {
415
353
  resolve(value);
416
354
  } else {
417
355
  Promise.resolve(value).then(_next, _throw);
418
356
  }
419
357
  }
420
-
421
358
  function _asyncToGenerator(fn) {
422
359
  return function () {
423
360
  var self = this,
424
- args = arguments;
361
+ args = arguments;
425
362
  return new Promise(function (resolve, reject) {
426
363
  var gen = fn.apply(self, args);
427
-
428
364
  function _next(value) {
429
365
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
430
366
  }
431
-
432
367
  function _throw(err) {
433
368
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
434
369
  }
435
-
436
370
  _next(undefined);
437
371
  });
438
372
  };
439
373
  }
440
-
441
374
  function _extends() {
442
- _extends = Object.assign || function (target) {
375
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
443
376
  for (var i = 1; i < arguments.length; i++) {
444
377
  var source = arguments[i];
445
-
446
378
  for (var key in source) {
447
379
  if (Object.prototype.hasOwnProperty.call(source, key)) {
448
380
  target[key] = source[key];
449
381
  }
450
382
  }
451
383
  }
452
-
453
384
  return target;
454
385
  };
455
-
456
386
  return _extends.apply(this, arguments);
457
387
  }
458
-
459
388
  function _inherits(subClass, superClass) {
460
389
  if (typeof superClass !== "function" && superClass !== null) {
461
390
  throw new TypeError("Super expression must either be null or a function");
462
391
  }
463
-
464
392
  subClass.prototype = Object.create(superClass && superClass.prototype, {
465
393
  constructor: {
466
394
  value: subClass,
@@ -473,35 +401,28 @@ function _inherits(subClass, superClass) {
473
401
  });
474
402
  if (superClass) _setPrototypeOf(subClass, superClass);
475
403
  }
476
-
477
404
  function _inheritsLoose(subClass, superClass) {
478
405
  subClass.prototype = Object.create(superClass.prototype);
479
406
  subClass.prototype.constructor = subClass;
480
-
481
407
  _setPrototypeOf(subClass, superClass);
482
408
  }
483
-
484
409
  function _getPrototypeOf(o) {
485
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
410
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
486
411
  return o.__proto__ || Object.getPrototypeOf(o);
487
412
  };
488
413
  return _getPrototypeOf(o);
489
414
  }
490
-
491
415
  function _setPrototypeOf(o, p) {
492
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
416
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
493
417
  o.__proto__ = p;
494
418
  return o;
495
419
  };
496
-
497
420
  return _setPrototypeOf(o, p);
498
421
  }
499
-
500
422
  function _isNativeReflectConstruct() {
501
423
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
502
424
  if (Reflect.construct.sham) return false;
503
425
  if (typeof Proxy === "function") return true;
504
-
505
426
  try {
506
427
  Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
507
428
  return true;
@@ -509,10 +430,9 @@ function _isNativeReflectConstruct() {
509
430
  return false;
510
431
  }
511
432
  }
512
-
513
433
  function _construct(Parent, args, Class) {
514
434
  if (_isNativeReflectConstruct()) {
515
- _construct = Reflect.construct;
435
+ _construct = Reflect.construct.bind();
516
436
  } else {
517
437
  _construct = function _construct(Parent, args, Class) {
518
438
  var a = [null];
@@ -523,34 +443,25 @@ function _construct(Parent, args, Class) {
523
443
  return instance;
524
444
  };
525
445
  }
526
-
527
446
  return _construct.apply(null, arguments);
528
447
  }
529
-
530
448
  function _isNativeFunction(fn) {
531
449
  return Function.toString.call(fn).indexOf("[native code]") !== -1;
532
450
  }
533
-
534
451
  function _wrapNativeSuper(Class) {
535
452
  var _cache = typeof Map === "function" ? new Map() : undefined;
536
-
537
453
  _wrapNativeSuper = function _wrapNativeSuper(Class) {
538
454
  if (Class === null || !_isNativeFunction(Class)) return Class;
539
-
540
455
  if (typeof Class !== "function") {
541
456
  throw new TypeError("Super expression must either be null or a function");
542
457
  }
543
-
544
458
  if (typeof _cache !== "undefined") {
545
459
  if (_cache.has(Class)) return _cache.get(Class);
546
-
547
460
  _cache.set(Class, Wrapper);
548
461
  }
549
-
550
462
  function Wrapper() {
551
463
  return _construct(Class, arguments, _getPrototypeOf(this).constructor);
552
464
  }
553
-
554
465
  Wrapper.prototype = Object.create(Class.prototype, {
555
466
  constructor: {
556
467
  value: Wrapper,
@@ -561,25 +472,20 @@ function _wrapNativeSuper(Class) {
561
472
  });
562
473
  return _setPrototypeOf(Wrapper, Class);
563
474
  };
564
-
565
475
  return _wrapNativeSuper(Class);
566
476
  }
567
-
568
477
  function _objectWithoutPropertiesLoose(source, excluded) {
569
478
  if (source == null) return {};
570
479
  var target = {};
571
480
  var sourceKeys = Object.keys(source);
572
481
  var key, i;
573
-
574
482
  for (i = 0; i < sourceKeys.length; i++) {
575
483
  key = sourceKeys[i];
576
484
  if (excluded.indexOf(key) >= 0) continue;
577
485
  target[key] = source[key];
578
486
  }
579
-
580
487
  return target;
581
488
  }
582
-
583
489
  function _unsupportedIterableToArray(o, minLen) {
584
490
  if (!o) return;
585
491
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -588,19 +494,14 @@ function _unsupportedIterableToArray(o, minLen) {
588
494
  if (n === "Map" || n === "Set") return Array.from(o);
589
495
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
590
496
  }
591
-
592
497
  function _arrayLikeToArray(arr, len) {
593
498
  if (len == null || len > arr.length) len = arr.length;
594
-
595
499
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
596
-
597
500
  return arr2;
598
501
  }
599
-
600
502
  function _createForOfIteratorHelperLoose(o, allowArrayLike) {
601
503
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
602
504
  if (it) return (it = it.call(o)).next.bind(it);
603
-
604
505
  if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
605
506
  if (it) o = it;
606
507
  var i = 0;
@@ -614,7 +515,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
614
515
  };
615
516
  };
616
517
  }
617
-
618
518
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
619
519
  }
620
520
 
@@ -625,10 +525,8 @@ var personalMetaToPrefix = (_personalMetaToPrefix = {}, _personalMetaToPrefix[in
625
525
  * @param data extracted from WorkflowData
626
526
  * @returns PersonalInformations of a patient
627
527
  */
628
-
629
528
  function identificationToPersonalInformations(data, category) {
630
- var _data$;
631
-
529
+ var _data;
632
530
  var prefix = personalMetaToPrefix[category];
633
531
  return {
634
532
  birthday: data[prefix + "Birthday"],
@@ -637,7 +535,7 @@ function identificationToPersonalInformations(data, category) {
637
535
  name: data[prefix + "Name"],
638
536
  phone: data[prefix + "Phone"],
639
537
  zip: data[prefix + "Zip"],
640
- hid: (_data$ = data[prefix + "HID"]) != null ? _data$ : data[prefix + "ID"],
538
+ hid: (_data = data[prefix + "HID"]) != null ? _data : data[prefix + "ID"],
641
539
  pharmacy: data[prefix + "Pharmacy"],
642
540
  address: data[prefix + "Address"]
643
541
  };
@@ -646,7 +544,7 @@ function toActualObject(data) {
646
544
  var ret = {};
647
545
  Object.entries(data.fields).forEach(function (_ref) {
648
546
  var key = _ref[0],
649
- field = _ref[1];
547
+ field = _ref[1];
650
548
  ret[key] = field.displayedAnswer ? field.displayedAnswer : field.answer;
651
549
  });
652
550
  return ret;
@@ -657,18 +555,15 @@ function toActualObject(data) {
657
555
  * @param data the PopulatedWorkflowData
658
556
  * @returns an updated PopulatedWorkflowData
659
557
  */
660
-
661
558
  function updatePersonalIntoPopulatedWorkflowData(infos, data, category) {
662
559
  var prefix = personalMetaToPrefix[category];
663
560
  var ret = JSON.parse(JSON.stringify(data)); // deep copy PopulatedWorkflowData
664
-
665
561
  if (infos.birthday && ret.fields[prefix + "Birthday"]) ret.fields[prefix + "Birthday"].answer = infos.birthday;
666
562
  if (infos.firstname && ret.fields[prefix + "Firstname"]) ret.fields[prefix + "Firstname"].answer = infos.firstname;
667
563
  if (infos.gender && ret.fields[prefix + "Gender"]) ret.fields[prefix + "Gender"].answer = infos.gender;
668
564
  if (infos.name && ret.fields[prefix + "Name"]) ret.fields[prefix + "Name"].answer = infos.name;
669
565
  if (infos.phone && ret.fields[prefix + "Phone"]) ret.fields[prefix + "Phone"].answer = infos.phone;
670
566
  if (infos.zip && ret.fields[prefix + "Zip"]) ret.fields[prefix + "Zip"].answer = infos.zip;
671
-
672
567
  if (infos.hid) {
673
568
  if (ret.fields[prefix + "HID"]) {
674
569
  ret.fields[prefix + "HID"].answer = infos.hid;
@@ -683,7 +578,6 @@ function updatePersonalIntoPopulatedWorkflowData(infos, data, category) {
683
578
  };
684
579
  }
685
580
  }
686
-
687
581
  return ret;
688
582
  }
689
583
  /**
@@ -691,12 +585,10 @@ function updatePersonalIntoPopulatedWorkflowData(infos, data, category) {
691
585
  * @param answers answers from the WorkflowData
692
586
  * @returns an ISO 3166 alpha-2 code or undefined
693
587
  */
694
-
695
588
  function extractISOLocalityForConsult(answers) {
696
589
  if (!answers) {
697
590
  return undefined;
698
591
  }
699
-
700
592
  var arrAnswersWithLocality = answers.flatMap(function (currentAnswerPage) {
701
593
  var arrCountryFields = Object.keys(currentAnswerPage).filter(function (workflowFieldName) {
702
594
  return workflowFieldName.indexOf('Country') !== -1;
@@ -706,8 +598,8 @@ function extractISOLocalityForConsult(answers) {
706
598
  }).flat();
707
599
  var arrConsultLocalFields = Object.keys(currentAnswerPage).filter(function (workflowFieldName) {
708
600
  return workflowFieldName.indexOf('Locality') !== -1;
709
- }).flat(); //returning the actual selected values, skipping if their IDs are more complex than a string
710
-
601
+ }).flat();
602
+ //returning the actual selected values, skipping if their IDs are more complex than a string
711
603
  return [].concat(arrCountryFields.map(function (currentFieldName) {
712
604
  return typeof currentAnswerPage[currentFieldName] === 'string' ? currentAnswerPage[currentFieldName] : undefined;
713
605
  }), arrProvinceFields.map(function (currentFieldName) {
@@ -721,43 +613,34 @@ function extractISOLocalityForConsult(answers) {
721
613
  var arrSelectedLocality = arrAnswersWithLocality.filter(function (currentSelectedLocality) {
722
614
  return currentSelectedLocality.startsWith('isoLocalityConsult');
723
615
  });
724
-
725
616
  if (!arrSelectedLocality || arrSelectedLocality.length === 0) {
726
617
  console.log('no locality found in ' + arrSelectedLocality);
727
618
  return undefined;
728
- } //to allow enforcing of an order, we will allow the following pattern in the isoLocalityConsult field name
619
+ }
620
+ //to allow enforcing of an order, we will allow the following pattern in the isoLocalityConsult field name
729
621
  // isoLocalityConsult-QC-CA and isoLocalityConsult_1-QC-CA
730
622
  // or generally: isoLocalityConsult-<isoValue> or isoLocalityConsult_<priority>-<isoValue>
731
-
732
-
733
623
  var allowedLocalityPatterns = /*#__PURE__*/_wrapRegExp(/isoLocalityConsult(?:_(\d*))?\x2D([a-zA-Z0-9]{2}\x2D[a-zA-Z0-9]{1,3})/, {
734
624
  indexPriority: 1,
735
625
  isoValue: 2
736
626
  });
737
-
738
627
  var finalLocality = arrSelectedLocality.reduce(function (finalLocality, currentSelectedLocality) {
739
628
  var extractedSelected = allowedLocalityPatterns.exec(currentSelectedLocality);
740
-
741
629
  var _ref2 = extractedSelected != null ? extractedSelected : [],
742
- indexSelectedPriority = _ref2[1],
743
- isoSelectedValue = _ref2[2];
744
-
630
+ indexSelectedPriority = _ref2[1],
631
+ isoSelectedValue = _ref2[2];
745
632
  if (!finalLocality) {
746
633
  return isoSelectedValue;
747
634
  }
748
-
749
635
  var extractedFinal = allowedLocalityPatterns.exec(finalLocality);
750
-
751
636
  var _ref3 = extractedFinal != null ? extractedFinal : [],
752
- indexFinalPriority = _ref3[1],
753
- isoFinalValue = _ref3[2]; //we only keep the old value if there's priority used
637
+ indexFinalPriority = _ref3[1],
638
+ isoFinalValue = _ref3[2];
639
+ //we only keep the old value if there's priority used
754
640
  // and the new value is of lower priority
755
-
756
-
757
641
  if (!indexSelectedPriority || indexFinalPriority && indexFinalPriority > indexSelectedPriority) {
758
642
  return isoFinalValue;
759
643
  }
760
-
761
644
  return isoSelectedValue;
762
645
  }, undefined);
763
646
  console.log('Picking locality ' + finalLocality);
@@ -770,65 +653,51 @@ function sessionStorePrivateKeyName(id) {
770
653
 
771
654
  var IncompleteAuthentication = /*#__PURE__*/function (_Error) {
772
655
  _inheritsLoose(IncompleteAuthentication, _Error);
773
-
774
656
  function IncompleteAuthentication() {
775
657
  return _Error.apply(this, arguments) || this;
776
658
  }
777
-
778
659
  return IncompleteAuthentication;
779
660
  }( /*#__PURE__*/_wrapNativeSuper(Error));
780
661
  var MissingGrant = /*#__PURE__*/function (_Error2) {
781
662
  _inheritsLoose(MissingGrant, _Error2);
782
-
783
663
  function MissingGrant() {
784
664
  return _Error2.apply(this, arguments) || this;
785
665
  }
786
-
787
666
  return MissingGrant;
788
667
  }( /*#__PURE__*/_wrapNativeSuper(Error));
789
668
  var MissingGrantFilter = /*#__PURE__*/function (_Error3) {
790
669
  _inheritsLoose(MissingGrantFilter, _Error3);
791
-
792
670
  function MissingGrantFilter() {
793
671
  return _Error3.apply(this, arguments) || this;
794
672
  }
795
-
796
673
  return MissingGrantFilter;
797
674
  }( /*#__PURE__*/_wrapNativeSuper(Error));
798
675
  var MissingLockbox = /*#__PURE__*/function (_Error4) {
799
676
  _inheritsLoose(MissingLockbox, _Error4);
800
-
801
677
  function MissingLockbox() {
802
678
  return _Error4.apply(this, arguments) || this;
803
679
  }
804
-
805
680
  return MissingLockbox;
806
681
  }( /*#__PURE__*/_wrapNativeSuper(Error));
807
682
  var MissingLockboxOwner = /*#__PURE__*/function (_Error5) {
808
683
  _inheritsLoose(MissingLockboxOwner, _Error5);
809
-
810
684
  function MissingLockboxOwner() {
811
685
  return _Error5.apply(this, arguments) || this;
812
686
  }
813
-
814
687
  return MissingLockboxOwner;
815
688
  }( /*#__PURE__*/_wrapNativeSuper(Error));
816
689
  var AssociatedLockboxNotFound = /*#__PURE__*/function (_Error6) {
817
690
  _inheritsLoose(AssociatedLockboxNotFound, _Error6);
818
-
819
691
  function AssociatedLockboxNotFound() {
820
692
  return _Error6.apply(this, arguments) || this;
821
693
  }
822
-
823
694
  return AssociatedLockboxNotFound;
824
695
  }( /*#__PURE__*/_wrapNativeSuper(Error));
825
696
  var WorkflowAnswersMissingError = /*#__PURE__*/function (_Error7) {
826
697
  _inheritsLoose(WorkflowAnswersMissingError, _Error7);
827
-
828
698
  function WorkflowAnswersMissingError() {
829
699
  return _Error7.apply(this, arguments) || this;
830
700
  }
831
-
832
701
  return WorkflowAnswersMissingError;
833
702
  }( /*#__PURE__*/_wrapNativeSuper(Error));
834
703
 
@@ -844,7 +713,6 @@ function filterTriggeredAnsweredWithKind(_x, _x2) {
844
713
  * @param category
845
714
  * @returns An array of record key, value pairs
846
715
  */
847
-
848
716
  function _filterTriggeredAnsweredWithKind() {
849
717
  _filterTriggeredAnsweredWithKind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(workflowData, kind) {
850
718
  var flattenedAnswers, triggeredQuestionsWithKind, samePageAnswers, res;
@@ -856,13 +724,10 @@ function _filterTriggeredAnsweredWithKind() {
856
724
  _context.next = 2;
857
725
  break;
858
726
  }
859
-
860
727
  throw WorkflowAnswersMissingError;
861
-
862
728
  case 2:
863
729
  // Flattens the list of answered questions
864
730
  flattenedAnswers = flattenSelectedAnswers(workflowData.selectedAnswers); // Generates a list of applicable questions
865
-
866
731
  triggeredQuestionsWithKind = Object.fromEntries(workflowData.pages.map(function (a) {
867
732
  return Object.entries(a.questions).filter(function (_ref) {
868
733
  var question = _ref[1];
@@ -876,7 +741,6 @@ function _filterTriggeredAnsweredWithKind() {
876
741
  return samePageAnswers[questionFieldName];
877
742
  });
878
743
  return _context.abrupt("return", res);
879
-
880
744
  case 7:
881
745
  case "end":
882
746
  return _context.stop();
@@ -886,11 +750,9 @@ function _filterTriggeredAnsweredWithKind() {
886
750
  }));
887
751
  return _filterTriggeredAnsweredWithKind.apply(this, arguments);
888
752
  }
889
-
890
753
  function getWorkflowDataByCategory(_x3, _x4) {
891
754
  return _getWorkflowDataByCategory.apply(this, arguments);
892
755
  }
893
-
894
756
  function _getWorkflowDataByCategory() {
895
757
  _getWorkflowDataByCategory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(workflowData, category) {
896
758
  var flattenedAnswers, triggeredQuestions, fields;
@@ -902,13 +764,10 @@ function _getWorkflowDataByCategory() {
902
764
  _context2.next = 2;
903
765
  break;
904
766
  }
905
-
906
767
  throw WorkflowAnswersMissingError;
907
-
908
768
  case 2:
909
769
  // Flattens the list of answered questions
910
770
  flattenedAnswers = flattenSelectedAnswers(workflowData.selectedAnswers); // Generates a list of applicable questions
911
-
912
771
  triggeredQuestions = Object.fromEntries(workflowData.pages.map(function (a) {
913
772
  return Object.entries(a.questions).filter(function (_ref2) {
914
773
  var question = _ref2[1];
@@ -916,7 +775,6 @@ function _getWorkflowDataByCategory() {
916
775
  });
917
776
  }).flat());
918
777
  fields = {}; // Generates the answers of the specified category and adds the appropriate values if any are missing
919
-
920
778
  return _context2.abrupt("return", Promise.all(workflowData.selectedAnswers.map(function (e) {
921
779
  return Object.entries(e);
922
780
  }).flat().filter(function (_ref3) {
@@ -924,7 +782,7 @@ function _getWorkflowDataByCategory() {
924
782
  return triggeredQuestions[k] && triggeredQuestions[k]['metaCategory'] === category;
925
783
  }).map(function (_ref4) {
926
784
  var k = _ref4[0],
927
- v = _ref4[1];
785
+ v = _ref4[1];
928
786
  return populateWorkflowField(triggeredQuestions[k], v).then(function (populatedValue) {
929
787
  fields[k] = populatedValue;
930
788
  });
@@ -940,7 +798,6 @@ function _getWorkflowDataByCategory() {
940
798
  console.error("Error while extracting " + category + " data from workflow", err);
941
799
  throw err;
942
800
  }));
943
-
944
801
  case 6:
945
802
  case "end":
946
803
  return _context2.stop();
@@ -950,7 +807,6 @@ function _getWorkflowDataByCategory() {
950
807
  }));
951
808
  return _getWorkflowDataByCategory.apply(this, arguments);
952
809
  }
953
-
954
810
  function getImagesFromIndexDb(_x5) {
955
811
  return _getImagesFromIndexDb.apply(this, arguments);
956
812
  }
@@ -963,7 +819,6 @@ function getImagesFromIndexDb(_x5) {
963
819
  * @param answerValue
964
820
  * @returns
965
821
  */
966
-
967
822
  function _getImagesFromIndexDb() {
968
823
  _getImagesFromIndexDb = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(answer) {
969
824
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -973,13 +828,10 @@ function _getImagesFromIndexDb() {
973
828
  _context3.next = 2;
974
829
  return idbKeyval.getMany(answer.map(function (v) {
975
830
  var _v$id;
976
-
977
831
  return (_v$id = v.id) != null ? _v$id : v;
978
832
  }));
979
-
980
833
  case 2:
981
834
  return _context3.abrupt("return", _context3.sent);
982
-
983
835
  case 3:
984
836
  case "end":
985
837
  return _context3.stop();
@@ -989,7 +841,6 @@ function _getImagesFromIndexDb() {
989
841
  }));
990
842
  return _getImagesFromIndexDb.apply(this, arguments);
991
843
  }
992
-
993
844
  function populateWorkflowField(_x6, _x7) {
994
845
  return _populateWorkflowField.apply(this, arguments);
995
846
  }
@@ -1039,8 +890,6 @@ function populateWorkflowField(_x6, _x7) {
1039
890
  * @returns `true` if triggers are verified against ansers. Otherwise, returns `false`.
1040
891
  * @throws an Error if triggers typing is wrong
1041
892
  */
1042
-
1043
-
1044
893
  function _populateWorkflowField() {
1045
894
  _populateWorkflowField = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(question, answerValue) {
1046
895
  var answer, displayedAnswer;
@@ -1052,61 +901,50 @@ function _populateWorkflowField() {
1052
901
  _context4.t0 = question.kind;
1053
902
  _context4.next = _context4.t0 === 'text-select-group' ? 4 : _context4.t0 === 'radio' ? 7 : _context4.t0 === 'radio-card' ? 7 : _context4.t0 === 'select' ? 7 : _context4.t0 === 'multiple' ? 10 : _context4.t0 === 'checkbox-group' ? 10 : _context4.t0 === 'images' ? 13 : 17;
1054
903
  break;
1055
-
1056
904
  case 4:
1057
905
  if (question.answers) {
1058
906
  displayedAnswer = answerValue[0] + " " + question.answers[answerValue[1]].text;
1059
907
  }
1060
-
1061
908
  answer = answerValue;
1062
909
  return _context4.abrupt("break", 18);
1063
-
1064
910
  case 7:
1065
911
  if (question.answers) {
1066
912
  displayedAnswer = question.answers[answerValue].text;
1067
913
  }
1068
-
1069
914
  answer = answerValue;
1070
915
  return _context4.abrupt("break", 18);
1071
-
1072
916
  case 10:
1073
917
  displayedAnswer = answerValue.map(function (value) {
1074
918
  if (question.answers) {
1075
919
  return question.answers[value].text;
1076
920
  }
1077
-
1078
921
  throw new WorkflowAnswersMissingError();
1079
922
  });
1080
923
  answer = answerValue;
1081
924
  return _context4.abrupt("break", 18);
1082
-
1083
925
  case 13:
1084
926
  _context4.next = 15;
1085
927
  return getImagesFromIndexDb(answerValue).then(function (images) {
1086
928
  return images.map(function (image) {
1087
929
  var name = image.name,
1088
- imageData = image.imageData;
930
+ imageData = image.imageData;
1089
931
  return {
1090
932
  name: name,
1091
933
  imageData: imageData
1092
934
  };
1093
935
  });
1094
936
  });
1095
-
1096
937
  case 15:
1097
938
  answer = _context4.sent;
1098
939
  return _context4.abrupt("break", 18);
1099
-
1100
940
  case 17:
1101
941
  answer = answerValue;
1102
-
1103
942
  case 18:
1104
943
  return _context4.abrupt("return", Promise.resolve({
1105
944
  answer: answer,
1106
945
  displayedAnswer: displayedAnswer,
1107
946
  kind: question.kind
1108
947
  }));
1109
-
1110
948
  case 19:
1111
949
  case "end":
1112
950
  return _context4.stop();
@@ -1116,13 +954,11 @@ function _populateWorkflowField() {
1116
954
  }));
1117
955
  return _populateWorkflowField.apply(this, arguments);
1118
956
  }
1119
-
1120
957
  function isTriggered(triggers, answers) {
1121
958
  // is triggers contained in answers
1122
959
  if (typeof triggers === 'string') {
1123
960
  return answers.includes(triggers);
1124
961
  }
1125
-
1126
962
  if (Array.isArray(triggers)) {
1127
963
  // rule combination kind: rule1 OR (rule2 AND rule3)
1128
964
  if (Array.isArray(triggers[0])) {
@@ -1138,17 +974,14 @@ function isTriggered(triggers, answers) {
1138
974
  });
1139
975
  }
1140
976
  }
1141
-
1142
977
  throw Error('[isTriggered] triggers is not typed well');
1143
978
  }
1144
979
  function flattenSelectedAnswers(answers) {
1145
980
  var linearAnswers = [];
1146
-
1147
981
  for (var _iterator = _createForOfIteratorHelperLoose(answers), _step; !(_step = _iterator()).done;) {
1148
982
  var answer = _step.value;
1149
983
  linearAnswers.push.apply(linearAnswers, Object.values(answer));
1150
984
  }
1151
-
1152
985
  return linearAnswers.flat(1);
1153
986
  }
1154
987
  /**
@@ -1157,43 +990,34 @@ function flattenSelectedAnswers(answers) {
1157
990
  * @param useDefault use workflow default values or not (this is used to avoid having unset values to appear in summaries)
1158
991
  * @returns a valid selectedAnswers structure
1159
992
  */
1160
-
1161
993
  function getInitialisedSelectedAnswers(workflow, useDefault) {
1162
994
  if (useDefault === void 0) {
1163
995
  useDefault = true;
1164
996
  }
1165
-
1166
997
  return workflow.pages.map(function (page) {
1167
998
  var ret = {};
1168
-
1169
999
  for (var _i = 0, _Object$entries = Object.entries(page.questions); _i < _Object$entries.length; _i++) {
1170
1000
  var _Object$entries$_i = _Object$entries[_i],
1171
- id = _Object$entries$_i[0],
1172
- question = _Object$entries$_i[1];
1173
-
1001
+ id = _Object$entries$_i[0],
1002
+ question = _Object$entries$_i[1];
1174
1003
  if (question.kind === 'body-parts') {
1175
1004
  ret[id] = useDefault ? [] : undefined;
1176
1005
  } else {
1177
1006
  ret[id] = useDefault && question.defaultValue ? question.defaultValue : undefined;
1178
1007
  }
1179
1008
  }
1180
-
1181
1009
  return ret;
1182
1010
  });
1183
1011
  }
1184
1012
  function fillWorkflowFromPopulatedWorkflow(workflow, populatedWorkflow) {
1185
1013
  var filledWorkflow = JSON.parse(JSON.stringify(workflow));
1186
-
1187
1014
  if (!filledWorkflow.selectedAnswers) {
1188
1015
  filledWorkflow.selectedAnswers = getInitialisedSelectedAnswers(filledWorkflow, false);
1189
1016
  }
1190
-
1191
1017
  filledWorkflow.pages.forEach(function (page, pageIdx) {
1192
-
1193
1018
  for (var _i2 = 0, _Object$entries2 = Object.entries(page.questions); _i2 < _Object$entries2.length; _i2++) {
1194
1019
  var _Object$entries2$_i = _Object$entries2[_i2],
1195
- id = _Object$entries2$_i[0];
1196
-
1020
+ id = _Object$entries2$_i[0];
1197
1021
  if (populatedWorkflow.fields[id]) {
1198
1022
  if (filledWorkflow.selectedAnswers) filledWorkflow.selectedAnswers[pageIdx][id] = populatedWorkflow.fields[id].answer;
1199
1023
  }
@@ -1211,7 +1035,6 @@ function fillWorkflowFromPopulatedWorkflow(workflow, populatedWorkflow) {
1211
1035
  function getOrCreatePatientConsultationUuid(_x, _x2) {
1212
1036
  return _getOrCreatePatientConsultationUuid.apply(this, arguments);
1213
1037
  }
1214
-
1215
1038
  function _getOrCreatePatientConsultationUuid() {
1216
1039
  _getOrCreatePatientConsultationUuid = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(consult, oroClient) {
1217
1040
  var payment;
@@ -1221,30 +1044,24 @@ function _getOrCreatePatientConsultationUuid() {
1221
1044
  case 0:
1222
1045
  _context.next = 2;
1223
1046
  return oroClient.practiceClient.practiceGetPayment(consult.uuidPractice, consult.idStripeInvoiceOrPaymentIntent);
1224
-
1225
1047
  case 2:
1226
1048
  payment = _context.sent;
1227
-
1228
1049
  if (!(payment && payment.uuidConsult)) {
1229
1050
  _context.next = 7;
1230
1051
  break;
1231
1052
  }
1232
-
1233
1053
  return _context.abrupt("return", oroClient.consultClient.getConsultByUUID(payment.uuidConsult)["catch"](function (err) {
1234
1054
  console.error('Error while retrieving consult', err);
1235
1055
  throw err;
1236
1056
  }));
1237
-
1238
1057
  case 7:
1239
1058
  _context.next = 9;
1240
1059
  return oroClient.consultClient.consultCreate(consult)["catch"](function (err) {
1241
1060
  console.error('Error while creating consult', err);
1242
1061
  throw err;
1243
1062
  });
1244
-
1245
1063
  case 9:
1246
1064
  return _context.abrupt("return", _context.sent);
1247
-
1248
1065
  case 10:
1249
1066
  case "end":
1250
1067
  return _context.stop();
@@ -1278,7 +1095,6 @@ var MAX_RETRIES = 15;
1278
1095
  * @param onProgress callback that is called whenever a new step of patient registration is executed. Note: progress ranges from 0 to 1, and descriptionKey is a description of the progress as a key so the app would use it to translate the description
1279
1096
  * @returns the successful registration
1280
1097
  */
1281
-
1282
1098
  function registerPatient(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
1283
1099
  return _registerPatient.apply(this, arguments);
1284
1100
  }
@@ -1287,11 +1103,9 @@ function registerPatient(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
1287
1103
  * @param oroClient
1288
1104
  * @returns the lockbox Uuid
1289
1105
  */
1290
-
1291
1106
  function _registerPatient() {
1292
1107
  _registerPatient = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(patientUuid, consultRequest, workflow, oroClient, masterKey, recoveryQA, indexSearch, onProgress) {
1293
1108
  var consult, lockboxUuid, practitionerAdmin, retry, identity, errorsThrown, stepsTotalNum, currentStep, _ret;
1294
-
1295
1109
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1296
1110
  while (1) {
1297
1111
  switch (_context4.prev = _context4.next) {
@@ -1299,7 +1113,6 @@ function _registerPatient() {
1299
1113
  if (indexSearch === void 0) {
1300
1114
  indexSearch = true;
1301
1115
  }
1302
-
1303
1116
  consult = undefined;
1304
1117
  lockboxUuid = undefined;
1305
1118
  practitionerAdmin = undefined;
@@ -1307,100 +1120,80 @@ function _registerPatient() {
1307
1120
  identity = undefined;
1308
1121
  errorsThrown = [];
1309
1122
  stepsTotalNum = 9;
1310
-
1311
1123
  case 8:
1312
1124
  if (!(retry > 0)) {
1313
1125
  _context4.next = 24;
1314
1126
  break;
1315
1127
  }
1316
-
1317
1128
  _context4.prev = 9;
1318
1129
  return _context4.delegateYield( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
1319
1130
  var _consultIndex, _identity, _identity2;
1320
-
1321
1131
  var practitioners, grantPromises, consultIndex, consultIndexPromises;
1322
1132
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1323
1133
  while (1) {
1324
1134
  switch (_context3.prev = _context3.next) {
1325
1135
  case 0:
1326
1136
  currentStep = 0;
1327
- if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'retrieve_practitioners'); // Wait a bit each retry (we also want the first one to wait)
1328
-
1137
+ if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'retrieve_practitioners');
1138
+ // Wait a bit each retry (we also want the first one to wait)
1329
1139
  _context3.next = 4;
1330
1140
  return new Promise(function (resolve) {
1331
1141
  return setTimeout(resolve, 2000);
1332
1142
  });
1333
-
1334
1143
  case 4:
1335
1144
  if (practitionerAdmin) {
1336
1145
  _context3.next = 8;
1337
1146
  break;
1338
1147
  }
1339
-
1340
1148
  _context3.next = 7;
1341
1149
  return oroClient.practiceClient.practiceGetFromUuid(consultRequest.uuidPractice);
1342
-
1343
1150
  case 7:
1344
1151
  practitionerAdmin = _context3.sent.uuidAdmin;
1345
-
1346
1152
  case 8:
1347
1153
  _context3.next = 10;
1348
1154
  return oroClient.practiceClient.practiceGetPractitioners(consultRequest.uuidPractice)["catch"](function (err) {
1349
1155
  console.log("Error retrieving practitioners", err);
1350
1156
  return [];
1351
1157
  });
1352
-
1353
1158
  case 10:
1354
1159
  practitioners = _context3.sent;
1355
1160
  // Creating consult
1356
1161
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'create_consult');
1357
-
1358
1162
  if (consult) {
1359
1163
  _context3.next = 16;
1360
1164
  break;
1361
1165
  }
1362
-
1363
1166
  _context3.next = 15;
1364
1167
  return getOrCreatePatientConsultationUuid(consultRequest, oroClient);
1365
-
1366
1168
  case 15:
1367
1169
  consult = _context3.sent;
1368
-
1369
1170
  case 16:
1370
1171
  // Creating lockbox
1371
1172
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'create_lockbox');
1372
-
1373
1173
  if (lockboxUuid) {
1374
1174
  _context3.next = 21;
1375
1175
  break;
1376
1176
  }
1377
-
1378
1177
  _context3.next = 20;
1379
1178
  return getOrCreatePatientLockbox(oroClient);
1380
-
1381
1179
  case 20:
1382
1180
  lockboxUuid = _context3.sent;
1383
-
1384
1181
  case 21:
1385
1182
  if (identity) {
1386
1183
  _context3.next = 25;
1387
1184
  break;
1388
1185
  }
1389
-
1390
1186
  _context3.next = 24;
1391
1187
  return oroClient.guardClient.identityGet(patientUuid);
1392
-
1393
1188
  case 24:
1394
1189
  identity = _context3.sent;
1395
-
1396
1190
  case 25:
1397
1191
  _context3.next = 27;
1398
1192
  return oroClient.grantLockbox(practitionerAdmin, lockboxUuid)["catch"](function (err) {
1399
- console.error("Error while granting lockbox to practitioner admin " + practitionerAdmin, err); // if we cannot grant to the admin, then the registration will fail
1400
-
1193
+ console.error("Error while granting lockbox to practitioner admin " + practitionerAdmin, err);
1194
+ // if we cannot grant to the admin, then the registration will fail
1401
1195
  errorsThrown.push(err);
1402
1196
  });
1403
-
1404
1197
  case 27:
1405
1198
  // Patient Grant to practice
1406
1199
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'grant_patient');
@@ -1413,12 +1206,11 @@ function _registerPatient() {
1413
1206
  switch (_context.prev = _context.next) {
1414
1207
  case 0:
1415
1208
  return _context.abrupt("return", oroClient.grantLockbox(practitioner.uuid, lockboxUuid)["catch"](function (err) {
1416
- console.error("Error while granting lockbox to practitioner", err); // Acceptable to continue as admin has already been granted, but we should still retry until the last retry remains
1417
-
1209
+ console.error("Error while granting lockbox to practitioner", err);
1210
+ // Acceptable to continue as admin has already been granted, but we should still retry until the last retry remains
1418
1211
  if (retry <= 1) return;
1419
1212
  errorsThrown.push(err);
1420
1213
  }));
1421
-
1422
1214
  case 1:
1423
1215
  case "end":
1424
1216
  return _context.stop();
@@ -1426,7 +1218,6 @@ function _registerPatient() {
1426
1218
  }
1427
1219
  }, _callee);
1428
1220
  }));
1429
-
1430
1221
  return function (_x29) {
1431
1222
  return _ref.apply(this, arguments);
1432
1223
  };
@@ -1438,7 +1229,6 @@ function _registerPatient() {
1438
1229
  },
1439
1230
  consultationId: consult.uuid
1440
1231
  }], _consultIndex); // the index will identify in which lockbox a consultation resides
1441
-
1442
1232
  consultIndexPromises = practitioners.map( /*#__PURE__*/function () {
1443
1233
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(practitioner) {
1444
1234
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -1446,11 +1236,10 @@ function _registerPatient() {
1446
1236
  switch (_context2.prev = _context2.next) {
1447
1237
  case 0:
1448
1238
  return _context2.abrupt("return", oroClient.vaultIndexAdd(consultIndex, practitioner.uuid)["catch"](function (err) {
1449
- console.error("[SDK: registration] Error while adding to the practitioner's index " + practitioner.uuid, err); // Acceptable to continue as the index can be rebuilt, but we should still retry until the last retry remains
1450
-
1239
+ console.error("[SDK: registration] Error while adding to the practitioner's index " + practitioner.uuid, err);
1240
+ // Acceptable to continue as the index can be rebuilt, but we should still retry until the last retry remains
1451
1241
  if (retry <= 1) return;else errorsThrown.push(err);
1452
1242
  }));
1453
-
1454
1243
  case 1:
1455
1244
  case "end":
1456
1245
  return _context2.stop();
@@ -1458,7 +1247,6 @@ function _registerPatient() {
1458
1247
  }
1459
1248
  }, _callee2);
1460
1249
  }));
1461
-
1462
1250
  return function (_x30) {
1463
1251
  return _ref2.apply(this, arguments);
1464
1252
  };
@@ -1469,11 +1257,10 @@ function _registerPatient() {
1469
1257
  currentStep: currentStep,
1470
1258
  stepsTotalNum: stepsTotalNum
1471
1259
  } : undefined)["catch"](function (err) {
1472
- console.error('[SDK: registration] Some errors happened during image upload', err); // Acceptable to continue as images can be requested during the consultation, but we should still retry until the last retry remains
1473
-
1260
+ console.error('[SDK: registration] Some errors happened during image upload', err);
1261
+ // Acceptable to continue as images can be requested during the consultation, but we should still retry until the last retry remains
1474
1262
  if (retry <= 1) return;else errorsThrown.push(err);
1475
1263
  });
1476
-
1477
1264
  case 33:
1478
1265
  ++currentStep;
1479
1266
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'store_patient_data');
@@ -1482,92 +1269,73 @@ function _registerPatient() {
1482
1269
  console.error('[SDK: registration] Some errors happened during patient data upload', err);
1483
1270
  errorsThrown.push(err);
1484
1271
  });
1485
-
1486
1272
  case 37:
1487
1273
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'set_masterkey');
1488
-
1489
1274
  if (!(masterKey && !((_identity = identity) != null && _identity.recoveryMasterKey))) {
1490
1275
  _context3.next = 44;
1491
1276
  break;
1492
1277
  }
1493
-
1494
1278
  _context3.next = 41;
1495
1279
  return oroClient.updateMasterKey(patientUuid, masterKey, lockboxUuid)["catch"](function (err) {
1496
- console.error("[SDK: registration] Error while updating master key", err); /// it's acceptable to continue registration (return old identity)
1497
-
1280
+ console.error("[SDK: registration] Error while updating master key", err);
1281
+ /// it's acceptable to continue registration (return old identity)
1498
1282
  if (retry <= 1) return;
1499
1283
  errorsThrown.push(err);
1500
1284
  return identity;
1501
1285
  });
1502
-
1503
1286
  case 41:
1504
1287
  identity = _context3.sent;
1505
1288
  _context3.next = 45;
1506
1289
  break;
1507
-
1508
1290
  case 44:
1509
1291
  // we did not set the master key so we do not return it
1510
1292
  masterKey = undefined;
1511
-
1512
1293
  case 45:
1513
1294
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'set_security_questions');
1514
-
1515
1295
  if (!(recoveryQA && !((_identity2 = identity) != null && _identity2.recoverySecurityQuestions))) {
1516
1296
  _context3.next = 50;
1517
1297
  break;
1518
1298
  }
1519
-
1520
1299
  _context3.next = 49;
1521
1300
  return oroClient.updateSecurityQuestions(patientUuid, recoveryQA.recoverySecurityQuestions, recoveryQA.recoverySecurityAnswers, 2)["catch"](function (err) {
1522
- console.error("[SDK: registration] Error while updating security questions", err); /// it's acceptable to continue registration (return old identity)
1523
-
1301
+ console.error("[SDK: registration] Error while updating security questions", err);
1302
+ /// it's acceptable to continue registration (return old identity)
1524
1303
  if (retry <= 1) return;
1525
1304
  errorsThrown.push(err);
1526
1305
  return identity;
1527
1306
  });
1528
-
1529
1307
  case 49:
1530
1308
  identity = _context3.sent;
1531
-
1532
1309
  case 50:
1533
1310
  _context3.next = 52;
1534
1311
  return Promise.all([].concat(grantPromises, consultIndexPromises));
1535
-
1536
1312
  case 52:
1537
1313
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'search_indexing');
1538
-
1539
1314
  if (!indexSearch) {
1540
1315
  _context3.next = 56;
1541
1316
  break;
1542
1317
  }
1543
-
1544
1318
  _context3.next = 56;
1545
1319
  return buildConsultSearchIndex(consult, workflow, oroClient)["catch"](function (err) {
1546
1320
  console.error('[SDK: registration] personal information not found or another error occured during search indexing', err);
1547
1321
  if (retry <= 1) return; // this statement is to avoid failing the registration due to the failure in search indexing the consult, this practically implements a soft retry
1548
-
1549
1322
  errorsThrown.push(err);
1550
1323
  });
1551
-
1552
1324
  case 56:
1553
1325
  if (!(errorsThrown.length > 0)) {
1554
1326
  _context3.next = 58;
1555
1327
  break;
1556
1328
  }
1557
-
1558
1329
  throw errorsThrown;
1559
-
1560
1330
  case 58:
1561
1331
  _context3.next = 60;
1562
1332
  return oroClient.consultClient.updateConsultByUUID(consult.uuid, {
1563
1333
  statusMedical: initApis.MedicalStatus.New
1564
1334
  });
1565
-
1566
1335
  case 60:
1567
1336
  // if we got through the complete flow, the registration succeeded
1568
1337
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'success');
1569
1338
  return _context3.abrupt("return", "break");
1570
-
1571
1339
  case 62:
1572
1340
  case "end":
1573
1341
  return _context3.stop();
@@ -1575,54 +1343,43 @@ function _registerPatient() {
1575
1343
  }
1576
1344
  }, _callee3);
1577
1345
  })(), "t0", 11);
1578
-
1579
1346
  case 11:
1580
1347
  _ret = _context4.t0;
1581
-
1582
1348
  if (!(_ret === "break")) {
1583
1349
  _context4.next = 14;
1584
1350
  break;
1585
1351
  }
1586
-
1587
1352
  return _context4.abrupt("break", 24);
1588
-
1589
1353
  case 14:
1590
1354
  _context4.next = 21;
1591
1355
  break;
1592
-
1593
1356
  case 16:
1594
1357
  _context4.prev = 16;
1595
1358
  _context4.t1 = _context4["catch"](9);
1596
1359
  console.error("[SDK] Error occured during registration: " + _context4.t1 + ", retrying... Retries remaining: " + retry);
1597
1360
  errorsThrown = [];
1598
1361
  return _context4.abrupt("continue", 21);
1599
-
1600
1362
  case 21:
1601
1363
  retry--;
1602
1364
  _context4.next = 8;
1603
1365
  break;
1604
-
1605
1366
  case 24:
1606
1367
  if (!(retry <= 0)) {
1607
1368
  _context4.next = 27;
1608
1369
  break;
1609
1370
  }
1610
-
1611
1371
  console.error('[SDK] registration failed: MAX_RETRIES reached');
1612
1372
  throw 'RegistrationFailed';
1613
-
1614
1373
  case 27:
1615
1374
  console.log('Successfully Registered');
1616
1375
  _context4.next = 30;
1617
1376
  return oroClient.cleanIndex();
1618
-
1619
1377
  case 30:
1620
1378
  return _context4.abrupt("return", {
1621
1379
  masterKey: masterKey,
1622
1380
  consultationId: consult.uuid,
1623
1381
  lockboxUuid: lockboxUuid
1624
1382
  });
1625
-
1626
1383
  case 31:
1627
1384
  case "end":
1628
1385
  return _context4.stop();
@@ -1632,7 +1389,6 @@ function _registerPatient() {
1632
1389
  }));
1633
1390
  return _registerPatient.apply(this, arguments);
1634
1391
  }
1635
-
1636
1392
  function getOrCreatePatientLockbox(_x9) {
1637
1393
  return _getOrCreatePatientLockbox.apply(this, arguments);
1638
1394
  }
@@ -1645,8 +1401,6 @@ function getOrCreatePatientLockbox(_x9) {
1645
1401
  * @param oroClient an oroClient instance
1646
1402
  * @returns
1647
1403
  */
1648
-
1649
-
1650
1404
  function _getOrCreatePatientLockbox() {
1651
1405
  _getOrCreatePatientLockbox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(oroClient) {
1652
1406
  var grants, lockboxResponse, tokens;
@@ -1656,30 +1410,24 @@ function _getOrCreatePatientLockbox() {
1656
1410
  case 0:
1657
1411
  _context5.next = 2;
1658
1412
  return oroClient.getGrants();
1659
-
1660
1413
  case 2:
1661
1414
  grants = _context5.sent;
1662
-
1663
1415
  if (!(grants.length > 0)) {
1664
1416
  _context5.next = 8;
1665
1417
  break;
1666
1418
  }
1667
-
1668
1419
  console.log('The grant has already been created, skipping lockbox create step');
1669
1420
  return _context5.abrupt("return", grants[0].lockboxUuid);
1670
-
1671
1421
  case 8:
1672
1422
  _context5.next = 10;
1673
1423
  return oroClient.vaultClient.lockboxCreate()["catch"](function (err) {
1674
1424
  console.error('Error while creating lockbox', err);
1675
1425
  throw err;
1676
1426
  });
1677
-
1678
1427
  case 10:
1679
1428
  lockboxResponse = _context5.sent;
1680
1429
  _context5.next = 13;
1681
1430
  return oroClient.guardClient.authRefresh();
1682
-
1683
1431
  case 13:
1684
1432
  tokens = _context5.sent;
1685
1433
  _context5.next = 16;
@@ -1687,14 +1435,11 @@ function _getOrCreatePatientLockbox() {
1687
1435
  accessToken: tokens.accessToken,
1688
1436
  refreshToken: tokens.refreshToken
1689
1437
  });
1690
-
1691
1438
  case 16:
1692
1439
  _context5.next = 18;
1693
1440
  return oroClient.guardClient.whoAmI(true);
1694
-
1695
1441
  case 18:
1696
1442
  return _context5.abrupt("return", lockboxResponse.lockboxUuid);
1697
-
1698
1443
  case 19:
1699
1444
  case "end":
1700
1445
  return _context5.stop();
@@ -1704,18 +1449,17 @@ function _getOrCreatePatientLockbox() {
1704
1449
  }));
1705
1450
  return _getOrCreatePatientLockbox.apply(this, arguments);
1706
1451
  }
1707
-
1708
1452
  function storePatientData(_x10, _x11, _x12, _x13, _x14) {
1709
1453
  return _storePatientData.apply(this, arguments);
1710
1454
  }
1711
-
1712
1455
  function _storePatientData() {
1713
1456
  _storePatientData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(consultationId, isoLanguage, lockboxUuid, workflow, oroClient) {
1714
1457
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1715
1458
  while (1) {
1716
1459
  switch (_context6.prev = _context6.next) {
1717
1460
  case 0:
1718
- return _context6.abrupt("return", Promise.all([// Storing Raw data first
1461
+ return _context6.abrupt("return", Promise.all([
1462
+ // Storing Raw data first
1719
1463
  oroClient.getOrInsertJsonData(lockboxUuid, workflow, {
1720
1464
  category: initApis.MetadataCategory.Raw,
1721
1465
  contentType: 'application/json',
@@ -1744,7 +1488,6 @@ function _storePatientData() {
1744
1488
  }, {})]).then(function (dataUuids) {
1745
1489
  return dataUuids.flat();
1746
1490
  }));
1747
-
1748
1491
  case 1:
1749
1492
  case "end":
1750
1493
  return _context6.stop();
@@ -1754,7 +1497,6 @@ function _storePatientData() {
1754
1497
  }));
1755
1498
  return _storePatientData.apply(this, arguments);
1756
1499
  }
1757
-
1758
1500
  function storeImageAliases(_x15, _x16, _x17, _x18, _x19) {
1759
1501
  return _storeImageAliases.apply(this, arguments);
1760
1502
  }
@@ -1767,8 +1509,6 @@ function storeImageAliases(_x15, _x16, _x17, _x18, _x19) {
1767
1509
  * @param category
1768
1510
  * @returns The data uuid
1769
1511
  */
1770
-
1771
-
1772
1512
  function _storeImageAliases() {
1773
1513
  _storeImageAliases = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(consultationId, lockboxUuid, workflow, oroClient, progress) {
1774
1514
  var images, nonNullImages, storedImagesNum, totalImagesNum, promises;
@@ -1779,22 +1519,18 @@ function _storeImageAliases() {
1779
1519
  _context7.t0 = getImagesFromIndexDb;
1780
1520
  _context7.next = 3;
1781
1521
  return filterTriggeredAnsweredWithKind(workflow, 'images-alias');
1782
-
1783
1522
  case 3:
1784
1523
  _context7.t1 = _context7.sent.flat();
1785
1524
  _context7.next = 6;
1786
1525
  return (0, _context7.t0)(_context7.t1);
1787
-
1788
1526
  case 6:
1789
1527
  images = _context7.sent;
1790
1528
  nonNullImages = images.filter(function (img) {
1791
1529
  return !!img;
1792
1530
  });
1793
-
1794
1531
  if (images.length !== nonNullImages.length) {
1795
1532
  console.error('[SDK] Some images have not been found, they have been skipped.');
1796
1533
  }
1797
-
1798
1534
  storedImagesNum = 0;
1799
1535
  totalImagesNum = nonNullImages.length;
1800
1536
  if (progress) progress.onProgress(progress.currentStep / progress.stepsTotalNum, 'store_images', {
@@ -1819,7 +1555,6 @@ function _storeImageAliases() {
1819
1555
  });
1820
1556
  });
1821
1557
  return _context7.abrupt("return", Promise.all(promises));
1822
-
1823
1558
  case 14:
1824
1559
  case "end":
1825
1560
  return _context7.stop();
@@ -1829,7 +1564,6 @@ function _storeImageAliases() {
1829
1564
  }));
1830
1565
  return _storeImageAliases.apply(this, arguments);
1831
1566
  }
1832
-
1833
1567
  function extractAndStorePersonalWorkflowData(_x20, _x21, _x22, _x23, _x24) {
1834
1568
  return _extractAndStorePersonalWorkflowData.apply(this, arguments);
1835
1569
  }
@@ -1837,7 +1571,6 @@ function extractAndStorePersonalWorkflowData(_x20, _x21, _x22, _x23, _x24) {
1837
1571
  * Given workflow data, it populates it with Personal, ChildPersonal, and OtherPersonal workflow data
1838
1572
  * @param workflow
1839
1573
  */
1840
-
1841
1574
  function _extractAndStorePersonalWorkflowData() {
1842
1575
  _extractAndStorePersonalWorkflowData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(workflow, lockboxUuid, consultationId, category, oroClient) {
1843
1576
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
@@ -1852,7 +1585,6 @@ function _extractAndStorePersonalWorkflowData() {
1852
1585
  consultationIds: [consultationId]
1853
1586
  }, {});
1854
1587
  }));
1855
-
1856
1588
  case 1:
1857
1589
  case "end":
1858
1590
  return _context8.stop();
@@ -1862,7 +1594,6 @@ function _extractAndStorePersonalWorkflowData() {
1862
1594
  }));
1863
1595
  return _extractAndStorePersonalWorkflowData.apply(this, arguments);
1864
1596
  }
1865
-
1866
1597
  function extractPersonalInfoFromWorkflowData(_x25) {
1867
1598
  return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
1868
1599
  }
@@ -1872,7 +1603,6 @@ function extractPersonalInfoFromWorkflowData(_x25) {
1872
1603
  * @param workflow the workflow data
1873
1604
  * @param oroClient
1874
1605
  */
1875
-
1876
1606
  function _extractPersonalInfoFromWorkflowData() {
1877
1607
  _extractPersonalInfoFromWorkflowData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(workflow) {
1878
1608
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
@@ -1881,15 +1611,14 @@ function _extractPersonalInfoFromWorkflowData() {
1881
1611
  case 0:
1882
1612
  return _context9.abrupt("return", Promise.all([getWorkflowDataByCategory(workflow, initApis.MetadataCategory.Personal), getWorkflowDataByCategory(workflow, initApis.MetadataCategory.ChildPersonal), getWorkflowDataByCategory(workflow, initApis.MetadataCategory.OtherPersonal)]).then(function (_ref3) {
1883
1613
  var personalInfoPopulatedWfData = _ref3[0],
1884
- childPersonalInfoPopulatedWfData = _ref3[1],
1885
- otherPersonalInfoPopulatedWfData = _ref3[2];
1614
+ childPersonalInfoPopulatedWfData = _ref3[1],
1615
+ otherPersonalInfoPopulatedWfData = _ref3[2];
1886
1616
  return {
1887
1617
  personalInfoPopulatedWfData: personalInfoPopulatedWfData,
1888
1618
  childPersonalInfoPopulatedWfData: childPersonalInfoPopulatedWfData,
1889
1619
  otherPersonalInfoPopulatedWfData: otherPersonalInfoPopulatedWfData
1890
1620
  };
1891
1621
  }));
1892
-
1893
1622
  case 1:
1894
1623
  case "end":
1895
1624
  return _context9.stop();
@@ -1899,15 +1628,12 @@ function _extractPersonalInfoFromWorkflowData() {
1899
1628
  }));
1900
1629
  return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
1901
1630
  }
1902
-
1903
1631
  function buildConsultSearchIndex(_x26, _x27, _x28) {
1904
1632
  return _buildConsultSearchIndex.apply(this, arguments);
1905
1633
  }
1906
-
1907
1634
  function _buildConsultSearchIndex() {
1908
1635
  _buildConsultSearchIndex = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(consult, workflow, oroClient) {
1909
1636
  var terms, _yield$extractPersona, personalInfoPopulatedWfData, childPersonalInfoPopulatedWfData, otherPersonalInfoPopulatedWfData, personalInfo, childPersonalInfo, otherPersonalInfo;
1910
-
1911
1637
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1912
1638
  while (1) {
1913
1639
  switch (_context10.prev = _context10.next) {
@@ -1918,7 +1644,6 @@ function _buildConsultSearchIndex() {
1918
1644
  }];
1919
1645
  _context10.next = 3;
1920
1646
  return extractPersonalInfoFromWorkflowData(workflow);
1921
-
1922
1647
  case 3:
1923
1648
  _yield$extractPersona = _context10.sent;
1924
1649
  personalInfoPopulatedWfData = _yield$extractPersona.personalInfoPopulatedWfData;
@@ -1934,7 +1659,6 @@ function _buildConsultSearchIndex() {
1934
1659
  kind: 'last-name',
1935
1660
  value: personalInfo.name
1936
1661
  });
1937
-
1938
1662
  if (childPersonalInfo.firstname && childPersonalInfo.name) {
1939
1663
  terms.push({
1940
1664
  kind: 'first-name',
@@ -1944,7 +1668,6 @@ function _buildConsultSearchIndex() {
1944
1668
  value: childPersonalInfo.name
1945
1669
  });
1946
1670
  }
1947
-
1948
1671
  if (otherPersonalInfo.firstname && otherPersonalInfo.name) {
1949
1672
  terms.push({
1950
1673
  kind: 'first-name',
@@ -1954,10 +1677,8 @@ function _buildConsultSearchIndex() {
1954
1677
  value: otherPersonalInfo.name
1955
1678
  });
1956
1679
  }
1957
-
1958
1680
  _context10.next = 15;
1959
1681
  return oroClient.searchClient.index(consult.uuid, terms);
1960
-
1961
1682
  case 15:
1962
1683
  case "end":
1963
1684
  return _context10.stop();
@@ -1976,7 +1697,6 @@ function _buildConsultSearchIndex() {
1976
1697
  * @param rsaKey: the rsa key used to decrypt the encrypted grants
1977
1698
  * @returns an array of grants
1978
1699
  */
1979
-
1980
1700
  function decryptGrants(encryptedGrants, rsaKey) {
1981
1701
  return encryptedGrants.map(function (grant) {
1982
1702
  if (grant.encryptedLockbox && !grant.lockboxUuid) {
@@ -1986,7 +1706,6 @@ function decryptGrants(encryptedGrants, rsaKey) {
1986
1706
  console.error('[sdk:index] The grant could not be decrypted or was not a valid UUID: ', e);
1987
1707
  }
1988
1708
  }
1989
-
1990
1709
  return grant;
1991
1710
  }).filter(function (grant) {
1992
1711
  return grant.lockboxUuid;
@@ -2000,7 +1719,6 @@ function decryptGrants(encryptedGrants, rsaKey) {
2000
1719
  * @param rsaKey: the rsa key used to decrypt the encrypted entries
2001
1720
  * @returns an array of grants
2002
1721
  */
2003
-
2004
1722
  function decryptConsultLockboxGrants(encryptedConsultLockboxes, rsaKey) {
2005
1723
  return encryptedConsultLockboxes.map(function (encryptedConsultLockboxes) {
2006
1724
  try {
@@ -2028,10 +1746,8 @@ var MAX_RETRIES$1 = 15;
2028
1746
  * @param pharmacy
2029
1747
  * @returns a workflow
2030
1748
  */
2031
-
2032
1749
  function getRefillAnswersAsWorkflow(isTreatmentWorking, hasSideEffects, deliveryAddress, pharmacy) {
2033
1750
  var _ref, _ref2, _selectedAnswers$push, _selectedAnswers$push2;
2034
-
2035
1751
  var selectedAnswers = [(_ref = {}, _ref['isTreatmentWorking'] = isTreatmentWorking, _ref), (_ref2 = {}, _ref2['hasSideEffects'] = hasSideEffects, _ref2)];
2036
1752
  if (deliveryAddress) selectedAnswers.push((_selectedAnswers$push = {}, _selectedAnswers$push['deliveryAddress'] = deliveryAddress, _selectedAnswers$push));
2037
1753
  if (pharmacy) selectedAnswers.push((_selectedAnswers$push2 = {}, _selectedAnswers$push2['pharmacy'] = JSON.stringify(pharmacy), _selectedAnswers$push2));
@@ -2113,11 +1829,9 @@ function getRefillAnswersAsWorkflow(isTreatmentWorking, hasSideEffects, delivery
2113
1829
  * @param populatedRefillWorkflow the refill workflow data
2114
1830
  * @param oroClient
2115
1831
  */
2116
-
2117
1832
  function createRefill(_x, _x2, _x3) {
2118
1833
  return _createRefill.apply(this, arguments);
2119
1834
  }
2120
-
2121
1835
  function _createRefill() {
2122
1836
  _createRefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(consultRequest, populatedRefillWorkflow, oroClient) {
2123
1837
  var retry, errorsThrown, newConsult, lockboxUuid;
@@ -2127,38 +1841,29 @@ function _createRefill() {
2127
1841
  case 0:
2128
1842
  retry = MAX_RETRIES$1;
2129
1843
  errorsThrown = [];
2130
-
2131
1844
  case 2:
2132
1845
  if (!(retry > 0)) {
2133
1846
  _context.next = 28;
2134
1847
  break;
2135
1848
  }
2136
-
2137
1849
  _context.prev = 3;
2138
-
2139
1850
  if (newConsult) {
2140
1851
  _context.next = 8;
2141
1852
  break;
2142
1853
  }
2143
-
2144
1854
  _context.next = 7;
2145
1855
  return getOrCreatePatientConsultationUuid(consultRequest, oroClient);
2146
-
2147
1856
  case 7:
2148
1857
  newConsult = _context.sent;
2149
-
2150
1858
  case 8:
2151
1859
  if (lockboxUuid) {
2152
1860
  _context.next = 12;
2153
1861
  break;
2154
1862
  }
2155
-
2156
1863
  _context.next = 11;
2157
1864
  return oroClient.getGrants();
2158
-
2159
1865
  case 11:
2160
1866
  lockboxUuid = _context.sent[0].lockboxUuid;
2161
-
2162
1867
  case 12:
2163
1868
  _context.next = 14;
2164
1869
  return oroClient.getOrInsertJsonData(lockboxUuid, populatedRefillWorkflow, {
@@ -2171,37 +1876,30 @@ function _createRefill() {
2171
1876
  console.error('[SDK: prescription refill] Some errors happened during refill data upload', err);
2172
1877
  errorsThrown.push(err);
2173
1878
  });
2174
-
2175
1879
  case 14:
2176
1880
  if (!(errorsThrown.length > 0)) {
2177
1881
  _context.next = 16;
2178
1882
  break;
2179
1883
  }
2180
-
2181
1884
  throw errorsThrown;
2182
-
2183
1885
  case 16:
2184
1886
  _context.next = 18;
2185
1887
  return oroClient.consultClient.updateConsultByUUID(newConsult.uuid, {
2186
1888
  statusMedical: initApis.MedicalStatus.New
2187
1889
  });
2188
-
2189
1890
  case 18:
2190
1891
  _context.next = 25;
2191
1892
  break;
2192
-
2193
1893
  case 20:
2194
1894
  _context.prev = 20;
2195
1895
  _context.t0 = _context["catch"](3);
2196
1896
  console.error("[SDK] Error occured during refill: " + _context.t0 + ", retrying... Retries remaining: " + retry);
2197
1897
  errorsThrown = [];
2198
1898
  return _context.abrupt("continue", 25);
2199
-
2200
1899
  case 25:
2201
1900
  retry--;
2202
1901
  _context.next = 2;
2203
1902
  break;
2204
-
2205
1903
  case 28:
2206
1904
  case "end":
2207
1905
  return _context.stop();
@@ -2219,52 +1917,42 @@ function _createRefill() {
2219
1917
  * @param filter: the consult uuid
2220
1918
  * @returns the grants containing the consult uuid
2221
1919
  */
2222
-
2223
1920
  function filterGrantsWithLockboxMetadata(_x, _x2) {
2224
1921
  return _filterGrantsWithLockboxMetadata.apply(this, arguments);
2225
1922
  }
2226
-
2227
1923
  function _filterGrantsWithLockboxMetadata() {
2228
1924
  _filterGrantsWithLockboxMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(oroClient, filter) {
2229
1925
  var grants, filteredGrants, _iterator, _step, grant, consultationIdExistsInMetadata;
2230
-
2231
1926
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2232
1927
  while (1) {
2233
1928
  switch (_context.prev = _context.next) {
2234
1929
  case 0:
2235
1930
  _context.next = 2;
2236
1931
  return oroClient.getGrants();
2237
-
2238
1932
  case 2:
2239
1933
  grants = _context.sent;
2240
1934
  filteredGrants = [];
2241
1935
  _iterator = _createForOfIteratorHelperLoose(grants);
2242
-
2243
1936
  case 5:
2244
1937
  if ((_step = _iterator()).done) {
2245
1938
  _context.next = 13;
2246
1939
  break;
2247
1940
  }
2248
-
2249
1941
  grant = _step.value;
2250
1942
  _context.next = 9;
2251
1943
  return oroClient.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], [], {
2252
1944
  category: initApis.MetadataCategory.Consultation,
2253
1945
  consultationId: filter.consultationId
2254
1946
  });
2255
-
2256
1947
  case 9:
2257
1948
  consultationIdExistsInMetadata = _context.sent;
2258
1949
  // If there are entries in the metadata, it means that the consult exists in the lockbox
2259
1950
  if (consultationIdExistsInMetadata[0].length >= 0) filteredGrants.push(grant);
2260
-
2261
1951
  case 11:
2262
1952
  _context.next = 5;
2263
1953
  break;
2264
-
2265
1954
  case 13:
2266
1955
  return _context.abrupt("return", filteredGrants);
2267
-
2268
1956
  case 14:
2269
1957
  case "end":
2270
1958
  return _context.stop();
@@ -2294,10 +1982,7 @@ var OroClient = /*#__PURE__*/function () {
2294
1982
  /**
2295
1983
  * clears the vaultIndex and cached metadata grants
2296
1984
  */
2297
-
2298
-
2299
1985
  var _proto = OroClient.prototype;
2300
-
2301
1986
  _proto.cleanIndex =
2302
1987
  /*#__PURE__*/
2303
1988
  function () {
@@ -2308,7 +1993,6 @@ var OroClient = /*#__PURE__*/function () {
2308
1993
  case 0:
2309
1994
  this.cachedMetadataGrants = {};
2310
1995
  this.cachedManifest = {};
2311
-
2312
1996
  case 2:
2313
1997
  case "end":
2314
1998
  return _context.stop();
@@ -2316,11 +2000,9 @@ var OroClient = /*#__PURE__*/function () {
2316
2000
  }
2317
2001
  }, _callee, this);
2318
2002
  }));
2319
-
2320
2003
  function cleanIndex() {
2321
2004
  return _cleanIndex.apply(this, arguments);
2322
2005
  }
2323
-
2324
2006
  return cleanIndex;
2325
2007
  }()
2326
2008
  /**
@@ -2335,7 +2017,6 @@ var OroClient = /*#__PURE__*/function () {
2335
2017
  * @returns
2336
2018
  */
2337
2019
  ;
2338
-
2339
2020
  _proto.signUp =
2340
2021
  /*#__PURE__*/
2341
2022
  function () {
@@ -2364,18 +2045,14 @@ var OroClient = /*#__PURE__*/function () {
2364
2045
  };
2365
2046
  _context2.next = 9;
2366
2047
  return this.guardClient.identityCreate(signupRequest);
2367
-
2368
2048
  case 9:
2369
2049
  identity = _context2.sent;
2370
-
2371
2050
  if (identity.recoveryLogin) {
2372
2051
  //Ensure we can recover from a page reload
2373
2052
  symetricEncryptor = this.toolbox.CryptoChaCha.fromPassphrase(identity.recoveryLogin);
2374
2053
  sessionStorage.setItem(sessionStorePrivateKeyName(identity.id), symetricEncryptor.bytesEncryptToBase64Payload(privateKey));
2375
2054
  }
2376
-
2377
2055
  return _context2.abrupt("return", identity);
2378
-
2379
2056
  case 12:
2380
2057
  case "end":
2381
2058
  return _context2.stop();
@@ -2383,11 +2060,9 @@ var OroClient = /*#__PURE__*/function () {
2383
2060
  }
2384
2061
  }, _callee2, this);
2385
2062
  }));
2386
-
2387
2063
  function signUp(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
2388
2064
  return _signUp.apply(this, arguments);
2389
2065
  }
2390
-
2391
2066
  return signUp;
2392
2067
  }()
2393
2068
  /**
@@ -2396,7 +2071,6 @@ var OroClient = /*#__PURE__*/function () {
2396
2071
  * @returns The identity related to confirmedEmail
2397
2072
  */
2398
2073
  ;
2399
-
2400
2074
  _proto.confirmEmail =
2401
2075
  /*#__PURE__*/
2402
2076
  function () {
@@ -2411,13 +2085,11 @@ var OroClient = /*#__PURE__*/function () {
2411
2085
  });
2412
2086
  _context3.next = 3;
2413
2087
  return this.guardClient.whoAmI();
2414
-
2415
2088
  case 3:
2416
2089
  claims = _context3.sent;
2417
2090
  return _context3.abrupt("return", this.guardClient.identityUpdate(claims.sub, {
2418
2091
  emailConfirmed: true
2419
2092
  }));
2420
-
2421
2093
  case 5:
2422
2094
  case "end":
2423
2095
  return _context3.stop();
@@ -2425,11 +2097,9 @@ var OroClient = /*#__PURE__*/function () {
2425
2097
  }
2426
2098
  }, _callee3, this);
2427
2099
  }));
2428
-
2429
2100
  function confirmEmail(_x8) {
2430
2101
  return _confirmEmail.apply(this, arguments);
2431
2102
  }
2432
-
2433
2103
  return confirmEmail;
2434
2104
  }()
2435
2105
  /**
@@ -2443,7 +2113,6 @@ var OroClient = /*#__PURE__*/function () {
2443
2113
  * @returns the user identity
2444
2114
  */
2445
2115
  ;
2446
-
2447
2116
  _proto.signIn =
2448
2117
  /*#__PURE__*/
2449
2118
  function () {
@@ -2462,23 +2131,18 @@ var OroClient = /*#__PURE__*/function () {
2462
2131
  };
2463
2132
  _context4.next = 4;
2464
2133
  return this.guardClient.authToken(tokenRequest);
2465
-
2466
2134
  case 4:
2467
2135
  _context4.next = 6;
2468
2136
  return this.guardClient.whoAmI();
2469
-
2470
2137
  case 6:
2471
2138
  userUuid = _context4.sent.sub;
2472
2139
  _context4.next = 9;
2473
2140
  return this.recoverPrivateKeyFromPassword(userUuid, password);
2474
-
2475
2141
  case 9:
2476
2142
  _context4.next = 11;
2477
2143
  return this.guardClient.identityGet(userUuid);
2478
-
2479
2144
  case 11:
2480
2145
  return _context4.abrupt("return", _context4.sent);
2481
-
2482
2146
  case 12:
2483
2147
  case "end":
2484
2148
  return _context4.stop();
@@ -2486,11 +2150,9 @@ var OroClient = /*#__PURE__*/function () {
2486
2150
  }
2487
2151
  }, _callee4, this);
2488
2152
  }));
2489
-
2490
2153
  function signIn(_x9, _x10, _x11, _x12) {
2491
2154
  return _signIn.apply(this, arguments);
2492
2155
  }
2493
-
2494
2156
  return signIn;
2495
2157
  }()
2496
2158
  /**
@@ -2498,7 +2160,6 @@ var OroClient = /*#__PURE__*/function () {
2498
2160
  * the private key in scope
2499
2161
  */
2500
2162
  ;
2501
-
2502
2163
  _proto.resumeSession =
2503
2164
  /*#__PURE__*/
2504
2165
  function () {
@@ -2510,28 +2171,22 @@ var OroClient = /*#__PURE__*/function () {
2510
2171
  case 0:
2511
2172
  _context5.next = 2;
2512
2173
  return this.guardClient.whoAmI();
2513
-
2514
2174
  case 2:
2515
2175
  id = _context5.sent.sub;
2516
2176
  recoveryPayload = sessionStorage.getItem(sessionStorePrivateKeyName(id));
2517
2177
  _context5.next = 6;
2518
2178
  return this.guardClient.identityGet(id);
2519
-
2520
2179
  case 6:
2521
2180
  recoveryKey = _context5.sent.recoveryLogin;
2522
-
2523
2181
  if (!(!recoveryKey || !recoveryPayload)) {
2524
2182
  _context5.next = 9;
2525
2183
  break;
2526
2184
  }
2527
-
2528
2185
  throw IncompleteAuthentication;
2529
-
2530
2186
  case 9:
2531
2187
  symmetricDecryptor = this.toolbox.CryptoChaCha.fromPassphrase(recoveryKey);
2532
2188
  privateKey = symmetricDecryptor.base64PayloadDecryptToBytes(recoveryPayload);
2533
2189
  this.rsa = this.toolbox.CryptoRSA.fromKey(privateKey);
2534
-
2535
2190
  case 12:
2536
2191
  case "end":
2537
2192
  return _context5.stop();
@@ -2539,11 +2194,9 @@ var OroClient = /*#__PURE__*/function () {
2539
2194
  }
2540
2195
  }, _callee5, this);
2541
2196
  }));
2542
-
2543
2197
  function resumeSession() {
2544
2198
  return _resumeSession.apply(this, arguments);
2545
2199
  }
2546
-
2547
2200
  return resumeSession;
2548
2201
  }()
2549
2202
  /**
@@ -2554,16 +2207,13 @@ var OroClient = /*#__PURE__*/function () {
2554
2207
  * @calls authenticationCallback if rsa is not set
2555
2208
  */
2556
2209
  ;
2557
-
2558
2210
  _proto.localEncryptToJsonPayload = function localEncryptToJsonPayload(value) {
2559
2211
  if (!this.rsa) {
2560
2212
  if (this.authenticationCallback) {
2561
2213
  this.authenticationCallback(new IncompleteAuthentication());
2562
2214
  }
2563
-
2564
2215
  throw new IncompleteAuthentication();
2565
2216
  }
2566
-
2567
2217
  var chaChaKey = new this.toolbox.CryptoChaCha();
2568
2218
  var encryptedData = chaChaKey.jsonEncryptToBase64Payload(value);
2569
2219
  var encryptedKey = this.toolbox.encodeToBase64(this.rsa.encryptToBytes(chaChaKey.key()));
@@ -2578,30 +2228,23 @@ var OroClient = /*#__PURE__*/function () {
2578
2228
  * @returns a decrypted Object
2579
2229
  * @throws IncompleteAuthentication if rsa is not set
2580
2230
  * @calls authenticationCallback if rsa is not set
2581
- */
2582
- ;
2583
-
2231
+ */;
2584
2232
  _proto.localDecryptJsonPayload = function localDecryptJsonPayload(_ref) {
2585
2233
  var encryptedKey = _ref.encryptedKey,
2586
- encryptedData = _ref.encryptedData;
2587
-
2234
+ encryptedData = _ref.encryptedData;
2588
2235
  if (!this.rsa) {
2589
2236
  if (this.authenticationCallback) {
2590
2237
  this.authenticationCallback(new IncompleteAuthentication());
2591
2238
  }
2592
-
2593
2239
  throw new IncompleteAuthentication();
2594
2240
  }
2595
-
2596
2241
  var chaChaKey = this.rsa.base64DecryptToBytes(encryptedKey);
2597
2242
  var decryptedData = this.toolbox.CryptoChaCha.fromKey(chaChaKey).base64PayloadDecryptToJson(encryptedData);
2598
2243
  return decryptedData;
2599
2244
  }
2600
2245
  /**
2601
2246
  * Effectively kills your "session"
2602
- */
2603
- ;
2604
-
2247
+ */;
2605
2248
  _proto.signOut =
2606
2249
  /*#__PURE__*/
2607
2250
  function () {
@@ -2618,7 +2261,6 @@ var OroClient = /*#__PURE__*/function () {
2618
2261
  });
2619
2262
  _context6.next = 5;
2620
2263
  return this.guardClient.authLogout();
2621
-
2622
2264
  case 5:
2623
2265
  case "end":
2624
2266
  return _context6.stop();
@@ -2626,11 +2268,9 @@ var OroClient = /*#__PURE__*/function () {
2626
2268
  }
2627
2269
  }, _callee6, this);
2628
2270
  }));
2629
-
2630
2271
  function signOut() {
2631
2272
  return _signOut.apply(this, arguments);
2632
2273
  }
2633
-
2634
2274
  return signOut;
2635
2275
  }()
2636
2276
  /**
@@ -2653,7 +2293,6 @@ var OroClient = /*#__PURE__*/function () {
2653
2293
  * @returns
2654
2294
  */
2655
2295
  ;
2656
-
2657
2296
  _proto.registerPatient =
2658
2297
  /*#__PURE__*/
2659
2298
  function () {
@@ -2665,17 +2304,13 @@ var OroClient = /*#__PURE__*/function () {
2665
2304
  if (indexSearch === void 0) {
2666
2305
  indexSearch = true;
2667
2306
  }
2668
-
2669
2307
  if (this.rsa) {
2670
2308
  _context7.next = 3;
2671
2309
  break;
2672
2310
  }
2673
-
2674
2311
  throw IncompleteAuthentication;
2675
-
2676
2312
  case 3:
2677
2313
  return _context7.abrupt("return", registerPatient(patientUuid, consult, workflow, this, this.toolbox.uuid(), recoveryQA, indexSearch, onProgress));
2678
-
2679
2314
  case 4:
2680
2315
  case "end":
2681
2316
  return _context7.stop();
@@ -2683,11 +2318,9 @@ var OroClient = /*#__PURE__*/function () {
2683
2318
  }
2684
2319
  }, _callee7, this);
2685
2320
  }));
2686
-
2687
2321
  function registerPatient$1(_x13, _x14, _x15, _x16, _x17, _x18) {
2688
2322
  return _registerPatient2.apply(this, arguments);
2689
2323
  }
2690
-
2691
2324
  return registerPatient$1;
2692
2325
  }()
2693
2326
  /**
@@ -2701,7 +2334,6 @@ var OroClient = /*#__PURE__*/function () {
2701
2334
  * @returns
2702
2335
  */
2703
2336
  ;
2704
-
2705
2337
  _proto.createRefill =
2706
2338
  /*#__PURE__*/
2707
2339
  function () {
@@ -2714,12 +2346,9 @@ var OroClient = /*#__PURE__*/function () {
2714
2346
  _context8.next = 2;
2715
2347
  break;
2716
2348
  }
2717
-
2718
2349
  throw IncompleteAuthentication;
2719
-
2720
2350
  case 2:
2721
2351
  return _context8.abrupt("return", createRefill(consult, populatedRefillWorkflow, this));
2722
-
2723
2352
  case 3:
2724
2353
  case "end":
2725
2354
  return _context8.stop();
@@ -2727,11 +2356,9 @@ var OroClient = /*#__PURE__*/function () {
2727
2356
  }
2728
2357
  }, _callee8, this);
2729
2358
  }));
2730
-
2731
2359
  function createRefill$1(_x19, _x20) {
2732
2360
  return _createRefill2.apply(this, arguments);
2733
2361
  }
2734
-
2735
2362
  return createRefill$1;
2736
2363
  }()
2737
2364
  /**
@@ -2739,14 +2366,12 @@ var OroClient = /*#__PURE__*/function () {
2739
2366
  * Then updates the index for the current user with the lockbox consult relationship
2740
2367
  */
2741
2368
  ;
2742
-
2743
2369
  _proto.forceUpdateIndexEntries =
2744
2370
  /*#__PURE__*/
2745
2371
  function () {
2746
2372
  var _forceUpdateIndexEntries = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
2747
2373
  var _this = this,
2748
- _this$vaultIndexAdd;
2749
-
2374
+ _this$vaultIndexAdd;
2750
2375
  var grants, indexConsultLockbox;
2751
2376
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
2752
2377
  while (1) {
@@ -2754,7 +2379,6 @@ var OroClient = /*#__PURE__*/function () {
2754
2379
  case 0:
2755
2380
  _context10.next = 2;
2756
2381
  return this.getGrants();
2757
-
2758
2382
  case 2:
2759
2383
  grants = _context10.sent;
2760
2384
  _context10.next = 5;
@@ -2784,10 +2408,8 @@ var OroClient = /*#__PURE__*/function () {
2784
2408
  })["catch"](function () {
2785
2409
  return [];
2786
2410
  });
2787
-
2788
2411
  case 2:
2789
2412
  return _context9.abrupt("return", _context9.sent);
2790
-
2791
2413
  case 3:
2792
2414
  case "end":
2793
2415
  return _context9.stop();
@@ -2795,14 +2417,12 @@ var OroClient = /*#__PURE__*/function () {
2795
2417
  }
2796
2418
  }, _callee9);
2797
2419
  }));
2798
-
2799
2420
  return function (_x21) {
2800
2421
  return _ref2.apply(this, arguments);
2801
2422
  };
2802
2423
  }())).then(function (consults) {
2803
2424
  return consults.flat();
2804
2425
  });
2805
-
2806
2426
  case 5:
2807
2427
  indexConsultLockbox = _context10.sent;
2808
2428
  this.vaultIndexAdd((_this$vaultIndexAdd = {}, _this$vaultIndexAdd[initApis.IndexKey.Consultation] = indexConsultLockbox, _this$vaultIndexAdd)).then(function () {
@@ -2810,7 +2430,6 @@ var OroClient = /*#__PURE__*/function () {
2810
2430
  })["catch"](function () {
2811
2431
  return console.error('The index failed to update!');
2812
2432
  });
2813
-
2814
2433
  case 7:
2815
2434
  case "end":
2816
2435
  return _context10.stop();
@@ -2818,11 +2437,9 @@ var OroClient = /*#__PURE__*/function () {
2818
2437
  }
2819
2438
  }, _callee10, this);
2820
2439
  }));
2821
-
2822
2440
  function forceUpdateIndexEntries() {
2823
2441
  return _forceUpdateIndexEntries.apply(this, arguments);
2824
2442
  }
2825
-
2826
2443
  return forceUpdateIndexEntries;
2827
2444
  }()
2828
2445
  /**
@@ -2832,13 +2449,11 @@ var OroClient = /*#__PURE__*/function () {
2832
2449
  * @param indexOwnerUuid
2833
2450
  */
2834
2451
  ;
2835
-
2836
2452
  _proto.vaultIndexAdd =
2837
2453
  /*#__PURE__*/
2838
2454
  function () {
2839
2455
  var _vaultIndexAdd = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(entries, indexOwnerUuid) {
2840
2456
  var rsaPub, base64IndexOwnerPubKey, encryptedIndex, _i, _Object$keys, keyString, key;
2841
-
2842
2457
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
2843
2458
  while (1) {
2844
2459
  switch (_context11.prev = _context11.next) {
@@ -2847,43 +2462,34 @@ var OroClient = /*#__PURE__*/function () {
2847
2462
  _context11.next = 2;
2848
2463
  break;
2849
2464
  }
2850
-
2851
2465
  throw IncompleteAuthentication;
2852
-
2853
2466
  case 2:
2854
2467
  if (!indexOwnerUuid) {
2855
2468
  _context11.next = 9;
2856
2469
  break;
2857
2470
  }
2858
-
2859
2471
  _context11.next = 5;
2860
2472
  return this.guardClient.identityGet(indexOwnerUuid);
2861
-
2862
2473
  case 5:
2863
2474
  base64IndexOwnerPubKey = _context11.sent.publicKey;
2864
2475
  rsaPub = this.toolbox.decodeFromBase64(base64IndexOwnerPubKey);
2865
2476
  _context11.next = 10;
2866
2477
  break;
2867
-
2868
2478
  case 9:
2869
2479
  rsaPub = this.rsa["public"]();
2870
-
2871
2480
  case 10:
2872
2481
  encryptedIndex = {};
2873
2482
  _i = 0, _Object$keys = Object.keys(entries);
2874
-
2875
2483
  case 12:
2876
2484
  if (!(_i < _Object$keys.length)) {
2877
2485
  _context11.next = 23;
2878
2486
  break;
2879
2487
  }
2880
-
2881
2488
  keyString = _Object$keys[_i];
2882
2489
  key = keyString;
2883
2490
  _context11.t0 = key;
2884
2491
  _context11.next = _context11.t0 === initApis.IndexKey.ConsultationLockbox ? 18 : 20;
2885
2492
  break;
2886
-
2887
2493
  case 18:
2888
2494
  encryptedIndex[key] = entries[key].map(function (e) {
2889
2495
  return _extends({}, e, {
@@ -2901,16 +2507,13 @@ var OroClient = /*#__PURE__*/function () {
2901
2507
  };
2902
2508
  });
2903
2509
  return _context11.abrupt("break", 20);
2904
-
2905
2510
  case 20:
2906
2511
  _i++;
2907
2512
  _context11.next = 12;
2908
2513
  break;
2909
-
2910
2514
  case 23:
2911
2515
  _context11.next = 25;
2912
2516
  return this.vaultClient.vaultIndexPut(encryptedIndex, indexOwnerUuid);
2913
-
2914
2517
  case 25:
2915
2518
  case "end":
2916
2519
  return _context11.stop();
@@ -2918,11 +2521,9 @@ var OroClient = /*#__PURE__*/function () {
2918
2521
  }
2919
2522
  }, _callee11, this);
2920
2523
  }));
2921
-
2922
2524
  function vaultIndexAdd(_x22, _x23) {
2923
2525
  return _vaultIndexAdd.apply(this, arguments);
2924
2526
  }
2925
-
2926
2527
  return vaultIndexAdd;
2927
2528
  }()
2928
2529
  /**
@@ -2933,7 +2534,6 @@ var OroClient = /*#__PURE__*/function () {
2933
2534
  * @param lockboxOwnerUuid the lockbox owner (ignored if lockbox is owned by self)
2934
2535
  */
2935
2536
  ;
2936
-
2937
2537
  _proto.grantLockbox =
2938
2538
  /*#__PURE__*/
2939
2539
  function () {
@@ -2947,18 +2547,14 @@ var OroClient = /*#__PURE__*/function () {
2947
2547
  _context12.next = 2;
2948
2548
  break;
2949
2549
  }
2950
-
2951
2550
  throw IncompleteAuthentication;
2952
-
2953
2551
  case 2:
2954
2552
  _context12.next = 4;
2955
2553
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
2956
-
2957
2554
  case 4:
2958
2555
  secret = _context12.sent.key();
2959
2556
  _context12.next = 7;
2960
2557
  return this.guardClient.identityGet(granteeUuid);
2961
-
2962
2558
  case 7:
2963
2559
  base64GranteePublicKey = _context12.sent.publicKey;
2964
2560
  granteePublicKey = this.toolbox.decodeFromBase64(base64GranteePublicKey);
@@ -2969,7 +2565,6 @@ var OroClient = /*#__PURE__*/function () {
2969
2565
  };
2970
2566
  _context12.next = 13;
2971
2567
  return this.vaultClient.lockboxGrant(lockboxUuid, request, lockboxOwnerUuid);
2972
-
2973
2568
  case 13:
2974
2569
  case "end":
2975
2570
  return _context12.stop();
@@ -2977,11 +2572,9 @@ var OroClient = /*#__PURE__*/function () {
2977
2572
  }
2978
2573
  }, _callee12, this);
2979
2574
  }));
2980
-
2981
2575
  function grantLockbox(_x24, _x25, _x26) {
2982
2576
  return _grantLockbox.apply(this, arguments);
2983
2577
  }
2984
-
2985
2578
  return grantLockbox;
2986
2579
  }()
2987
2580
  /**
@@ -2995,7 +2588,6 @@ var OroClient = /*#__PURE__*/function () {
2995
2588
  * @returns the data uuid
2996
2589
  */
2997
2590
  ;
2998
-
2999
2591
  _proto.createMessageData =
3000
2592
  /*#__PURE__*/
3001
2593
  function () {
@@ -3009,20 +2601,16 @@ var OroClient = /*#__PURE__*/function () {
3009
2601
  _context13.next = 2;
3010
2602
  break;
3011
2603
  }
3012
-
3013
2604
  throw IncompleteAuthentication;
3014
-
3015
2605
  case 2:
3016
2606
  _context13.next = 4;
3017
2607
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
3018
-
3019
2608
  case 4:
3020
2609
  symmetricEncryptor = _context13.sent;
3021
2610
  encryptedData = symmetricEncryptor.jsonEncryptToBase64Payload(message);
3022
2611
  _context13.t0 = symmetricEncryptor;
3023
2612
  _context13.next = 9;
3024
2613
  return this.guardClient.whoAmI();
3025
-
3026
2614
  case 9:
3027
2615
  _context13.t1 = _context13.sent.sub;
3028
2616
  _context13.t2 = {
@@ -3041,7 +2629,6 @@ var OroClient = /*#__PURE__*/function () {
3041
2629
  privateMetadata: encryptedPrivateMeta
3042
2630
  };
3043
2631
  return _context13.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3044
-
3045
2632
  case 15:
3046
2633
  case "end":
3047
2634
  return _context13.stop();
@@ -3049,11 +2636,9 @@ var OroClient = /*#__PURE__*/function () {
3049
2636
  }
3050
2637
  }, _callee13, this);
3051
2638
  }));
3052
-
3053
2639
  function createMessageData(_x27, _x28, _x29, _x30, _x31) {
3054
2640
  return _createMessageData.apply(this, arguments);
3055
2641
  }
3056
-
3057
2642
  return createMessageData;
3058
2643
  }()
3059
2644
  /**
@@ -3067,7 +2652,6 @@ var OroClient = /*#__PURE__*/function () {
3067
2652
  * @returns the data uuid
3068
2653
  */
3069
2654
  ;
3070
-
3071
2655
  _proto.createMessageAttachmentData =
3072
2656
  /*#__PURE__*/
3073
2657
  function () {
@@ -3081,20 +2665,16 @@ var OroClient = /*#__PURE__*/function () {
3081
2665
  _context14.next = 2;
3082
2666
  break;
3083
2667
  }
3084
-
3085
2668
  throw IncompleteAuthentication;
3086
-
3087
2669
  case 2:
3088
2670
  _context14.next = 4;
3089
2671
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
3090
-
3091
2672
  case 4:
3092
2673
  symmetricEncryptor = _context14.sent;
3093
2674
  _context14.t0 = symmetricEncryptor;
3094
2675
  _context14.t1 = Uint8Array;
3095
2676
  _context14.next = 9;
3096
2677
  return data.arrayBuffer();
3097
-
3098
2678
  case 9:
3099
2679
  _context14.t2 = _context14.sent;
3100
2680
  _context14.t3 = new _context14.t1(_context14.t2);
@@ -3102,7 +2682,6 @@ var OroClient = /*#__PURE__*/function () {
3102
2682
  _context14.t4 = symmetricEncryptor;
3103
2683
  _context14.next = 15;
3104
2684
  return this.guardClient.whoAmI();
3105
-
3106
2685
  case 15:
3107
2686
  _context14.t5 = _context14.sent.sub;
3108
2687
  _context14.t6 = data.name;
@@ -3127,7 +2706,6 @@ var OroClient = /*#__PURE__*/function () {
3127
2706
  privateMetadata: encryptedPrivateMeta
3128
2707
  };
3129
2708
  return _context14.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3130
-
3131
2709
  case 24:
3132
2710
  case "end":
3133
2711
  return _context14.stop();
@@ -3135,11 +2713,9 @@ var OroClient = /*#__PURE__*/function () {
3135
2713
  }
3136
2714
  }, _callee14, this);
3137
2715
  }));
3138
-
3139
2716
  function createMessageAttachmentData(_x32, _x33, _x34, _x35, _x36) {
3140
2717
  return _createMessageAttachmentData.apply(this, arguments);
3141
2718
  }
3142
-
3143
2719
  return createMessageAttachmentData;
3144
2720
  }()
3145
2721
  /**
@@ -3155,7 +2731,6 @@ var OroClient = /*#__PURE__*/function () {
3155
2731
  * @returns the data uuid
3156
2732
  */
3157
2733
  ;
3158
-
3159
2734
  _proto.createConsultationAttachmentData =
3160
2735
  /*#__PURE__*/
3161
2736
  function () {
@@ -3169,21 +2744,17 @@ var OroClient = /*#__PURE__*/function () {
3169
2744
  withNotification: false
3170
2745
  };
3171
2746
  }
3172
-
3173
2747
  if (this.rsa) {
3174
2748
  _context15.next = 3;
3175
2749
  break;
3176
2750
  }
3177
-
3178
2751
  throw IncompleteAuthentication;
3179
-
3180
2752
  case 3:
3181
2753
  _context15.t0 = this;
3182
2754
  _context15.t1 = lockboxUuid;
3183
2755
  _context15.t2 = Uint8Array;
3184
2756
  _context15.next = 8;
3185
2757
  return data.arrayBuffer();
3186
-
3187
2758
  case 8:
3188
2759
  _context15.t3 = _context15.sent;
3189
2760
  _context15.t4 = new _context15.t2(_context15.t3);
@@ -3195,7 +2766,6 @@ var OroClient = /*#__PURE__*/function () {
3195
2766
  };
3196
2767
  _context15.next = 13;
3197
2768
  return this.guardClient.whoAmI();
3198
-
3199
2769
  case 13:
3200
2770
  _context15.t6 = _context15.sent.sub;
3201
2771
  _context15.t7 = data.name;
@@ -3207,7 +2777,6 @@ var OroClient = /*#__PURE__*/function () {
3207
2777
  _context15.t10 = previousDataUuid;
3208
2778
  _context15.t11 = options;
3209
2779
  return _context15.abrupt("return", _context15.t0.createBytesData.call(_context15.t0, _context15.t1, _context15.t4, _context15.t5, _context15.t8, _context15.t9, _context15.t10, _context15.t11));
3210
-
3211
2780
  case 20:
3212
2781
  case "end":
3213
2782
  return _context15.stop();
@@ -3215,11 +2784,9 @@ var OroClient = /*#__PURE__*/function () {
3215
2784
  }
3216
2785
  }, _callee15, this);
3217
2786
  }));
3218
-
3219
2787
  function createConsultationAttachmentData(_x37, _x38, _x39, _x40, _x41, _x42, _x43) {
3220
2788
  return _createConsultationAttachmentData.apply(this, arguments);
3221
2789
  }
3222
-
3223
2790
  return createConsultationAttachmentData;
3224
2791
  }()
3225
2792
  /**
@@ -3235,7 +2802,6 @@ var OroClient = /*#__PURE__*/function () {
3235
2802
  * @returns the data uuid
3236
2803
  */
3237
2804
  ;
3238
-
3239
2805
  _proto.createJsonData =
3240
2806
  /*#__PURE__*/
3241
2807
  function () {
@@ -3250,18 +2816,14 @@ var OroClient = /*#__PURE__*/function () {
3250
2816
  withNotification: false
3251
2817
  };
3252
2818
  }
3253
-
3254
2819
  if (this.rsa) {
3255
2820
  _context16.next = 3;
3256
2821
  break;
3257
2822
  }
3258
-
3259
2823
  throw IncompleteAuthentication;
3260
-
3261
2824
  case 3:
3262
2825
  _context16.next = 5;
3263
2826
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
3264
-
3265
2827
  case 5:
3266
2828
  symmetricEncryptor = _context16.sent;
3267
2829
  encryptedData = symmetricEncryptor.jsonEncryptToBase64Payload(data);
@@ -3271,17 +2833,13 @@ var OroClient = /*#__PURE__*/function () {
3271
2833
  publicMetadata: meta,
3272
2834
  privateMetadata: encryptedPrivateMeta
3273
2835
  };
3274
-
3275
2836
  if (!options.withNotification) {
3276
2837
  _context16.next = 13;
3277
2838
  break;
3278
2839
  }
3279
-
3280
2840
  return _context16.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3281
-
3282
2841
  case 13:
3283
2842
  return _context16.abrupt("return", this.vaultClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3284
-
3285
2843
  case 14:
3286
2844
  case "end":
3287
2845
  return _context16.stop();
@@ -3289,11 +2847,9 @@ var OroClient = /*#__PURE__*/function () {
3289
2847
  }
3290
2848
  }, _callee16, this);
3291
2849
  }));
3292
-
3293
2850
  function createJsonData(_x44, _x45, _x46, _x47, _x48, _x49, _x50) {
3294
2851
  return _createJsonData.apply(this, arguments);
3295
2852
  }
3296
-
3297
2853
  return createJsonData;
3298
2854
  }()
3299
2855
  /**
@@ -3307,7 +2863,6 @@ var OroClient = /*#__PURE__*/function () {
3307
2863
  * @returns the data uuid
3308
2864
  */
3309
2865
  ;
3310
-
3311
2866
  _proto.getOrInsertJsonData =
3312
2867
  /*#__PURE__*/
3313
2868
  function () {
@@ -3323,34 +2878,28 @@ var OroClient = /*#__PURE__*/function () {
3323
2878
  forceReplace: false
3324
2879
  };
3325
2880
  }
3326
-
3327
2881
  _context17.next = 3;
3328
2882
  return this.vaultClient.lockboxManifestGet(lockboxUuid, publicMetadata);
3329
-
3330
2883
  case 3:
3331
2884
  manifest = _context17.sent;
3332
-
3333
2885
  if (!(!options.forceReplace && manifest.length > 0)) {
3334
2886
  _context17.next = 9;
3335
2887
  break;
3336
2888
  }
3337
-
3338
2889
  console.log("The data for " + JSON.stringify(publicMetadata) + " already exist");
3339
2890
  return _context17.abrupt("return", manifest[0].dataUuid);
3340
-
3341
2891
  case 9:
3342
2892
  _context17.next = 11;
3343
- return this.createJsonData(lockboxUuid, data, publicMetadata, privateMetadata, undefined, // if forceReplace and data already exist, then replace data. Otherwise insert it
2893
+ return this.createJsonData(lockboxUuid, data, publicMetadata, privateMetadata, undefined,
2894
+ // if forceReplace and data already exist, then replace data. Otherwise insert it
3344
2895
  options.forceReplace && manifest.length > 0 ? manifest[0].dataUuid : undefined, {
3345
2896
  withNotification: options.withNotification
3346
2897
  })["catch"](function (err) {
3347
2898
  console.error("Error while upserting data " + JSON.stringify(publicMetadata) + " data", err);
3348
2899
  throw err;
3349
2900
  });
3350
-
3351
2901
  case 11:
3352
2902
  return _context17.abrupt("return", _context17.sent.dataUuid);
3353
-
3354
2903
  case 12:
3355
2904
  case "end":
3356
2905
  return _context17.stop();
@@ -3358,11 +2907,9 @@ var OroClient = /*#__PURE__*/function () {
3358
2907
  }
3359
2908
  }, _callee17, this);
3360
2909
  }));
3361
-
3362
2910
  function getOrInsertJsonData(_x51, _x52, _x53, _x54, _x55) {
3363
2911
  return _getOrInsertJsonData.apply(this, arguments);
3364
2912
  }
3365
-
3366
2913
  return getOrInsertJsonData;
3367
2914
  }()
3368
2915
  /**
@@ -3378,7 +2925,6 @@ var OroClient = /*#__PURE__*/function () {
3378
2925
  * @returns the data uuid
3379
2926
  */
3380
2927
  ;
3381
-
3382
2928
  _proto.createBytesData =
3383
2929
  /*#__PURE__*/
3384
2930
  function () {
@@ -3393,18 +2939,14 @@ var OroClient = /*#__PURE__*/function () {
3393
2939
  withNotification: false
3394
2940
  };
3395
2941
  }
3396
-
3397
2942
  if (this.rsa) {
3398
2943
  _context18.next = 3;
3399
2944
  break;
3400
2945
  }
3401
-
3402
2946
  throw IncompleteAuthentication;
3403
-
3404
2947
  case 3:
3405
2948
  _context18.next = 5;
3406
2949
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
3407
-
3408
2950
  case 5:
3409
2951
  symmetricEncryptor = _context18.sent;
3410
2952
  encryptedData = symmetricEncryptor.bytesEncryptToBase64Payload(data);
@@ -3414,17 +2956,13 @@ var OroClient = /*#__PURE__*/function () {
3414
2956
  publicMetadata: meta,
3415
2957
  privateMetadata: encryptedPrivateMeta
3416
2958
  };
3417
-
3418
2959
  if (!options.withNotification) {
3419
2960
  _context18.next = 13;
3420
2961
  break;
3421
2962
  }
3422
-
3423
2963
  return _context18.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3424
-
3425
2964
  case 13:
3426
2965
  return _context18.abrupt("return", this.vaultClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3427
-
3428
2966
  case 14:
3429
2967
  case "end":
3430
2968
  return _context18.stop();
@@ -3432,11 +2970,9 @@ var OroClient = /*#__PURE__*/function () {
3432
2970
  }
3433
2971
  }, _callee18, this);
3434
2972
  }));
3435
-
3436
2973
  function createBytesData(_x56, _x57, _x58, _x59, _x60, _x61, _x62) {
3437
2974
  return _createBytesData.apply(this, arguments);
3438
2975
  }
3439
-
3440
2976
  return createBytesData;
3441
2977
  }()
3442
2978
  /**
@@ -3451,13 +2987,11 @@ var OroClient = /*#__PURE__*/function () {
3451
2987
  * @returns the data specified by the generic type <T>
3452
2988
  */
3453
2989
  ;
3454
-
3455
2990
  _proto.getJsonData =
3456
2991
  /*#__PURE__*/
3457
2992
  function () {
3458
2993
  var _getJsonData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(lockboxUuid, dataUuid, lockboxOwnerUuid) {
3459
2994
  var _yield$Promise$all, encryptedPayload, symmetricDecryptor;
3460
-
3461
2995
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3462
2996
  while (1) {
3463
2997
  switch (_context19.prev = _context19.next) {
@@ -3466,19 +3000,15 @@ var OroClient = /*#__PURE__*/function () {
3466
3000
  _context19.next = 2;
3467
3001
  break;
3468
3002
  }
3469
-
3470
3003
  throw IncompleteAuthentication;
3471
-
3472
3004
  case 2:
3473
3005
  _context19.next = 4;
3474
3006
  return Promise.all([this.vaultClient.lockboxDataGet(lockboxUuid, dataUuid, lockboxOwnerUuid), this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid)]);
3475
-
3476
3007
  case 4:
3477
3008
  _yield$Promise$all = _context19.sent;
3478
3009
  encryptedPayload = _yield$Promise$all[0];
3479
3010
  symmetricDecryptor = _yield$Promise$all[1];
3480
3011
  return _context19.abrupt("return", symmetricDecryptor.base64PayloadDecryptToJson(encryptedPayload.data));
3481
-
3482
3012
  case 8:
3483
3013
  case "end":
3484
3014
  return _context19.stop();
@@ -3486,11 +3016,9 @@ var OroClient = /*#__PURE__*/function () {
3486
3016
  }
3487
3017
  }, _callee19, this);
3488
3018
  }));
3489
-
3490
3019
  function getJsonData(_x63, _x64, _x65) {
3491
3020
  return _getJsonData.apply(this, arguments);
3492
3021
  }
3493
-
3494
3022
  return getJsonData;
3495
3023
  }()
3496
3024
  /**
@@ -3501,13 +3029,11 @@ var OroClient = /*#__PURE__*/function () {
3501
3029
  * @returns the bytes data
3502
3030
  */
3503
3031
  ;
3504
-
3505
3032
  _proto.getBytesData =
3506
3033
  /*#__PURE__*/
3507
3034
  function () {
3508
3035
  var _getBytesData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(lockboxUuid, dataUuid, lockboxOwnerUuid) {
3509
3036
  var _yield$Promise$all2, encryptedPayload, symmetricDecryptor;
3510
-
3511
3037
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3512
3038
  while (1) {
3513
3039
  switch (_context20.prev = _context20.next) {
@@ -3516,19 +3042,15 @@ var OroClient = /*#__PURE__*/function () {
3516
3042
  _context20.next = 2;
3517
3043
  break;
3518
3044
  }
3519
-
3520
3045
  throw IncompleteAuthentication;
3521
-
3522
3046
  case 2:
3523
3047
  _context20.next = 4;
3524
3048
  return Promise.all([this.vaultClient.lockboxDataGet(lockboxUuid, dataUuid, lockboxOwnerUuid), this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid)]);
3525
-
3526
3049
  case 4:
3527
3050
  _yield$Promise$all2 = _context20.sent;
3528
3051
  encryptedPayload = _yield$Promise$all2[0];
3529
3052
  symmetricDecryptor = _yield$Promise$all2[1];
3530
3053
  return _context20.abrupt("return", symmetricDecryptor.base64PayloadDecryptToBytes(encryptedPayload.data));
3531
-
3532
3054
  case 8:
3533
3055
  case "end":
3534
3056
  return _context20.stop();
@@ -3536,11 +3058,9 @@ var OroClient = /*#__PURE__*/function () {
3536
3058
  }
3537
3059
  }, _callee20, this);
3538
3060
  }));
3539
-
3540
3061
  function getBytesData(_x66, _x67, _x68) {
3541
3062
  return _getBytesData.apply(this, arguments);
3542
3063
  }
3543
-
3544
3064
  return getBytesData;
3545
3065
  }()
3546
3066
  /**
@@ -3554,7 +3074,6 @@ var OroClient = /*#__PURE__*/function () {
3554
3074
  * @returns decrypted lockboxes granted to user
3555
3075
  */
3556
3076
  ;
3557
-
3558
3077
  _proto.getGrants =
3559
3078
  /*#__PURE__*/
3560
3079
  function () {
@@ -3568,33 +3087,24 @@ var OroClient = /*#__PURE__*/function () {
3568
3087
  _context21.next = 2;
3569
3088
  break;
3570
3089
  }
3571
-
3572
3090
  throw IncompleteAuthentication;
3573
-
3574
3091
  case 2:
3575
3092
  filterString = JSON.stringify(filter); // retrieves cached grants
3576
-
3577
3093
  if (!this.cachedMetadataGrants[filterString]) {
3578
3094
  _context21.next = 5;
3579
3095
  break;
3580
3096
  }
3581
-
3582
3097
  return _context21.abrupt("return", this.cachedMetadataGrants[filterString]);
3583
-
3584
3098
  case 5:
3585
3099
  _context21.next = 7;
3586
3100
  return this.getAccountRole();
3587
-
3588
3101
  case 7:
3589
3102
  currentAccountRole = _context21.sent;
3590
-
3591
3103
  if (!(currentAccountRole.length === 1 && currentAccountRole[0] === initApis.OtherRoleType.User)) {
3592
3104
  _context21.next = 10;
3593
3105
  break;
3594
3106
  }
3595
-
3596
3107
  return _context21.abrupt("return", []);
3597
-
3598
3108
  case 10:
3599
3109
  if (![initApis.OtherRoleType.Patient, initApis.OtherRoleType.User].every(function (requiredRole) {
3600
3110
  return currentAccountRole.includes(requiredRole);
@@ -3602,46 +3112,36 @@ var OroClient = /*#__PURE__*/function () {
3602
3112
  _context21.next = 26;
3603
3113
  break;
3604
3114
  }
3605
-
3606
3115
  if (!filter) {
3607
3116
  _context21.next = 17;
3608
3117
  break;
3609
3118
  }
3610
-
3611
3119
  _context21.next = 14;
3612
3120
  return filterGrantsWithLockboxMetadata(this, filter);
3613
-
3614
3121
  case 14:
3615
3122
  encryptedGrants = _context21.sent;
3616
3123
  _context21.next = 20;
3617
3124
  break;
3618
-
3619
3125
  case 17:
3620
3126
  _context21.next = 19;
3621
3127
  return this.vaultClient.grantsGet();
3622
-
3623
3128
  case 19:
3624
3129
  encryptedGrants = _context21.sent.grants;
3625
-
3626
3130
  case 20:
3627
3131
  _context21.next = 22;
3628
3132
  return decryptGrants(encryptedGrants, this.rsa);
3629
-
3630
3133
  case 22:
3631
3134
  decryptedGrants = _context21.sent;
3632
3135
  // sets the cached grant
3633
3136
  this.cachedMetadataGrants[filterString] = decryptedGrants;
3634
3137
  console.info('[sdk:grant] Found grant for patient');
3635
3138
  return _context21.abrupt("return", decryptedGrants);
3636
-
3637
3139
  case 26:
3638
3140
  if (filter) {
3639
3141
  _context21.next = 28;
3640
3142
  break;
3641
3143
  }
3642
-
3643
3144
  throw MissingGrantFilter;
3644
-
3645
3145
  case 28:
3646
3146
  _context21.next = 30;
3647
3147
  return this.vaultClient.vaultIndexGet([initApis.IndexKey.ConsultationLockbox], [filter.consultationId]).then(function (res) {
@@ -3650,23 +3150,18 @@ var OroClient = /*#__PURE__*/function () {
3650
3150
  console.error(e);
3651
3151
  return [];
3652
3152
  });
3653
-
3654
3153
  case 30:
3655
3154
  grantsByConsultLockbox = _context21.sent;
3656
3155
  decryptedConsults = decryptConsultLockboxGrants(grantsByConsultLockbox != null ? grantsByConsultLockbox : [], this.rsa);
3657
-
3658
3156
  if (!(decryptedConsults.length > 0)) {
3659
3157
  _context21.next = 36;
3660
3158
  break;
3661
3159
  }
3662
-
3663
3160
  console.info('[sdk:index] Grants found in user`s constant time secure index');
3664
3161
  this.cachedMetadataGrants[filterString] = decryptedConsults;
3665
3162
  return _context21.abrupt("return", this.cachedMetadataGrants[filterString]);
3666
-
3667
3163
  case 36:
3668
3164
  return _context21.abrupt("return", []);
3669
-
3670
3165
  case 37:
3671
3166
  case "end":
3672
3167
  return _context21.stop();
@@ -3674,11 +3169,9 @@ var OroClient = /*#__PURE__*/function () {
3674
3169
  }
3675
3170
  }, _callee21, this);
3676
3171
  }));
3677
-
3678
3172
  function getGrants(_x69) {
3679
3173
  return _getGrants.apply(this, arguments);
3680
3174
  }
3681
-
3682
3175
  return getGrants;
3683
3176
  }()
3684
3177
  /**
@@ -3687,7 +3180,6 @@ var OroClient = /*#__PURE__*/function () {
3687
3180
  * @returns the role based scopes defined by the whoami
3688
3181
  */
3689
3182
  ;
3690
-
3691
3183
  _proto.getAccountRole =
3692
3184
  /*#__PURE__*/
3693
3185
  function () {
@@ -3698,10 +3190,8 @@ var OroClient = /*#__PURE__*/function () {
3698
3190
  case 0:
3699
3191
  _context22.next = 2;
3700
3192
  return this.guardClient.whoAmI();
3701
-
3702
3193
  case 2:
3703
3194
  return _context22.abrupt("return", _context22.sent.scope.split(' '));
3704
-
3705
3195
  case 3:
3706
3196
  case "end":
3707
3197
  return _context22.stop();
@@ -3709,11 +3199,9 @@ var OroClient = /*#__PURE__*/function () {
3709
3199
  }
3710
3200
  }, _callee22, this);
3711
3201
  }));
3712
-
3713
3202
  function getAccountRole() {
3714
3203
  return _getAccountRole.apply(this, arguments);
3715
3204
  }
3716
-
3717
3205
  return getAccountRole;
3718
3206
  }()
3719
3207
  /**
@@ -3724,7 +3212,6 @@ var OroClient = /*#__PURE__*/function () {
3724
3212
  * @returns
3725
3213
  */
3726
3214
  ;
3727
-
3728
3215
  _proto.getCachedSecretCryptor =
3729
3216
  /*#__PURE__*/
3730
3217
  function () {
@@ -3738,22 +3225,17 @@ var OroClient = /*#__PURE__*/function () {
3738
3225
  _context23.next = 2;
3739
3226
  break;
3740
3227
  }
3741
-
3742
3228
  throw IncompleteAuthentication;
3743
-
3744
3229
  case 2:
3745
3230
  index = this.secrets.findIndex(function (secret) {
3746
3231
  return secret.lockboxUuid === lockboxUuid;
3747
3232
  });
3748
-
3749
3233
  if (!(index === -1)) {
3750
3234
  _context23.next = 13;
3751
3235
  break;
3752
3236
  }
3753
-
3754
3237
  _context23.next = 6;
3755
3238
  return this.vaultClient.lockboxSecretGet(lockboxUuid, lockboxOwnerUuid);
3756
-
3757
3239
  case 6:
3758
3240
  encryptedSecret = _context23.sent.sharedSecret;
3759
3241
  secret = this.rsa.base64DecryptToBytes(encryptedSecret);
@@ -3763,10 +3245,8 @@ var OroClient = /*#__PURE__*/function () {
3763
3245
  cryptor: cryptor
3764
3246
  });
3765
3247
  return _context23.abrupt("return", cryptor);
3766
-
3767
3248
  case 13:
3768
3249
  return _context23.abrupt("return", this.secrets[index].cryptor);
3769
-
3770
3250
  case 14:
3771
3251
  case "end":
3772
3252
  return _context23.stop();
@@ -3774,11 +3254,9 @@ var OroClient = /*#__PURE__*/function () {
3774
3254
  }
3775
3255
  }, _callee23, this);
3776
3256
  }));
3777
-
3778
3257
  function getCachedSecretCryptor(_x70, _x71) {
3779
3258
  return _getCachedSecretCryptor.apply(this, arguments);
3780
3259
  }
3781
-
3782
3260
  return getCachedSecretCryptor;
3783
3261
  }()
3784
3262
  /**
@@ -3791,7 +3269,6 @@ var OroClient = /*#__PURE__*/function () {
3791
3269
  * @returns the personal data
3792
3270
  */
3793
3271
  ;
3794
-
3795
3272
  _proto.getPersonalInformationsFromConsultId =
3796
3273
  /*#__PURE__*/
3797
3274
  function () {
@@ -3805,9 +3282,7 @@ var OroClient = /*#__PURE__*/function () {
3805
3282
  forceRefresh: false
3806
3283
  };
3807
3284
  }
3808
-
3809
3285
  return _context24.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, category, options));
3810
-
3811
3286
  case 2:
3812
3287
  case "end":
3813
3288
  return _context24.stop();
@@ -3815,11 +3290,9 @@ var OroClient = /*#__PURE__*/function () {
3815
3290
  }
3816
3291
  }, _callee24, this);
3817
3292
  }));
3818
-
3819
3293
  function getPersonalInformationsFromConsultId(_x72, _x73, _x74) {
3820
3294
  return _getPersonalInformationsFromConsultId.apply(this, arguments);
3821
3295
  }
3822
-
3823
3296
  return getPersonalInformationsFromConsultId;
3824
3297
  }()
3825
3298
  /**
@@ -3831,7 +3304,6 @@ var OroClient = /*#__PURE__*/function () {
3831
3304
  * @returns the medical data
3832
3305
  */
3833
3306
  ;
3834
-
3835
3307
  _proto.getMedicalDataFromConsultId =
3836
3308
  /*#__PURE__*/
3837
3309
  function () {
@@ -3845,9 +3317,7 @@ var OroClient = /*#__PURE__*/function () {
3845
3317
  forceRefresh: false
3846
3318
  };
3847
3319
  }
3848
-
3849
3320
  return _context25.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, initApis.MetadataCategory.Medical, options));
3850
-
3851
3321
  case 2:
3852
3322
  case "end":
3853
3323
  return _context25.stop();
@@ -3855,20 +3325,15 @@ var OroClient = /*#__PURE__*/function () {
3855
3325
  }
3856
3326
  }, _callee25, this);
3857
3327
  }));
3858
-
3859
3328
  function getMedicalDataFromConsultId(_x75, _x76) {
3860
3329
  return _getMedicalDataFromConsultId.apply(this, arguments);
3861
3330
  }
3862
-
3863
3331
  return getMedicalDataFromConsultId;
3864
3332
  }();
3865
-
3866
3333
  _proto.getMetaCategoryFromConsultId = /*#__PURE__*/function () {
3867
3334
  var _getMetaCategoryFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(consultationId, category, options) {
3868
3335
  var _this2 = this;
3869
-
3870
3336
  var grants, workflowData, _loop, _iterator, _step;
3871
-
3872
3337
  return _regeneratorRuntime().wrap(function _callee27$(_context28) {
3873
3338
  while (1) {
3874
3339
  switch (_context28.prev = _context28.next) {
@@ -3878,12 +3343,10 @@ var OroClient = /*#__PURE__*/function () {
3878
3343
  forceRefresh: false
3879
3344
  };
3880
3345
  }
3881
-
3882
3346
  _context28.next = 3;
3883
3347
  return this.getGrants({
3884
3348
  consultationId: consultationId
3885
3349
  });
3886
-
3887
3350
  case 3:
3888
3351
  grants = _context28.sent;
3889
3352
  workflowData = [];
@@ -3900,26 +3363,21 @@ var OroClient = /*#__PURE__*/function () {
3900
3363
  documentType: initApis.DocumentType.PopulatedWorkflowData,
3901
3364
  consultationIds: [consultationId]
3902
3365
  }, true, grant.lockboxOwnerUuid, options);
3903
-
3904
3366
  case 3:
3905
3367
  manifest = _context27.sent;
3906
-
3907
3368
  if (!(manifest.length === 0)) {
3908
3369
  _context27.next = 8;
3909
3370
  break;
3910
3371
  }
3911
-
3912
3372
  _context27.next = 7;
3913
3373
  return _this2.getLockboxManifest(grant.lockboxUuid, {
3914
3374
  category: category,
3915
3375
  documentType: initApis.DocumentType.PopulatedWorkflowData
3916
3376
  }, true, grant.lockboxOwnerUuid, options);
3917
-
3918
3377
  case 7:
3919
3378
  manifest = _context27.sent.filter(function (entry) {
3920
3379
  return !entry.metadata.consultationIds;
3921
3380
  });
3922
-
3923
3381
  case 8:
3924
3382
  _context27.next = 10;
3925
3383
  return Promise.all(manifest.map( /*#__PURE__*/function () {
@@ -3933,7 +3391,6 @@ var OroClient = /*#__PURE__*/function () {
3933
3391
  _context26.t2 = entry.dataUuid;
3934
3392
  _context26.next = 5;
3935
3393
  return _this2.getJsonData(grant.lockboxUuid, entry.dataUuid);
3936
-
3937
3394
  case 5:
3938
3395
  _context26.t3 = _context26.sent;
3939
3396
  return _context26.abrupt("return", {
@@ -3942,7 +3399,6 @@ var OroClient = /*#__PURE__*/function () {
3942
3399
  dataUuid: _context26.t2,
3943
3400
  data: _context26.t3
3944
3401
  });
3945
-
3946
3402
  case 7:
3947
3403
  case "end":
3948
3404
  return _context26.stop();
@@ -3950,16 +3406,13 @@ var OroClient = /*#__PURE__*/function () {
3950
3406
  }
3951
3407
  }, _callee26);
3952
3408
  }));
3953
-
3954
3409
  return function (_x80) {
3955
3410
  return _ref3.apply(this, arguments);
3956
3411
  };
3957
3412
  }()));
3958
-
3959
3413
  case 10:
3960
3414
  data = _context27.sent;
3961
3415
  workflowData = _extends({}, workflowData, data);
3962
-
3963
3416
  case 12:
3964
3417
  case "end":
3965
3418
  return _context27.stop();
@@ -3968,22 +3421,17 @@ var OroClient = /*#__PURE__*/function () {
3968
3421
  }, _loop);
3969
3422
  });
3970
3423
  _iterator = _createForOfIteratorHelperLoose(grants);
3971
-
3972
3424
  case 7:
3973
3425
  if ((_step = _iterator()).done) {
3974
3426
  _context28.next = 11;
3975
3427
  break;
3976
3428
  }
3977
-
3978
3429
  return _context28.delegateYield(_loop(), "t0", 9);
3979
-
3980
3430
  case 9:
3981
3431
  _context28.next = 7;
3982
3432
  break;
3983
-
3984
3433
  case 11:
3985
3434
  return _context28.abrupt("return", workflowData);
3986
-
3987
3435
  case 12:
3988
3436
  case "end":
3989
3437
  return _context28.stop();
@@ -3991,11 +3439,9 @@ var OroClient = /*#__PURE__*/function () {
3991
3439
  }
3992
3440
  }, _callee27, this);
3993
3441
  }));
3994
-
3995
3442
  function getMetaCategoryFromConsultId(_x77, _x78, _x79) {
3996
3443
  return _getMetaCategoryFromConsultId.apply(this, arguments);
3997
3444
  }
3998
-
3999
3445
  return getMetaCategoryFromConsultId;
4000
3446
  }()
4001
3447
  /**
@@ -4004,7 +3450,6 @@ var OroClient = /*#__PURE__*/function () {
4004
3450
  * @returns the personal data
4005
3451
  */
4006
3452
  ;
4007
-
4008
3453
  _proto.getPersonalInformations =
4009
3454
  /*#__PURE__*/
4010
3455
  function () {
@@ -4016,44 +3461,34 @@ var OroClient = /*#__PURE__*/function () {
4016
3461
  case 0:
4017
3462
  _context29.next = 2;
4018
3463
  return this.getGrants();
4019
-
4020
3464
  case 2:
4021
3465
  grant = _context29.sent.find(function (lockbox) {
4022
3466
  return lockbox.lockboxOwnerUuid === userId;
4023
3467
  });
4024
-
4025
3468
  if (grant) {
4026
3469
  _context29.next = 5;
4027
3470
  break;
4028
3471
  }
4029
-
4030
3472
  throw MissingGrant;
4031
-
4032
3473
  case 5:
4033
3474
  lockboxUuid = grant.lockboxUuid, lockboxOwnerUuid = grant.lockboxOwnerUuid;
4034
-
4035
3475
  if (lockboxUuid) {
4036
3476
  _context29.next = 8;
4037
3477
  break;
4038
3478
  }
4039
-
4040
3479
  throw MissingLockbox;
4041
-
4042
3480
  case 8:
4043
3481
  if (lockboxOwnerUuid) {
4044
3482
  _context29.next = 10;
4045
3483
  break;
4046
3484
  }
4047
-
4048
3485
  throw MissingLockboxOwner;
4049
-
4050
3486
  case 10:
4051
3487
  _context29.next = 12;
4052
3488
  return this.getLockboxManifest(lockboxUuid, {
4053
3489
  category: initApis.MetadataCategory.Personal,
4054
3490
  documentType: initApis.DocumentType.PopulatedWorkflowData
4055
3491
  }, false, userId);
4056
-
4057
3492
  case 12:
4058
3493
  identificationDataUuid = _context29.sent[0].dataUuid;
4059
3494
  _context29.t0 = lockboxOwnerUuid;
@@ -4061,7 +3496,6 @@ var OroClient = /*#__PURE__*/function () {
4061
3496
  _context29.t2 = identificationDataUuid;
4062
3497
  _context29.next = 18;
4063
3498
  return this.getJsonData(lockboxUuid, identificationDataUuid);
4064
-
4065
3499
  case 18:
4066
3500
  _context29.t3 = _context29.sent;
4067
3501
  return _context29.abrupt("return", {
@@ -4070,7 +3504,6 @@ var OroClient = /*#__PURE__*/function () {
4070
3504
  dataUuid: _context29.t2,
4071
3505
  data: _context29.t3
4072
3506
  });
4073
-
4074
3507
  case 20:
4075
3508
  case "end":
4076
3509
  return _context29.stop();
@@ -4078,11 +3511,9 @@ var OroClient = /*#__PURE__*/function () {
4078
3511
  }
4079
3512
  }, _callee28, this);
4080
3513
  }));
4081
-
4082
3514
  function getPersonalInformations(_x81) {
4083
3515
  return _getPersonalInformations.apply(this, arguments);
4084
3516
  }
4085
-
4086
3517
  return getPersonalInformations;
4087
3518
  }()
4088
3519
  /**
@@ -4092,7 +3523,6 @@ var OroClient = /*#__PURE__*/function () {
4092
3523
  * @returns the grant
4093
3524
  */
4094
3525
  ;
4095
-
4096
3526
  _proto.getGrantFromConsultId =
4097
3527
  /*#__PURE__*/
4098
3528
  function () {
@@ -4106,20 +3536,15 @@ var OroClient = /*#__PURE__*/function () {
4106
3536
  return this.getGrants({
4107
3537
  consultationId: consultationId
4108
3538
  });
4109
-
4110
3539
  case 2:
4111
3540
  grants = _context30.sent;
4112
-
4113
3541
  if (!(grants.length === 0)) {
4114
3542
  _context30.next = 5;
4115
3543
  break;
4116
3544
  }
4117
-
4118
3545
  throw AssociatedLockboxNotFound;
4119
-
4120
3546
  case 5:
4121
3547
  return _context30.abrupt("return", grants[0]);
4122
-
4123
3548
  case 6:
4124
3549
  case "end":
4125
3550
  return _context30.stop();
@@ -4127,11 +3552,9 @@ var OroClient = /*#__PURE__*/function () {
4127
3552
  }
4128
3553
  }, _callee29, this);
4129
3554
  }));
4130
-
4131
3555
  function getGrantFromConsultId(_x82) {
4132
3556
  return _getGrantFromConsultId.apply(this, arguments);
4133
3557
  }
4134
-
4135
3558
  return getGrantFromConsultId;
4136
3559
  }()
4137
3560
  /**
@@ -4140,7 +3563,6 @@ var OroClient = /*#__PURE__*/function () {
4140
3563
  * @returns the identity
4141
3564
  */
4142
3565
  ;
4143
-
4144
3566
  _proto.getIdentityFromConsultId =
4145
3567
  /*#__PURE__*/
4146
3568
  function () {
@@ -4152,24 +3574,18 @@ var OroClient = /*#__PURE__*/function () {
4152
3574
  case 0:
4153
3575
  _context31.next = 2;
4154
3576
  return this.getGrantFromConsultId(consultationId);
4155
-
4156
3577
  case 2:
4157
3578
  grant = _context31.sent;
4158
-
4159
3579
  if (!(grant && grant.lockboxOwnerUuid)) {
4160
3580
  _context31.next = 9;
4161
3581
  break;
4162
3582
  }
4163
-
4164
3583
  _context31.next = 6;
4165
3584
  return this.guardClient.identityGet(grant.lockboxOwnerUuid);
4166
-
4167
3585
  case 6:
4168
3586
  return _context31.abrupt("return", _context31.sent);
4169
-
4170
3587
  case 9:
4171
3588
  return _context31.abrupt("return", undefined);
4172
-
4173
3589
  case 10:
4174
3590
  case "end":
4175
3591
  return _context31.stop();
@@ -4177,11 +3593,9 @@ var OroClient = /*#__PURE__*/function () {
4177
3593
  }
4178
3594
  }, _callee30, this);
4179
3595
  }));
4180
-
4181
3596
  function getIdentityFromConsultId(_x83) {
4182
3597
  return _getIdentityFromConsultId.apply(this, arguments);
4183
3598
  }
4184
-
4185
3599
  return getIdentityFromConsultId;
4186
3600
  }()
4187
3601
  /**
@@ -4195,13 +3609,11 @@ var OroClient = /*#__PURE__*/function () {
4195
3609
  * @returns the lockbox manifest
4196
3610
  */
4197
3611
  ;
4198
-
4199
3612
  _proto.getLockboxManifest =
4200
3613
  /*#__PURE__*/
4201
3614
  function () {
4202
3615
  var _getLockboxManifest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(lockboxUuid, filter, expandPrivateMetadata, lockboxOwnerUuid, options) {
4203
3616
  var _this3 = this;
4204
-
4205
3617
  var manifestKey;
4206
3618
  return _regeneratorRuntime().wrap(function _callee32$(_context33) {
4207
3619
  while (1) {
@@ -4212,21 +3624,17 @@ var OroClient = /*#__PURE__*/function () {
4212
3624
  forceRefresh: false
4213
3625
  };
4214
3626
  }
4215
-
4216
3627
  manifestKey = JSON.stringify({
4217
3628
  lockboxUuid: lockboxUuid,
4218
3629
  filter: filter,
4219
3630
  expandPrivateMetadata: expandPrivateMetadata,
4220
3631
  lockboxOwnerUuid: lockboxOwnerUuid
4221
3632
  });
4222
-
4223
3633
  if (!(!options.forceRefresh && this.cachedManifest[manifestKey])) {
4224
3634
  _context33.next = 4;
4225
3635
  break;
4226
3636
  }
4227
-
4228
3637
  return _context33.abrupt("return", this.cachedManifest[manifestKey]);
4229
-
4230
3638
  case 4:
4231
3639
  return _context33.abrupt("return", this.vaultClient.lockboxManifestGet(lockboxUuid, filter, lockboxOwnerUuid).then(function (manifest) {
4232
3640
  return Promise.all(manifest.map( /*#__PURE__*/function () {
@@ -4240,17 +3648,13 @@ var OroClient = /*#__PURE__*/function () {
4240
3648
  _context32.next = 5;
4241
3649
  break;
4242
3650
  }
4243
-
4244
3651
  _context32.next = 3;
4245
3652
  return _this3.getJsonData(lockboxUuid, entry.metadata.privateMetadata, lockboxOwnerUuid);
4246
-
4247
3653
  case 3:
4248
3654
  privateMeta = _context32.sent;
4249
3655
  entry.metadata = _extends({}, entry.metadata, privateMeta);
4250
-
4251
3656
  case 5:
4252
3657
  return _context32.abrupt("return", entry);
4253
-
4254
3658
  case 6:
4255
3659
  case "end":
4256
3660
  return _context32.stop();
@@ -4258,7 +3662,6 @@ var OroClient = /*#__PURE__*/function () {
4258
3662
  }
4259
3663
  }, _callee31);
4260
3664
  }));
4261
-
4262
3665
  return function (_x89) {
4263
3666
  return _ref4.apply(this, arguments);
4264
3667
  };
@@ -4266,7 +3669,6 @@ var OroClient = /*#__PURE__*/function () {
4266
3669
  return _this3.cachedManifest[manifestKey] = manifest;
4267
3670
  });
4268
3671
  }));
4269
-
4270
3672
  case 5:
4271
3673
  case "end":
4272
3674
  return _context33.stop();
@@ -4274,11 +3676,9 @@ var OroClient = /*#__PURE__*/function () {
4274
3676
  }
4275
3677
  }, _callee32, this);
4276
3678
  }));
4277
-
4278
3679
  function getLockboxManifest(_x84, _x85, _x86, _x87, _x88) {
4279
3680
  return _getLockboxManifest.apply(this, arguments);
4280
3681
  }
4281
-
4282
3682
  return getLockboxManifest;
4283
3683
  }()
4284
3684
  /**
@@ -4289,13 +3689,11 @@ var OroClient = /*#__PURE__*/function () {
4289
3689
  * @returns
4290
3690
  */
4291
3691
  ;
4292
-
4293
3692
  _proto.createPersonalInformations =
4294
3693
  /*#__PURE__*/
4295
3694
  function () {
4296
3695
  var _createPersonalInformations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(identity, data, dataUuid) {
4297
3696
  var _yield$this$getGrants;
4298
-
4299
3697
  var lockboxUuid;
4300
3698
  return _regeneratorRuntime().wrap(function _callee33$(_context34) {
4301
3699
  while (1) {
@@ -4303,40 +3701,31 @@ var OroClient = /*#__PURE__*/function () {
4303
3701
  case 0:
4304
3702
  _context34.next = 2;
4305
3703
  return this.getGrants();
4306
-
4307
3704
  case 2:
4308
3705
  _context34.t0 = _yield$this$getGrants = _context34.sent.find(function (lockbox) {
4309
3706
  return lockbox.lockboxOwnerUuid === identity.id;
4310
3707
  });
4311
-
4312
3708
  if (!(_context34.t0 == null)) {
4313
3709
  _context34.next = 7;
4314
3710
  break;
4315
3711
  }
4316
-
4317
3712
  _context34.t1 = void 0;
4318
3713
  _context34.next = 8;
4319
3714
  break;
4320
-
4321
3715
  case 7:
4322
3716
  _context34.t1 = _yield$this$getGrants.lockboxUuid;
4323
-
4324
3717
  case 8:
4325
3718
  lockboxUuid = _context34.t1;
4326
-
4327
3719
  if (!lockboxUuid) {
4328
3720
  _context34.next = 13;
4329
3721
  break;
4330
3722
  }
4331
-
4332
3723
  return _context34.abrupt("return", this.createJsonData(lockboxUuid, data, {
4333
3724
  category: initApis.MetadataCategory.Personal,
4334
3725
  documentType: initApis.DocumentType.PopulatedWorkflowData
4335
3726
  }, {}, undefined, dataUuid));
4336
-
4337
3727
  case 13:
4338
3728
  throw MissingLockbox;
4339
-
4340
3729
  case 14:
4341
3730
  case "end":
4342
3731
  return _context34.stop();
@@ -4344,11 +3733,9 @@ var OroClient = /*#__PURE__*/function () {
4344
3733
  }
4345
3734
  }, _callee33, this);
4346
3735
  }));
4347
-
4348
3736
  function createPersonalInformations(_x90, _x91, _x92) {
4349
3737
  return _createPersonalInformations.apply(this, arguments);
4350
3738
  }
4351
-
4352
3739
  return createPersonalInformations;
4353
3740
  }()
4354
3741
  /**
@@ -4359,13 +3746,11 @@ var OroClient = /*#__PURE__*/function () {
4359
3746
  * @returns
4360
3747
  */
4361
3748
  ;
4362
-
4363
3749
  _proto.createUserPreference =
4364
3750
  /*#__PURE__*/
4365
3751
  function () {
4366
3752
  var _createUserPreference = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(identity, preference, dataUuid) {
4367
3753
  var _yield$this$getGrants2;
4368
-
4369
3754
  var lockboxUuid;
4370
3755
  return _regeneratorRuntime().wrap(function _callee34$(_context35) {
4371
3756
  while (1) {
@@ -4373,40 +3758,31 @@ var OroClient = /*#__PURE__*/function () {
4373
3758
  case 0:
4374
3759
  _context35.next = 2;
4375
3760
  return this.getGrants();
4376
-
4377
3761
  case 2:
4378
3762
  _context35.t0 = _yield$this$getGrants2 = _context35.sent.find(function (lockbox) {
4379
3763
  return lockbox.lockboxOwnerUuid === identity.id;
4380
3764
  });
4381
-
4382
3765
  if (!(_context35.t0 == null)) {
4383
3766
  _context35.next = 7;
4384
3767
  break;
4385
3768
  }
4386
-
4387
3769
  _context35.t1 = void 0;
4388
3770
  _context35.next = 8;
4389
3771
  break;
4390
-
4391
3772
  case 7:
4392
3773
  _context35.t1 = _yield$this$getGrants2.lockboxUuid;
4393
-
4394
3774
  case 8:
4395
3775
  lockboxUuid = _context35.t1;
4396
-
4397
3776
  if (!lockboxUuid) {
4398
3777
  _context35.next = 13;
4399
3778
  break;
4400
3779
  }
4401
-
4402
3780
  return _context35.abrupt("return", this.createJsonData(lockboxUuid, preference, {
4403
3781
  category: initApis.MetadataCategory.Preference,
4404
3782
  contentType: 'application/json'
4405
3783
  }, {}, undefined, dataUuid));
4406
-
4407
3784
  case 13:
4408
3785
  throw MissingLockbox;
4409
-
4410
3786
  case 14:
4411
3787
  case "end":
4412
3788
  return _context35.stop();
@@ -4414,11 +3790,9 @@ var OroClient = /*#__PURE__*/function () {
4414
3790
  }
4415
3791
  }, _callee34, this);
4416
3792
  }));
4417
-
4418
3793
  function createUserPreference(_x93, _x94, _x95) {
4419
3794
  return _createUserPreference.apply(this, arguments);
4420
3795
  }
4421
-
4422
3796
  return createUserPreference;
4423
3797
  }()
4424
3798
  /**
@@ -4427,7 +3801,6 @@ var OroClient = /*#__PURE__*/function () {
4427
3801
  * @returns the user preference
4428
3802
  */
4429
3803
  ;
4430
-
4431
3804
  _proto.getDataFromGrant =
4432
3805
  /*#__PURE__*/
4433
3806
  function () {
@@ -4438,28 +3811,22 @@ var OroClient = /*#__PURE__*/function () {
4438
3811
  switch (_context36.prev = _context36.next) {
4439
3812
  case 0:
4440
3813
  lockboxUuid = grant.lockboxUuid, lockboxOwnerUuid = grant.lockboxOwnerUuid;
4441
-
4442
3814
  if (lockboxUuid) {
4443
3815
  _context36.next = 3;
4444
3816
  break;
4445
3817
  }
4446
-
4447
3818
  throw MissingLockbox;
4448
-
4449
3819
  case 3:
4450
3820
  if (lockboxOwnerUuid) {
4451
3821
  _context36.next = 5;
4452
3822
  break;
4453
3823
  }
4454
-
4455
3824
  throw MissingLockboxOwner;
4456
-
4457
3825
  case 5:
4458
3826
  _context36.next = 7;
4459
3827
  return this.getLockboxManifest(lockboxUuid, filter, false, grant.lockboxOwnerUuid, {
4460
3828
  forceRefresh: true
4461
3829
  });
4462
-
4463
3830
  case 7:
4464
3831
  identificationDataUuid = _context36.sent[0].dataUuid;
4465
3832
  _context36.t0 = lockboxOwnerUuid;
@@ -4467,7 +3834,6 @@ var OroClient = /*#__PURE__*/function () {
4467
3834
  _context36.t2 = identificationDataUuid;
4468
3835
  _context36.next = 13;
4469
3836
  return this.getJsonData(lockboxUuid, identificationDataUuid);
4470
-
4471
3837
  case 13:
4472
3838
  _context36.t3 = _context36.sent;
4473
3839
  return _context36.abrupt("return", {
@@ -4476,7 +3842,6 @@ var OroClient = /*#__PURE__*/function () {
4476
3842
  dataUuid: _context36.t2,
4477
3843
  data: _context36.t3
4478
3844
  });
4479
-
4480
3845
  case 15:
4481
3846
  case "end":
4482
3847
  return _context36.stop();
@@ -4484,11 +3849,9 @@ var OroClient = /*#__PURE__*/function () {
4484
3849
  }
4485
3850
  }, _callee35, this);
4486
3851
  }));
4487
-
4488
3852
  function getDataFromGrant(_x96, _x97) {
4489
3853
  return _getDataFromGrant.apply(this, arguments);
4490
3854
  }
4491
-
4492
3855
  return getDataFromGrant;
4493
3856
  }()
4494
3857
  /**
@@ -4497,7 +3860,6 @@ var OroClient = /*#__PURE__*/function () {
4497
3860
  * @returns the user preference
4498
3861
  */
4499
3862
  ;
4500
-
4501
3863
  _proto.getUserPreferenceFromConsultId =
4502
3864
  /*#__PURE__*/
4503
3865
  function () {
@@ -4509,23 +3871,18 @@ var OroClient = /*#__PURE__*/function () {
4509
3871
  case 0:
4510
3872
  _context37.next = 2;
4511
3873
  return this.getGrantFromConsultId(consultationId);
4512
-
4513
3874
  case 2:
4514
3875
  grant = _context37.sent;
4515
-
4516
3876
  if (grant) {
4517
3877
  _context37.next = 5;
4518
3878
  break;
4519
3879
  }
4520
-
4521
3880
  throw MissingGrant;
4522
-
4523
3881
  case 5:
4524
3882
  return _context37.abrupt("return", this.getDataFromGrant(grant, {
4525
3883
  category: initApis.MetadataCategory.Preference,
4526
3884
  contentType: 'application/json'
4527
3885
  }));
4528
-
4529
3886
  case 6:
4530
3887
  case "end":
4531
3888
  return _context37.stop();
@@ -4533,11 +3890,9 @@ var OroClient = /*#__PURE__*/function () {
4533
3890
  }
4534
3891
  }, _callee36, this);
4535
3892
  }));
4536
-
4537
3893
  function getUserPreferenceFromConsultId(_x98) {
4538
3894
  return _getUserPreferenceFromConsultId.apply(this, arguments);
4539
3895
  }
4540
-
4541
3896
  return getUserPreferenceFromConsultId;
4542
3897
  }()
4543
3898
  /**
@@ -4546,7 +3901,6 @@ var OroClient = /*#__PURE__*/function () {
4546
3901
  * @returns the user preference
4547
3902
  */
4548
3903
  ;
4549
-
4550
3904
  _proto.getUserPreference =
4551
3905
  /*#__PURE__*/
4552
3906
  function () {
@@ -4558,25 +3912,20 @@ var OroClient = /*#__PURE__*/function () {
4558
3912
  case 0:
4559
3913
  _context38.next = 2;
4560
3914
  return this.getGrants();
4561
-
4562
3915
  case 2:
4563
3916
  grant = _context38.sent.find(function (lockbox) {
4564
3917
  return lockbox.lockboxOwnerUuid === identity.id;
4565
3918
  });
4566
-
4567
3919
  if (grant) {
4568
3920
  _context38.next = 5;
4569
3921
  break;
4570
3922
  }
4571
-
4572
3923
  throw MissingGrant;
4573
-
4574
3924
  case 5:
4575
3925
  return _context38.abrupt("return", this.getDataFromGrant(grant, {
4576
3926
  category: initApis.MetadataCategory.Preference,
4577
3927
  contentType: 'application/json'
4578
3928
  }));
4579
-
4580
3929
  case 6:
4581
3930
  case "end":
4582
3931
  return _context38.stop();
@@ -4584,11 +3933,9 @@ var OroClient = /*#__PURE__*/function () {
4584
3933
  }
4585
3934
  }, _callee37, this);
4586
3935
  }));
4587
-
4588
3936
  function getUserPreference(_x99) {
4589
3937
  return _getUserPreference.apply(this, arguments);
4590
3938
  }
4591
-
4592
3939
  return getUserPreference;
4593
3940
  }()
4594
3941
  /**
@@ -4597,7 +3944,6 @@ var OroClient = /*#__PURE__*/function () {
4597
3944
  * @returns the user preference
4598
3945
  */
4599
3946
  ;
4600
-
4601
3947
  _proto.getRecoveryDataFromConsultId =
4602
3948
  /*#__PURE__*/
4603
3949
  function () {
@@ -4609,23 +3955,18 @@ var OroClient = /*#__PURE__*/function () {
4609
3955
  case 0:
4610
3956
  _context39.next = 2;
4611
3957
  return this.getGrantFromConsultId(consultationId);
4612
-
4613
3958
  case 2:
4614
3959
  grant = _context39.sent;
4615
-
4616
3960
  if (grant) {
4617
3961
  _context39.next = 5;
4618
3962
  break;
4619
3963
  }
4620
-
4621
3964
  throw MissingGrant;
4622
-
4623
3965
  case 5:
4624
3966
  return _context39.abrupt("return", this.getDataFromGrant(grant, {
4625
3967
  category: initApis.MetadataCategory.Recovery,
4626
3968
  contentType: 'application/json'
4627
3969
  }));
4628
-
4629
3970
  case 6:
4630
3971
  case "end":
4631
3972
  return _context39.stop();
@@ -4633,11 +3974,9 @@ var OroClient = /*#__PURE__*/function () {
4633
3974
  }
4634
3975
  }, _callee38, this);
4635
3976
  }));
4636
-
4637
3977
  function getRecoveryDataFromConsultId(_x100) {
4638
3978
  return _getRecoveryDataFromConsultId.apply(this, arguments);
4639
3979
  }
4640
-
4641
3980
  return getRecoveryDataFromConsultId;
4642
3981
  }()
4643
3982
  /**
@@ -4646,7 +3985,6 @@ var OroClient = /*#__PURE__*/function () {
4646
3985
  * @returns the user preference
4647
3986
  */
4648
3987
  ;
4649
-
4650
3988
  _proto.getRecoveryData =
4651
3989
  /*#__PURE__*/
4652
3990
  function () {
@@ -4658,25 +3996,20 @@ var OroClient = /*#__PURE__*/function () {
4658
3996
  case 0:
4659
3997
  _context40.next = 2;
4660
3998
  return this.getGrants();
4661
-
4662
3999
  case 2:
4663
4000
  grant = _context40.sent.find(function (lockbox) {
4664
4001
  return lockbox.lockboxOwnerUuid === identity.id;
4665
4002
  });
4666
-
4667
4003
  if (grant) {
4668
4004
  _context40.next = 5;
4669
4005
  break;
4670
4006
  }
4671
-
4672
4007
  throw MissingGrant;
4673
-
4674
4008
  case 5:
4675
4009
  return _context40.abrupt("return", this.getDataFromGrant(grant, {
4676
4010
  category: initApis.MetadataCategory.Recovery,
4677
4011
  contentType: 'application/json'
4678
4012
  }));
4679
-
4680
4013
  case 6:
4681
4014
  case "end":
4682
4015
  return _context40.stop();
@@ -4684,11 +4017,9 @@ var OroClient = /*#__PURE__*/function () {
4684
4017
  }
4685
4018
  }, _callee39, this);
4686
4019
  }));
4687
-
4688
4020
  function getRecoveryData(_x101) {
4689
4021
  return _getRecoveryData.apply(this, arguments);
4690
4022
  }
4691
-
4692
4023
  return getRecoveryData;
4693
4024
  }()
4694
4025
  /**
@@ -4702,13 +4033,11 @@ var OroClient = /*#__PURE__*/function () {
4702
4033
  * @returns the list of consults
4703
4034
  */
4704
4035
  ;
4705
-
4706
4036
  _proto.getAssignedConsultations =
4707
4037
  /*#__PURE__*/
4708
4038
  function () {
4709
4039
  var _getAssignedConsultations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(practiceUuid) {
4710
4040
  var _this4 = this;
4711
-
4712
4041
  return _regeneratorRuntime().wrap(function _callee41$(_context42) {
4713
4042
  while (1) {
4714
4043
  switch (_context42.prev = _context42.next) {
@@ -4716,7 +4045,6 @@ var OroClient = /*#__PURE__*/function () {
4716
4045
  _context42.t0 = Promise;
4717
4046
  _context42.next = 3;
4718
4047
  return this.getGrants();
4719
-
4720
4048
  case 3:
4721
4049
  _context42.t1 = _context42.sent.map(function (grant) {
4722
4050
  return _this4.getLockboxManifest(grant.lockboxUuid, {
@@ -4731,10 +4059,8 @@ var OroClient = /*#__PURE__*/function () {
4731
4059
  case 0:
4732
4060
  _context41.next = 2;
4733
4061
  return _this4.consultClient.getConsultByUUID(entry.metadata.consultationId, practiceUuid);
4734
-
4735
4062
  case 2:
4736
4063
  return _context41.abrupt("return", _context41.sent);
4737
-
4738
4064
  case 3:
4739
4065
  case "end":
4740
4066
  return _context41.stop();
@@ -4742,7 +4068,6 @@ var OroClient = /*#__PURE__*/function () {
4742
4068
  }
4743
4069
  }, _callee40);
4744
4070
  }));
4745
-
4746
4071
  return function (_x103) {
4747
4072
  return _ref5.apply(this, arguments);
4748
4073
  };
@@ -4754,7 +4079,6 @@ var OroClient = /*#__PURE__*/function () {
4754
4079
  return _context42.abrupt("return", _context42.t0.all.call(_context42.t0, _context42.t1).then(function (consults) {
4755
4080
  return consults.flat();
4756
4081
  }));
4757
-
4758
4082
  case 5:
4759
4083
  case "end":
4760
4084
  return _context42.stop();
@@ -4762,11 +4086,9 @@ var OroClient = /*#__PURE__*/function () {
4762
4086
  }
4763
4087
  }, _callee41, this);
4764
4088
  }));
4765
-
4766
4089
  function getAssignedConsultations(_x102) {
4767
4090
  return _getAssignedConsultations.apply(this, arguments);
4768
4091
  }
4769
-
4770
4092
  return getAssignedConsultations;
4771
4093
  }()
4772
4094
  /**
@@ -4775,13 +4097,11 @@ var OroClient = /*#__PURE__*/function () {
4775
4097
  * @param practiceUuid
4776
4098
  */
4777
4099
  ;
4778
-
4779
4100
  _proto.getPastConsultationsFromConsultId =
4780
4101
  /*#__PURE__*/
4781
4102
  function () {
4782
4103
  var _getPastConsultationsFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(consultationId, practiceUuid) {
4783
4104
  var _this5 = this;
4784
-
4785
4105
  var grant, consultationsInLockbox;
4786
4106
  return _regeneratorRuntime().wrap(function _callee43$(_context44) {
4787
4107
  while (1) {
@@ -4789,36 +4109,28 @@ var OroClient = /*#__PURE__*/function () {
4789
4109
  case 0:
4790
4110
  _context44.next = 2;
4791
4111
  return this.getGrantFromConsultId(consultationId);
4792
-
4793
4112
  case 2:
4794
4113
  grant = _context44.sent;
4795
-
4796
4114
  if (grant) {
4797
4115
  _context44.next = 5;
4798
4116
  break;
4799
4117
  }
4800
-
4801
4118
  return _context44.abrupt("return", undefined);
4802
-
4803
4119
  case 5:
4804
4120
  _context44.next = 7;
4805
4121
  return this.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], ['consultationId'], {
4806
4122
  category: initApis.MetadataCategory.Consultation,
4807
4123
  documentType: initApis.DocumentType.PopulatedWorkflowData
4808
4124
  }, grant.lockboxOwnerUuid);
4809
-
4810
4125
  case 7:
4811
4126
  consultationsInLockbox = _context44.sent.flat().map(function (metadata) {
4812
4127
  return metadata.consultationId;
4813
4128
  });
4814
-
4815
4129
  if (!(consultationsInLockbox.length == 0)) {
4816
4130
  _context44.next = 10;
4817
4131
  break;
4818
4132
  }
4819
-
4820
4133
  return _context44.abrupt("return", []);
4821
-
4822
4134
  case 10:
4823
4135
  _context44.next = 12;
4824
4136
  return Promise.all(consultationsInLockbox.map( /*#__PURE__*/function () {
@@ -4829,10 +4141,8 @@ var OroClient = /*#__PURE__*/function () {
4829
4141
  case 0:
4830
4142
  _context43.next = 2;
4831
4143
  return _this5.consultClient.getConsultByUUID(consultId, practiceUuid);
4832
-
4833
4144
  case 2:
4834
4145
  return _context43.abrupt("return", _context43.sent);
4835
-
4836
4146
  case 3:
4837
4147
  case "end":
4838
4148
  return _context43.stop();
@@ -4840,15 +4150,12 @@ var OroClient = /*#__PURE__*/function () {
4840
4150
  }
4841
4151
  }, _callee42);
4842
4152
  }));
4843
-
4844
4153
  return function (_x106) {
4845
4154
  return _ref6.apply(this, arguments);
4846
4155
  };
4847
4156
  }()));
4848
-
4849
4157
  case 12:
4850
4158
  return _context44.abrupt("return", _context44.sent);
4851
-
4852
4159
  case 13:
4853
4160
  case "end":
4854
4161
  return _context44.stop();
@@ -4856,11 +4163,9 @@ var OroClient = /*#__PURE__*/function () {
4856
4163
  }
4857
4164
  }, _callee43, this);
4858
4165
  }));
4859
-
4860
4166
  function getPastConsultationsFromConsultId(_x104, _x105) {
4861
4167
  return _getPastConsultationsFromConsultId.apply(this, arguments);
4862
4168
  }
4863
-
4864
4169
  return getPastConsultationsFromConsultId;
4865
4170
  }()
4866
4171
  /**
@@ -4870,13 +4175,11 @@ var OroClient = /*#__PURE__*/function () {
4870
4175
  * @returns
4871
4176
  */
4872
4177
  ;
4873
-
4874
4178
  _proto.getPatientConsultationData =
4875
4179
  /*#__PURE__*/
4876
4180
  function () {
4877
4181
  var _getPatientConsultationData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(consultationId, options) {
4878
4182
  var _this6 = this;
4879
-
4880
4183
  return _regeneratorRuntime().wrap(function _callee44$(_context45) {
4881
4184
  while (1) {
4882
4185
  switch (_context45.prev = _context45.next) {
@@ -4886,13 +4189,11 @@ var OroClient = /*#__PURE__*/function () {
4886
4189
  forceRefresh: false
4887
4190
  };
4888
4191
  }
4889
-
4890
4192
  _context45.t0 = Promise;
4891
4193
  _context45.next = 4;
4892
4194
  return this.getGrants({
4893
4195
  consultationId: consultationId
4894
4196
  });
4895
-
4896
4197
  case 4:
4897
4198
  _context45.t1 = _context45.sent.map(function (grant) {
4898
4199
  return _this6.getLockboxManifest(grant.lockboxUuid, {
@@ -4908,7 +4209,6 @@ var OroClient = /*#__PURE__*/function () {
4908
4209
  return _context45.abrupt("return", _context45.t0.all.call(_context45.t0, _context45.t1).then(function (data) {
4909
4210
  return data.flat();
4910
4211
  }));
4911
-
4912
4212
  case 6:
4913
4213
  case "end":
4914
4214
  return _context45.stop();
@@ -4916,11 +4216,9 @@ var OroClient = /*#__PURE__*/function () {
4916
4216
  }
4917
4217
  }, _callee44, this);
4918
4218
  }));
4919
-
4920
4219
  function getPatientConsultationData(_x107, _x108) {
4921
4220
  return _getPatientConsultationData.apply(this, arguments);
4922
4221
  }
4923
-
4924
4222
  return getPatientConsultationData;
4925
4223
  }()
4926
4224
  /**
@@ -4929,7 +4227,6 @@ var OroClient = /*#__PURE__*/function () {
4929
4227
  * @returns
4930
4228
  */
4931
4229
  ;
4932
-
4933
4230
  _proto.getPatientPrescriptionsList =
4934
4231
  /*#__PURE__*/
4935
4232
  function () {
@@ -4942,7 +4239,6 @@ var OroClient = /*#__PURE__*/function () {
4942
4239
  category: initApis.MetadataCategory.Consultation,
4943
4240
  documentType: initApis.DocumentType.Prescription
4944
4241
  }, true, consultationId));
4945
-
4946
4242
  case 1:
4947
4243
  case "end":
4948
4244
  return _context46.stop();
@@ -4950,11 +4246,9 @@ var OroClient = /*#__PURE__*/function () {
4950
4246
  }
4951
4247
  }, _callee45, this);
4952
4248
  }));
4953
-
4954
4249
  function getPatientPrescriptionsList(_x109) {
4955
4250
  return _getPatientPrescriptionsList.apply(this, arguments);
4956
4251
  }
4957
-
4958
4252
  return getPatientPrescriptionsList;
4959
4253
  }()
4960
4254
  /**
@@ -4963,7 +4257,6 @@ var OroClient = /*#__PURE__*/function () {
4963
4257
  * @returns
4964
4258
  */
4965
4259
  ;
4966
-
4967
4260
  _proto.getPatientResultsList =
4968
4261
  /*#__PURE__*/
4969
4262
  function () {
@@ -4976,7 +4269,6 @@ var OroClient = /*#__PURE__*/function () {
4976
4269
  category: initApis.MetadataCategory.Consultation,
4977
4270
  documentType: initApis.DocumentType.Result
4978
4271
  }, true, consultationId));
4979
-
4980
4272
  case 1:
4981
4273
  case "end":
4982
4274
  return _context47.stop();
@@ -4984,11 +4276,9 @@ var OroClient = /*#__PURE__*/function () {
4984
4276
  }
4985
4277
  }, _callee46, this);
4986
4278
  }));
4987
-
4988
4279
  function getPatientResultsList(_x110) {
4989
4280
  return _getPatientResultsList.apply(this, arguments);
4990
4281
  }
4991
-
4992
4282
  return getPatientResultsList;
4993
4283
  }()
4994
4284
  /**
@@ -4997,7 +4287,6 @@ var OroClient = /*#__PURE__*/function () {
4997
4287
  * @returns Document[] corresponding to the patient treatment plan options
4998
4288
  */
4999
4289
  ;
5000
-
5001
4290
  _proto.getPatientTreatmentPlans =
5002
4291
  /*#__PURE__*/
5003
4292
  function () {
@@ -5010,7 +4299,6 @@ var OroClient = /*#__PURE__*/function () {
5010
4299
  category: initApis.MetadataCategory.Consultation,
5011
4300
  documentType: initApis.DocumentType.TreatmentPlan
5012
4301
  }, true, consultationId));
5013
-
5014
4302
  case 1:
5015
4303
  case "end":
5016
4304
  return _context48.stop();
@@ -5018,11 +4306,9 @@ var OroClient = /*#__PURE__*/function () {
5018
4306
  }
5019
4307
  }, _callee47, this);
5020
4308
  }));
5021
-
5022
4309
  function getPatientTreatmentPlans(_x111) {
5023
4310
  return _getPatientTreatmentPlans.apply(this, arguments);
5024
4311
  }
5025
-
5026
4312
  return getPatientTreatmentPlans;
5027
4313
  }()
5028
4314
  /**
@@ -5032,7 +4318,6 @@ var OroClient = /*#__PURE__*/function () {
5032
4318
  * @returns
5033
4319
  */
5034
4320
  ;
5035
-
5036
4321
  _proto.getPatientTreatmentPlanByUuid =
5037
4322
  /*#__PURE__*/
5038
4323
  function () {
@@ -5046,7 +4331,6 @@ var OroClient = /*#__PURE__*/function () {
5046
4331
  documentType: initApis.DocumentType.TreatmentPlan,
5047
4332
  treatmentPlanId: treatmentPlanId
5048
4333
  }, true, consultationId));
5049
-
5050
4334
  case 1:
5051
4335
  case "end":
5052
4336
  return _context49.stop();
@@ -5054,11 +4338,9 @@ var OroClient = /*#__PURE__*/function () {
5054
4338
  }
5055
4339
  }, _callee48, this);
5056
4340
  }));
5057
-
5058
4341
  function getPatientTreatmentPlanByUuid(_x112, _x113) {
5059
4342
  return _getPatientTreatmentPlanByUuid.apply(this, arguments);
5060
4343
  }
5061
-
5062
4344
  return getPatientTreatmentPlanByUuid;
5063
4345
  }()
5064
4346
  /**
@@ -5071,13 +4353,11 @@ var OroClient = /*#__PURE__*/function () {
5071
4353
  * @returns the filtered document list
5072
4354
  */
5073
4355
  ;
5074
-
5075
4356
  _proto.getPatientDocumentsList =
5076
4357
  /*#__PURE__*/
5077
4358
  function () {
5078
4359
  var _getPatientDocumentsList = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(filters, expandPrivateMetadata, consultationId) {
5079
4360
  var _this7 = this;
5080
-
5081
4361
  return _regeneratorRuntime().wrap(function _callee50$(_context51) {
5082
4362
  while (1) {
5083
4363
  switch (_context51.prev = _context51.next) {
@@ -5087,7 +4367,6 @@ var OroClient = /*#__PURE__*/function () {
5087
4367
  return this.getGrants({
5088
4368
  consultationId: consultationId
5089
4369
  });
5090
-
5091
4370
  case 3:
5092
4371
  _context51.t1 = _context51.sent.map(function (grant) {
5093
4372
  return _this7.getLockboxManifest(grant.lockboxUuid, _extends({}, filters, {
@@ -5105,7 +4384,6 @@ var OroClient = /*#__PURE__*/function () {
5105
4384
  lockboxOwnerUuid: grant.lockboxOwnerUuid,
5106
4385
  lockboxUuid: grant.lockboxUuid
5107
4386
  }, entry));
5108
-
5109
4387
  case 1:
5110
4388
  case "end":
5111
4389
  return _context50.stop();
@@ -5113,7 +4391,6 @@ var OroClient = /*#__PURE__*/function () {
5113
4391
  }
5114
4392
  }, _callee49);
5115
4393
  }));
5116
-
5117
4394
  return function (_x117) {
5118
4395
  return _ref7.apply(this, arguments);
5119
4396
  };
@@ -5123,7 +4400,6 @@ var OroClient = /*#__PURE__*/function () {
5123
4400
  return _context51.abrupt("return", _context51.t0.all.call(_context51.t0, _context51.t1).then(function (data) {
5124
4401
  return data.flat();
5125
4402
  }));
5126
-
5127
4403
  case 5:
5128
4404
  case "end":
5129
4405
  return _context51.stop();
@@ -5131,17 +4407,14 @@ var OroClient = /*#__PURE__*/function () {
5131
4407
  }
5132
4408
  }, _callee50, this);
5133
4409
  }));
5134
-
5135
4410
  function getPatientDocumentsList(_x114, _x115, _x116) {
5136
4411
  return _getPatientDocumentsList.apply(this, arguments);
5137
4412
  }
5138
-
5139
4413
  return getPatientDocumentsList;
5140
4414
  }()
5141
4415
  /****************************************************************************************************************
5142
4416
  * RECOVERY *
5143
4417
  ****************************************************************************************************************/
5144
-
5145
4418
  /**
5146
4419
  * @name recoverPrivateKeyFromSecurityQuestions
5147
4420
  * @description Recovers and sets the rsa private key from the answered security questions
@@ -5151,7 +4424,6 @@ var OroClient = /*#__PURE__*/function () {
5151
4424
  * @param threshold the number of answers needed to recover the key
5152
4425
  */
5153
4426
  ;
5154
-
5155
4427
  _proto.recoverPrivateKeyFromSecurityQuestions =
5156
4428
  /*#__PURE__*/
5157
4429
  function () {
@@ -5163,7 +4435,6 @@ var OroClient = /*#__PURE__*/function () {
5163
4435
  case 0:
5164
4436
  _context52.next = 2;
5165
4437
  return this.guardClient.identityGet(id);
5166
-
5167
4438
  case 2:
5168
4439
  shards = _context52.sent.recoverySecurityQuestions;
5169
4440
  answeredShards = shards.filter(function (shard) {
@@ -5177,7 +4448,6 @@ var OroClient = /*#__PURE__*/function () {
5177
4448
  item.securityAnswer = recoverySecurityAnswers[index];
5178
4449
  return item;
5179
4450
  });
5180
-
5181
4451
  try {
5182
4452
  // reconstructs the key from the answered security answers
5183
4453
  privateKey = this.toolbox.reconstructSecret(answeredShards, threshold);
@@ -5185,7 +4455,6 @@ var OroClient = /*#__PURE__*/function () {
5185
4455
  } catch (e) {
5186
4456
  console.error(e);
5187
4457
  }
5188
-
5189
4458
  case 5:
5190
4459
  case "end":
5191
4460
  return _context52.stop();
@@ -5193,11 +4462,9 @@ var OroClient = /*#__PURE__*/function () {
5193
4462
  }
5194
4463
  }, _callee51, this);
5195
4464
  }));
5196
-
5197
4465
  function recoverPrivateKeyFromSecurityQuestions(_x118, _x119, _x120, _x121) {
5198
4466
  return _recoverPrivateKeyFromSecurityQuestions.apply(this, arguments);
5199
4467
  }
5200
-
5201
4468
  return recoverPrivateKeyFromSecurityQuestions;
5202
4469
  }()
5203
4470
  /**
@@ -5207,7 +4474,6 @@ var OroClient = /*#__PURE__*/function () {
5207
4474
  * @param password
5208
4475
  */
5209
4476
  ;
5210
-
5211
4477
  _proto.recoverPrivateKeyFromPassword =
5212
4478
  /*#__PURE__*/
5213
4479
  function () {
@@ -5219,21 +4485,17 @@ var OroClient = /*#__PURE__*/function () {
5219
4485
  case 0:
5220
4486
  _context53.next = 2;
5221
4487
  return this.guardClient.identityGet(id);
5222
-
5223
4488
  case 2:
5224
4489
  identity = _context53.sent;
5225
4490
  recoveryPayload = identity.recoveryPassword;
5226
4491
  symmetricDecryptor = this.toolbox.CryptoChaCha.fromPassphrase(password);
5227
4492
  privateKey = symmetricDecryptor.base64PayloadDecryptToBytes(recoveryPayload);
5228
-
5229
4493
  if (identity.recoveryLogin) {
5230
4494
  //Ensure we can recover from a page reload
5231
4495
  symetricEncryptor = this.toolbox.CryptoChaCha.fromPassphrase(identity.recoveryLogin);
5232
4496
  sessionStorage.setItem(sessionStorePrivateKeyName(id), symetricEncryptor.bytesEncryptToBase64Payload(privateKey));
5233
4497
  }
5234
-
5235
4498
  this.rsa = this.toolbox.CryptoRSA.fromKey(privateKey);
5236
-
5237
4499
  case 8:
5238
4500
  case "end":
5239
4501
  return _context53.stop();
@@ -5241,11 +4503,9 @@ var OroClient = /*#__PURE__*/function () {
5241
4503
  }
5242
4504
  }, _callee52, this);
5243
4505
  }));
5244
-
5245
4506
  function recoverPrivateKeyFromPassword(_x122, _x123) {
5246
4507
  return _recoverPrivateKeyFromPassword.apply(this, arguments);
5247
4508
  }
5248
-
5249
4509
  return recoverPrivateKeyFromPassword;
5250
4510
  }()
5251
4511
  /**
@@ -5255,7 +4515,6 @@ var OroClient = /*#__PURE__*/function () {
5255
4515
  * @param masterKey
5256
4516
  */
5257
4517
  ;
5258
-
5259
4518
  _proto.recoverPrivateKeyFromMasterKey =
5260
4519
  /*#__PURE__*/
5261
4520
  function () {
@@ -5267,13 +4526,11 @@ var OroClient = /*#__PURE__*/function () {
5267
4526
  case 0:
5268
4527
  _context54.next = 2;
5269
4528
  return this.guardClient.identityGet(id);
5270
-
5271
4529
  case 2:
5272
4530
  recoveryPayload = _context54.sent.recoveryMasterKey;
5273
4531
  symmetricDecryptor = this.toolbox.CryptoChaCha.fromPassphrase(masterKey);
5274
4532
  privateKey = symmetricDecryptor.base64PayloadDecryptToBytes(recoveryPayload);
5275
4533
  this.rsa = this.toolbox.CryptoRSA.fromKey(privateKey);
5276
-
5277
4534
  case 6:
5278
4535
  case "end":
5279
4536
  return _context54.stop();
@@ -5281,11 +4538,9 @@ var OroClient = /*#__PURE__*/function () {
5281
4538
  }
5282
4539
  }, _callee53, this);
5283
4540
  }));
5284
-
5285
4541
  function recoverPrivateKeyFromMasterKey(_x124, _x125) {
5286
4542
  return _recoverPrivateKeyFromMasterKey.apply(this, arguments);
5287
4543
  }
5288
-
5289
4544
  return recoverPrivateKeyFromMasterKey;
5290
4545
  }()
5291
4546
  /**
@@ -5297,7 +4552,6 @@ var OroClient = /*#__PURE__*/function () {
5297
4552
  * @param threshold the number of answers needed to rebuild the secret
5298
4553
  */
5299
4554
  ;
5300
-
5301
4555
  _proto.updateSecurityQuestions =
5302
4556
  /*#__PURE__*/
5303
4557
  function () {
@@ -5311,9 +4565,7 @@ var OroClient = /*#__PURE__*/function () {
5311
4565
  _context55.next = 2;
5312
4566
  break;
5313
4567
  }
5314
-
5315
4568
  throw IncompleteAuthentication;
5316
-
5317
4569
  case 2:
5318
4570
  securityQuestionPayload = this.toolbox.breakSecretIntoShards(recoverySecurityQuestions, recoverySecurityAnswers, this.rsa["private"](), threshold);
5319
4571
  updateRequest = {
@@ -5321,10 +4573,8 @@ var OroClient = /*#__PURE__*/function () {
5321
4573
  };
5322
4574
  _context55.next = 6;
5323
4575
  return this.guardClient.identityUpdate(id, updateRequest);
5324
-
5325
4576
  case 6:
5326
4577
  return _context55.abrupt("return", _context55.sent);
5327
-
5328
4578
  case 7:
5329
4579
  case "end":
5330
4580
  return _context55.stop();
@@ -5332,11 +4582,9 @@ var OroClient = /*#__PURE__*/function () {
5332
4582
  }
5333
4583
  }, _callee54, this);
5334
4584
  }));
5335
-
5336
4585
  function updateSecurityQuestions(_x126, _x127, _x128, _x129) {
5337
4586
  return _updateSecurityQuestions.apply(this, arguments);
5338
4587
  }
5339
-
5340
4588
  return updateSecurityQuestions;
5341
4589
  }()
5342
4590
  /**
@@ -5351,7 +4599,6 @@ var OroClient = /*#__PURE__*/function () {
5351
4599
  * @param oldPassword
5352
4600
  */
5353
4601
  ;
5354
-
5355
4602
  _proto.updatePassword =
5356
4603
  /*#__PURE__*/
5357
4604
  function () {
@@ -5365,17 +4612,13 @@ var OroClient = /*#__PURE__*/function () {
5365
4612
  _context56.next = 2;
5366
4613
  break;
5367
4614
  }
5368
-
5369
4615
  throw IncompleteAuthentication;
5370
-
5371
4616
  case 2:
5372
4617
  symmetricEncryptor = this.toolbox.CryptoChaCha.fromPassphrase(newPassword);
5373
4618
  passwordPayload = symmetricEncryptor.bytesEncryptToBase64Payload(this.rsa["private"]());
5374
-
5375
4619
  if (oldPassword) {
5376
4620
  oldPassword = this.toolbox.hashStringToBase64(this.toolbox.hashStringToBase64(oldPassword));
5377
4621
  }
5378
-
5379
4622
  newPassword = this.toolbox.hashStringToBase64(this.toolbox.hashStringToBase64(newPassword));
5380
4623
  updateRequest = {
5381
4624
  password: {
@@ -5386,10 +4629,8 @@ var OroClient = /*#__PURE__*/function () {
5386
4629
  };
5387
4630
  _context56.next = 9;
5388
4631
  return this.guardClient.identityUpdate(id, updateRequest);
5389
-
5390
4632
  case 9:
5391
4633
  return _context56.abrupt("return", _context56.sent);
5392
-
5393
4634
  case 10:
5394
4635
  case "end":
5395
4636
  return _context56.stop();
@@ -5397,11 +4638,9 @@ var OroClient = /*#__PURE__*/function () {
5397
4638
  }
5398
4639
  }, _callee55, this);
5399
4640
  }));
5400
-
5401
4641
  function updatePassword(_x130, _x131, _x132) {
5402
4642
  return _updatePassword.apply(this, arguments);
5403
4643
  }
5404
-
5405
4644
  return updatePassword;
5406
4645
  }()
5407
4646
  /**
@@ -5413,7 +4652,6 @@ var OroClient = /*#__PURE__*/function () {
5413
4652
  * @param lockboxUuid
5414
4653
  */
5415
4654
  ;
5416
-
5417
4655
  _proto.updateMasterKey =
5418
4656
  /*#__PURE__*/
5419
4657
  function () {
@@ -5427,9 +4665,7 @@ var OroClient = /*#__PURE__*/function () {
5427
4665
  _context57.next = 2;
5428
4666
  break;
5429
4667
  }
5430
-
5431
4668
  throw IncompleteAuthentication;
5432
-
5433
4669
  case 2:
5434
4670
  symmetricEncryptor = this.toolbox.CryptoChaCha.fromPassphrase(masterKey);
5435
4671
  masterKeyPayload = symmetricEncryptor.bytesEncryptToBase64Payload(this.rsa["private"]());
@@ -5438,7 +4674,6 @@ var OroClient = /*#__PURE__*/function () {
5438
4674
  };
5439
4675
  _context57.next = 7;
5440
4676
  return this.guardClient.identityUpdate(id, updateRequest);
5441
-
5442
4677
  case 7:
5443
4678
  updatedIdentity = _context57.sent;
5444
4679
  _context57.next = 10;
@@ -5450,10 +4685,8 @@ var OroClient = /*#__PURE__*/function () {
5450
4685
  }, {}, {
5451
4686
  forceReplace: true
5452
4687
  });
5453
-
5454
4688
  case 10:
5455
4689
  return _context57.abrupt("return", updatedIdentity);
5456
-
5457
4690
  case 11:
5458
4691
  case "end":
5459
4692
  return _context57.stop();
@@ -5461,19 +4694,16 @@ var OroClient = /*#__PURE__*/function () {
5461
4694
  }
5462
4695
  }, _callee56, this);
5463
4696
  }));
5464
-
5465
4697
  function updateMasterKey(_x133, _x134, _x135) {
5466
4698
  return _updateMasterKey.apply(this, arguments);
5467
4699
  }
5468
-
5469
4700
  return updateMasterKey;
5470
4701
  }();
5471
-
5472
4702
  return OroClient;
5473
4703
  }();
5474
4704
 
5475
4705
  var _excluded = ["locale"],
5476
- _excluded2 = ["locale"];
4706
+ _excluded2 = ["locale"];
5477
4707
  var CliniaService = /*#__PURE__*/function () {
5478
4708
  function CliniaService(url, apiKey, locale) {
5479
4709
  this.url = url;
@@ -5484,30 +4714,24 @@ var CliniaService = /*#__PURE__*/function () {
5484
4714
  }
5485
4715
  });
5486
4716
  }
5487
-
5488
4717
  var _proto = CliniaService.prototype;
5489
-
5490
4718
  _proto.placeSearch = function placeSearch(searchOptions) {
5491
4719
  var locale = searchOptions.locale,
5492
- data = _objectWithoutPropertiesLoose(searchOptions, _excluded);
5493
-
4720
+ data = _objectWithoutPropertiesLoose(searchOptions, _excluded);
5494
4721
  return this.api.post(this.url + "/search/v1/indexes/health_facility/query", data, {
5495
4722
  params: {
5496
4723
  locale: locale != null ? locale : this.locale
5497
4724
  }
5498
4725
  });
5499
4726
  };
5500
-
5501
4727
  _proto.placeMatch = function placeMatch(searchOptions, type) {
5502
4728
  var locale = searchOptions.locale,
5503
- data = _objectWithoutPropertiesLoose(searchOptions, _excluded2);
5504
-
4729
+ data = _objectWithoutPropertiesLoose(searchOptions, _excluded2);
5505
4730
  var request = this.api.post(this.url + "/search/v1/matches", data, {
5506
4731
  params: {
5507
4732
  locale: locale != null ? locale : this.locale
5508
4733
  }
5509
4734
  });
5510
-
5511
4735
  if (type) {
5512
4736
  request = request.then(function (places) {
5513
4737
  return places.filter(function (place) {
@@ -5515,10 +4739,8 @@ var CliniaService = /*#__PURE__*/function () {
5515
4739
  });
5516
4740
  });
5517
4741
  }
5518
-
5519
4742
  return request;
5520
4743
  };
5521
-
5522
4744
  return CliniaService;
5523
4745
  }();
5524
4746
 
@@ -5537,27 +4759,25 @@ var wasmPath = 'node_modules/oro-toolbox';
5537
4759
  * @param authenticationCallback (optional) authenticationCallback the authentification callback
5538
4760
  * @returns an instance of OroClient
5539
4761
  */
5540
-
5541
4762
  var init = function init(toolbox, tellerBaseURL, vaultBaseURL, guardBaseURL, searchBaseURL, practiceBaseURL, consultBaseURL, workflowBaseURL, diagnosisBaseURL, authenticationCallback) {
5542
4763
  var _initApis = initApis__default({
5543
- tellerBaseURL: tellerBaseURL,
5544
- vaultBaseURL: vaultBaseURL,
5545
- guardBaseURL: guardBaseURL,
5546
- searchBaseURL: searchBaseURL,
5547
- practiceBaseURL: practiceBaseURL,
5548
- consultBaseURL: consultBaseURL,
5549
- workflowBaseURL: workflowBaseURL,
5550
- diagnosisBaseURL: diagnosisBaseURL
5551
- }, authenticationCallback),
5552
- tellerService = _initApis.tellerService,
5553
- practiceService = _initApis.practiceService,
5554
- consultService = _initApis.consultService,
5555
- vaultService = _initApis.vaultService,
5556
- guardService = _initApis.guardService,
5557
- searchService = _initApis.searchService,
5558
- workflowService = _initApis.workflowService,
5559
- diagnosisService = _initApis.diagnosisService;
5560
-
4764
+ tellerBaseURL: tellerBaseURL,
4765
+ vaultBaseURL: vaultBaseURL,
4766
+ guardBaseURL: guardBaseURL,
4767
+ searchBaseURL: searchBaseURL,
4768
+ practiceBaseURL: practiceBaseURL,
4769
+ consultBaseURL: consultBaseURL,
4770
+ workflowBaseURL: workflowBaseURL,
4771
+ diagnosisBaseURL: diagnosisBaseURL
4772
+ }, authenticationCallback),
4773
+ tellerService = _initApis.tellerService,
4774
+ practiceService = _initApis.practiceService,
4775
+ consultService = _initApis.consultService,
4776
+ vaultService = _initApis.vaultService,
4777
+ guardService = _initApis.guardService,
4778
+ searchService = _initApis.searchService,
4779
+ workflowService = _initApis.workflowService,
4780
+ diagnosisService = _initApis.diagnosisService;
5561
4781
  var client = new OroClient(toolbox, tellerService, vaultService, guardService, searchService, practiceService, consultService, workflowService, diagnosisService, authenticationCallback);
5562
4782
  return client;
5563
4783
  };