@lifeready/core 5.0.1 → 5.0.2

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.
Files changed (53) hide show
  1. package/bundles/lifeready-core.umd.js +324 -302
  2. package/bundles/lifeready-core.umd.js.map +1 -1
  3. package/bundles/lifeready-core.umd.min.js +1 -1
  4. package/bundles/lifeready-core.umd.min.js.map +1 -1
  5. package/esm2015/lib/_common/ast.js +4 -4
  6. package/esm2015/lib/_common/exceptions.js +129 -103
  7. package/esm2015/lib/_common/run-outside-angular.js +3 -3
  8. package/esm2015/lib/_common/storage.js +3 -3
  9. package/esm2015/lib/_common/types.js +1 -1
  10. package/esm2015/lib/_common/utils.js +1 -12
  11. package/esm2015/lib/api/lr-graphql/lr-graphql.service.js +4 -4
  12. package/esm2015/lib/api/lr-graphql/lr-merged-mutation.js +4 -4
  13. package/esm2015/lib/api/lr-graphql/lr-mutation-base.js +3 -3
  14. package/esm2015/lib/api/query-processor/common-processors.service.js +3 -3
  15. package/esm2015/lib/api/query-processor/query-processor.service.js +4 -4
  16. package/esm2015/lib/api/query-processor/tp-password-reset-processor.service.js +3 -3
  17. package/esm2015/lib/auth/auth.types.js +1 -8
  18. package/esm2015/lib/auth/life-ready-auth.service.js +7 -9
  19. package/esm2015/lib/category/category.service.js +3 -3
  20. package/esm2015/lib/encryption/encryption.service.js +4 -7
  21. package/esm2015/lib/file-upload/file-upload.service.js +2 -3
  22. package/esm2015/lib/idle/idle.service.js +6 -7
  23. package/esm2015/lib/item2/item2.service.js +3 -3
  24. package/esm2015/lib/key/key-factory.service.js +8 -8
  25. package/esm2015/lib/key/key-graph.service.js +7 -9
  26. package/esm2015/lib/key/key.service.js +5 -5
  27. package/esm2015/lib/key/key.types.js +1 -1
  28. package/esm2015/lib/key-exchange/key-exchange.service.js +3 -3
  29. package/esm2015/lib/key-exchange/key-exchange2.service.js +3 -3
  30. package/esm2015/lib/lbop/lbop.service.js +13 -10
  31. package/esm2015/lib/life-ready.config.js +15 -4
  32. package/esm2015/lib/password/password.service.js +4 -5
  33. package/esm2015/lib/persist/persist.service.js +3 -3
  34. package/esm2015/lib/plan/plan.service.js +3 -3
  35. package/esm2015/lib/profile/profile.types.js +8 -1
  36. package/esm2015/lib/scenario/scenario.service.js +4 -4
  37. package/esm2015/lib/time/time.service.js +3 -6
  38. package/esm2015/lib/tp-assembly/tp-assembly.js +7 -7
  39. package/esm2015/lib/tp-password-reset/tp-password-reset-request.service.js +3 -3
  40. package/esm2015/lib/trusted-party/trusted-party2.service.js +4 -4
  41. package/esm2015/lib/two-factor/two-factor.service.js +3 -3
  42. package/fesm2015/lifeready-core.js +214 -195
  43. package/fesm2015/lifeready-core.js.map +1 -1
  44. package/lib/_common/exceptions.d.ts +54 -38
  45. package/lib/_common/types.d.ts +0 -4
  46. package/lib/_common/utils.d.ts +0 -8
  47. package/lib/auth/auth.types.d.ts +1 -9
  48. package/lib/key/key.types.d.ts +4 -1
  49. package/lib/lbop/lbop.service.d.ts +4 -0
  50. package/lib/life-ready.config.d.ts +7 -0
  51. package/lib/profile/profile.types.d.ts +8 -1
  52. package/lifeready-core.metadata.json +1 -1
  53. package/package.json +1 -1
@@ -344,193 +344,220 @@
344
344
  function handleApolloError(errors) {
345
345
  if (!errors || !errors.length)
346
346
  return;
347
- var lrErrors = errors.map(function (x) { return ({
348
- code: x.extensions && x.extensions.code,
349
- source: x.extensions && x.extensions.source,
350
- message: x.message,
351
- debug: {
352
- locations: x.locations,
353
- path: x.path,
354
- },
355
- }); });
356
- throw new (LrException.bind.apply(LrException, __spread([void 0], lrErrors)))();
347
+ var kcErrors = errors.map(function (x) {
348
+ return new KcError({
349
+ code: x.extensions && x.extensions.code,
350
+ source: x.extensions && x.extensions.source,
351
+ message: x.message,
352
+ debug: {
353
+ locations: x.locations,
354
+ path: x.path,
355
+ },
356
+ });
357
+ });
358
+ throw new (KcException.bind.apply(KcException, __spread([void 0], kcErrors)))();
357
359
  }
358
- var LrError = /** @class */ (function () {
359
- function LrError() {
360
- }
361
- return LrError;
360
+ var KcError = /** @class */ (function () {
361
+ function KcError(options) {
362
+ /**
363
+ * The _tag prevents being able to return an object when a class is required:
364
+ * ref: https://medium.com/decathlondevelopers/whats-the-problem-with-typescript-s-classes-2e60aaad3f6
365
+ * Example:
366
+ * // This works because KcError is being treated as a type.
367
+ * function test(): KcError {
368
+ * return {message: "123"};
369
+ * }
370
+ * With the private _tag property, the above will cause a compiler error because _tag property is missing
371
+ * from the returned object.
372
+ *
373
+ * The _type property also provides a type indicator when serialising the class to POJO.
374
+ */
375
+ this._type = 'KcError';
376
+ this.code = options.code;
377
+ this.source = options.source;
378
+ this.message = options.message;
379
+ this.debug = options.debug;
380
+ }
381
+ return KcError;
362
382
  }());
363
- var LrException = /** @class */ (function () {
364
- function LrException() {
383
+ var KcException = /** @class */ (function () {
384
+ /**
385
+ *
386
+ * @param errors Each argument is a KcError.
387
+ */
388
+ function KcException() {
365
389
  var errors = [];
366
390
  for (var _i = 0; _i < arguments.length; _i++) {
367
391
  errors[_i] = arguments[_i];
368
392
  }
393
+ this._type = 'KcException';
369
394
  this.errors = errors;
370
395
  }
371
- LrException.prototype.toString = function () {
396
+ KcException.prototype.toString = function () {
372
397
  return this.errors.map(function (t) { return JSON.stringify(t, null, 2); });
373
398
  };
374
- return LrException;
399
+ return KcException;
375
400
  }());
376
- (function (LrApiErrorCode) {
377
- LrApiErrorCode["ARCHIVED_RESOURCE"] = "ARCHIVED_RESOURCE";
378
- LrApiErrorCode["BAD_ARGUMENT"] = "BAD_ARGUMENT";
379
- LrApiErrorCode["BAD_SIGNATURE"] = "BAD_SIGNATURE";
380
- LrApiErrorCode["BAD_STATE"] = "BAD_STATE";
381
- LrApiErrorCode["CHANGED_PERMISSIONS"] = "CHANGED_PERMISSIONS";
382
- LrApiErrorCode["CONCURRENT_ACCESS"] = "CONCURRENT_ACCESS";
383
- LrApiErrorCode["CONFIG_ERROR"] = "CONFIG_ERROR";
384
- LrApiErrorCode["CYCLE_DETECTED"] = "CYCLE_DETECTED";
385
- LrApiErrorCode["EXPIRED"] = "EXPIRED";
386
- LrApiErrorCode["INVALID_TOKEN"] = "INVALID_TOKEN";
387
- LrApiErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
388
- LrApiErrorCode["JSON_DECODE_ERROR"] = "JSON_DECODE_ERROR";
389
- LrApiErrorCode["KEY_MISMATCH"] = "KEY_MISMATCH";
390
- LrApiErrorCode["LIMIT_REACHED"] = "LIMIT_REACHED";
391
- LrApiErrorCode["LOCKED"] = "LOCKED";
392
- LrApiErrorCode["LOGIC_ERROR"] = "LOGIC_ERROR";
393
- LrApiErrorCode["LR_DEBUG_ONLY"] = "LR_DEBUG_ONLY";
394
- LrApiErrorCode["MIN_DELAY"] = "MIN_DELAY";
395
- LrApiErrorCode["MISSING_FIELD"] = "MISSING_FIELD";
396
- LrApiErrorCode["MISSING_FIELD_VALUE"] = "MISSING_FIELD_VALUE";
397
- LrApiErrorCode["MISSING_QUERY_PARAM"] = "MISSING_QUERY_PARAM";
398
- LrApiErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
399
- LrApiErrorCode["OBJECT_DOES_NOT_EXIST"] = "OBJECT_DOES_NOT_EXIST";
400
- LrApiErrorCode["OBJECT_EXISTS"] = "OBJECT_EXISTS";
401
- LrApiErrorCode["RANGE_ERROR"] = "RANGE_ERROR";
402
- LrApiErrorCode["TRUSTED_PARTY_NOT_FOUND"] = "TRUSTED_PARTY_NOT_FOUND";
403
- LrApiErrorCode["UNAUTHENTICATED_USER"] = "UNAUTHENTICATED_USER";
404
- LrApiErrorCode["USER_NOT_FOUND"] = "USER_NOT_FOUND";
405
- LrApiErrorCode["VERSION_MISMATCH"] = "VERSION_MISMATCH";
406
- LrApiErrorCode["WRONG_PERMISSIONS"] = "WRONG_PERMISSIONS";
407
- })(exports.LrApiErrorCode || (exports.LrApiErrorCode = {}));
408
- (function (LrErrorCode) {
409
- LrErrorCode["BadTimeSync"] = "LrBadTimeSync";
410
- LrErrorCode["ReceiveClaimMismatch"] = "LrReceiveClaimMismatch";
411
- LrErrorCode["BadState"] = "LrBadState";
412
- LrErrorCode["BadSignature"] = "LrBadSignature";
413
- LrErrorCode["Auth"] = "LrAuth";
414
- LrErrorCode["BadArgument"] = "LrBadArgument";
415
- LrErrorCode["SuspiciousException"] = "LrSuspiciousException";
416
- LrErrorCode["NotFound"] = "LrNotFound";
417
- LrErrorCode["BadLogic"] = "LrBadLogicException";
418
- LrErrorCode["CodeMismatch"] = "LrCodeMismatchException";
419
- LrErrorCode["ConcurrentAccess"] = "LrConcurrentAccessException";
420
- LrErrorCode["BadRequest"] = "LrBadRequestException";
421
- LrErrorCode["Encryption"] = "LrEncryptionGoBad";
422
- LrErrorCode["Locked"] = "LrLockedException";
423
- })(exports.LrErrorCode || (exports.LrErrorCode = {}));
424
- var LrBadArgumentException = /** @class */ (function (_super) {
425
- __extends(LrBadArgumentException, _super);
426
- function LrBadArgumentException(message) {
427
- return _super.call(this, { code: exports.LrErrorCode.BadArgument, message: message }) || this;
428
- }
429
- return LrBadArgumentException;
430
- }(LrException));
431
- var LrSuspiciousException = /** @class */ (function (_super) {
432
- __extends(LrSuspiciousException, _super);
433
- function LrSuspiciousException(message) {
434
- return _super.call(this, { code: exports.LrErrorCode.BadArgument, message: message }) || this;
435
- }
436
- return LrSuspiciousException;
437
- }(LrException));
438
- var LrNotFoundException = /** @class */ (function (_super) {
439
- __extends(LrNotFoundException, _super);
440
- function LrNotFoundException(message) {
441
- return _super.call(this, { code: exports.LrErrorCode.NotFound, message: message }) || this;
442
- }
443
- return LrNotFoundException;
444
- }(LrException));
445
- var LrBadLogicException = /** @class */ (function (_super) {
446
- __extends(LrBadLogicException, _super);
447
- function LrBadLogicException(message) {
448
- return _super.call(this, { code: exports.LrErrorCode.BadLogic, message: message }) || this;
449
- }
450
- return LrBadLogicException;
451
- }(LrException));
452
- var LrCodeMismatchException = /** @class */ (function (_super) {
453
- __extends(LrCodeMismatchException, _super);
454
- function LrCodeMismatchException(message) {
455
- return _super.call(this, { code: exports.LrErrorCode.CodeMismatch, message: message }) || this;
456
- }
457
- return LrCodeMismatchException;
458
- }(LrException));
459
- var LrConcurrentAccessException = /** @class */ (function (_super) {
460
- __extends(LrConcurrentAccessException, _super);
461
- function LrConcurrentAccessException(message) {
462
- return _super.call(this, { code: exports.LrErrorCode.ConcurrentAccess, message: message }) || this;
463
- }
464
- return LrConcurrentAccessException;
465
- }(LrException));
466
- var LrLockedException = /** @class */ (function (_super) {
467
- __extends(LrLockedException, _super);
468
- function LrLockedException(message) {
469
- return _super.call(this, { code: exports.LrErrorCode.Locked, message: message }) || this;
470
- }
471
- return LrLockedException;
472
- }(LrException));
473
- var LrBadRequestException = /** @class */ (function (_super) {
474
- __extends(LrBadRequestException, _super);
475
- function LrBadRequestException(message) {
476
- return _super.call(this, { code: exports.LrErrorCode.BadRequest, message: message }) || this;
477
- }
478
- return LrBadRequestException;
479
- }(LrException));
480
- var LrAuthException = /** @class */ (function (_super) {
481
- __extends(LrAuthException, _super);
482
- function LrAuthException(message) {
483
- return _super.call(this, { code: exports.LrErrorCode.Auth, message: message }) || this;
484
- }
485
- return LrAuthException;
486
- }(LrException));
487
- var LrEncryptionException = /** @class */ (function (_super) {
488
- __extends(LrEncryptionException, _super);
489
- function LrEncryptionException(message) {
490
- return _super.call(this, { code: exports.LrErrorCode.Encryption, message: message }) || this;
491
- }
492
- return LrEncryptionException;
493
- }(LrException));
494
- var LrUnsupportedException = /** @class */ (function (_super) {
495
- __extends(LrUnsupportedException, _super);
496
- function LrUnsupportedException(message) {
497
- return _super.call(this, {
498
- code: 'LrUnsupportedException',
401
+ (function (KcErrorCode) {
402
+ // API errors
403
+ KcErrorCode["ARCHIVED_RESOURCE"] = "ARCHIVED_RESOURCE";
404
+ KcErrorCode["BAD_ARGUMENT"] = "BAD_ARGUMENT";
405
+ KcErrorCode["BAD_SIGNATURE"] = "BAD_SIGNATURE";
406
+ KcErrorCode["BAD_STATE"] = "BAD_STATE";
407
+ KcErrorCode["CHANGED_PERMISSIONS"] = "CHANGED_PERMISSIONS";
408
+ KcErrorCode["CONCURRENT_ACCESS"] = "CONCURRENT_ACCESS";
409
+ KcErrorCode["CONFIG_ERROR"] = "CONFIG_ERROR";
410
+ KcErrorCode["CYCLE_DETECTED"] = "CYCLE_DETECTED";
411
+ KcErrorCode["EXPIRED"] = "EXPIRED";
412
+ KcErrorCode["INVALID_TOKEN"] = "INVALID_TOKEN";
413
+ KcErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
414
+ KcErrorCode["JSON_DECODE_ERROR"] = "JSON_DECODE_ERROR";
415
+ KcErrorCode["KEY_MISMATCH"] = "KEY_MISMATCH";
416
+ KcErrorCode["LIMIT_REACHED"] = "LIMIT_REACHED";
417
+ KcErrorCode["LOCKED"] = "LOCKED";
418
+ KcErrorCode["LOGIC_ERROR"] = "LOGIC_ERROR";
419
+ KcErrorCode["LR_DEBUG_ONLY"] = "LR_DEBUG_ONLY";
420
+ KcErrorCode["MIN_DELAY"] = "MIN_DELAY";
421
+ KcErrorCode["MISSING_FIELD"] = "MISSING_FIELD";
422
+ KcErrorCode["MISSING_FIELD_VALUE"] = "MISSING_FIELD_VALUE";
423
+ KcErrorCode["MISSING_QUERY_PARAM"] = "MISSING_QUERY_PARAM";
424
+ KcErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
425
+ KcErrorCode["OBJECT_DOES_NOT_EXIST"] = "OBJECT_DOES_NOT_EXIST";
426
+ KcErrorCode["OBJECT_EXISTS"] = "OBJECT_EXISTS";
427
+ KcErrorCode["RANGE_ERROR"] = "RANGE_ERROR";
428
+ KcErrorCode["TRUSTED_PARTY_NOT_FOUND"] = "TRUSTED_PARTY_NOT_FOUND";
429
+ KcErrorCode["UNAUTHENTICATED_USER"] = "UNAUTHENTICATED_USER";
430
+ KcErrorCode["USER_NOT_FOUND"] = "USER_NOT_FOUND";
431
+ KcErrorCode["VERSION_MISMATCH"] = "VERSION_MISMATCH";
432
+ KcErrorCode["WRONG_PERMISSIONS"] = "WRONG_PERMISSIONS";
433
+ // KC client errors
434
+ KcErrorCode["AUTH"] = "AUTH";
435
+ KcErrorCode["BAD_LOGIC"] = "BAD_LOGIC";
436
+ KcErrorCode["BAD_REQUEST"] = "BAD_REQUEST";
437
+ KcErrorCode["BAD_TIME_SYNC"] = "BAD_TIME_SYNC";
438
+ KcErrorCode["CODE_MISMATCH"] = "CODE_MISMATCH";
439
+ KcErrorCode["ENCRYPTION"] = "ENCRYPTION";
440
+ KcErrorCode["NOT_FOUND"] = "NOT_FOUND";
441
+ KcErrorCode["SUSPICIOUS_OPERATION"] = "SUSPICIOUS_OPERATION";
442
+ KcErrorCode["UNSUPPORTED"] = "UNSUPPORTED";
443
+ })(exports.KcErrorCode || (exports.KcErrorCode = {}));
444
+ var KcAuthException = /** @class */ (function (_super) {
445
+ __extends(KcAuthException, _super);
446
+ function KcAuthException(message) {
447
+ return _super.call(this, new KcError({ code: exports.KcErrorCode.AUTH, message: message })) || this;
448
+ }
449
+ return KcAuthException;
450
+ }(KcException));
451
+ var KcBadArgumentException = /** @class */ (function (_super) {
452
+ __extends(KcBadArgumentException, _super);
453
+ function KcBadArgumentException(message) {
454
+ return _super.call(this, new KcError({ code: exports.KcErrorCode.BAD_ARGUMENT, message: message })) || this;
455
+ }
456
+ return KcBadArgumentException;
457
+ }(KcException));
458
+ var KcBadLogicException = /** @class */ (function (_super) {
459
+ __extends(KcBadLogicException, _super);
460
+ function KcBadLogicException(message) {
461
+ return _super.call(this, new KcError({ code: exports.KcErrorCode.BAD_LOGIC, message: message })) || this;
462
+ }
463
+ return KcBadLogicException;
464
+ }(KcException));
465
+ var KcBadRequestException = /** @class */ (function (_super) {
466
+ __extends(KcBadRequestException, _super);
467
+ function KcBadRequestException(message) {
468
+ return _super.call(this, new KcError({ code: exports.KcErrorCode.BAD_REQUEST, message: message })) || this;
469
+ }
470
+ return KcBadRequestException;
471
+ }(KcException));
472
+ var KcBadSignatureException = /** @class */ (function (_super) {
473
+ __extends(KcBadSignatureException, _super);
474
+ function KcBadSignatureException(message) {
475
+ return _super.call(this, new KcError({ code: exports.KcErrorCode.BAD_SIGNATURE, message: message })) || this;
476
+ }
477
+ return KcBadSignatureException;
478
+ }(KcException));
479
+ var KcBadStateException = /** @class */ (function (_super) {
480
+ __extends(KcBadStateException, _super);
481
+ function KcBadStateException(message) {
482
+ return _super.call(this, new KcError({
483
+ code: exports.KcErrorCode.BAD_STATE,
499
484
  message: message,
500
- }) || this;
501
- }
502
- return LrUnsupportedException;
503
- }(LrException));
504
- var LrExpiredCodeException = /** @class */ (function (_super) {
505
- __extends(LrExpiredCodeException, _super);
506
- function LrExpiredCodeException(message) {
507
- return _super.call(this, {
508
- code: 'LrExpiredCodeException',
485
+ })) || this;
486
+ }
487
+ return KcBadStateException;
488
+ }(KcException));
489
+ var KcBadTimeSyncException = /** @class */ (function (_super) {
490
+ __extends(KcBadTimeSyncException, _super);
491
+ function KcBadTimeSyncException(message) {
492
+ return _super.call(this, new KcError({
493
+ code: exports.KcErrorCode.BAD_TIME_SYNC,
509
494
  message: message,
510
- }) || this;
511
- }
512
- return LrExpiredCodeException;
513
- }(LrException));
514
- var LrExpiredException = /** @class */ (function (_super) {
515
- __extends(LrExpiredException, _super);
516
- function LrExpiredException(message) {
517
- return _super.call(this, {
518
- code: 'LrExpiredException',
495
+ })) || this;
496
+ }
497
+ return KcBadTimeSyncException;
498
+ }(KcException));
499
+ var KcCodeMismatchException = /** @class */ (function (_super) {
500
+ __extends(KcCodeMismatchException, _super);
501
+ function KcCodeMismatchException(message) {
502
+ return _super.call(this, new KcError({ code: exports.KcErrorCode.CODE_MISMATCH, message: message })) || this;
503
+ }
504
+ return KcCodeMismatchException;
505
+ }(KcException));
506
+ var KcConcurrentAccessException = /** @class */ (function (_super) {
507
+ __extends(KcConcurrentAccessException, _super);
508
+ function KcConcurrentAccessException(message) {
509
+ return _super.call(this, new KcError({ code: exports.KcErrorCode.CONCURRENT_ACCESS, message: message })) || this;
510
+ }
511
+ return KcConcurrentAccessException;
512
+ }(KcException));
513
+ var KcEncryptionException = /** @class */ (function (_super) {
514
+ __extends(KcEncryptionException, _super);
515
+ function KcEncryptionException(message) {
516
+ return _super.call(this, new KcError({ code: exports.KcErrorCode.ENCRYPTION, message: message })) || this;
517
+ }
518
+ return KcEncryptionException;
519
+ }(KcException));
520
+ var KcInternalErrorException = /** @class */ (function (_super) {
521
+ __extends(KcInternalErrorException, _super);
522
+ function KcInternalErrorException(message) {
523
+ return _super.call(this, new KcError({ code: exports.KcErrorCode.INTERNAL_ERROR, message: message })) || this;
524
+ }
525
+ return KcInternalErrorException;
526
+ }(KcException));
527
+ var KcLockedException = /** @class */ (function (_super) {
528
+ __extends(KcLockedException, _super);
529
+ function KcLockedException(message) {
530
+ return _super.call(this, new KcError({
531
+ code: exports.KcErrorCode.LOCKED,
519
532
  message: message,
520
- }) || this;
521
- }
522
- return LrExpiredException;
523
- }(LrException));
524
- var LrBadStateException = /** @class */ (function (_super) {
525
- __extends(LrBadStateException, _super);
526
- function LrBadStateException(message) {
527
- return _super.call(this, {
528
- code: 'LrBadStateException',
533
+ })) || this;
534
+ }
535
+ return KcLockedException;
536
+ }(KcException));
537
+ var KcNotFoundException = /** @class */ (function (_super) {
538
+ __extends(KcNotFoundException, _super);
539
+ function KcNotFoundException(message) {
540
+ return _super.call(this, new KcError({ code: exports.KcErrorCode.NOT_FOUND, message: message })) || this;
541
+ }
542
+ return KcNotFoundException;
543
+ }(KcException));
544
+ var KcSuspiciousOperationException = /** @class */ (function (_super) {
545
+ __extends(KcSuspiciousOperationException, _super);
546
+ function KcSuspiciousOperationException(message) {
547
+ return _super.call(this, new KcError({ code: exports.KcErrorCode.SUSPICIOUS_OPERATION, message: message })) || this;
548
+ }
549
+ return KcSuspiciousOperationException;
550
+ }(KcException));
551
+ var KcUnsupportedException = /** @class */ (function (_super) {
552
+ __extends(KcUnsupportedException, _super);
553
+ function KcUnsupportedException(message) {
554
+ return _super.call(this, new KcError({
555
+ code: exports.KcErrorCode.UNSUPPORTED,
529
556
  message: message,
530
- }) || this;
557
+ })) || this;
531
558
  }
532
- return LrBadStateException;
533
- }(LrException));
559
+ return KcUnsupportedException;
560
+ }(KcException));
534
561
 
535
562
  // promote everything to a promise.
536
563
  function promiseAllMayAsync(values) {
@@ -546,18 +573,18 @@
546
573
  }
547
574
  }
548
575
  function remap(obj, values) {
549
- var e_1, _b;
576
+ var e_1, _a;
550
577
  var ret = {};
551
578
  try {
552
- for (var _c = __values(Object.keys(obj).entries()), _d = _c.next(); !_d.done; _d = _c.next()) {
553
- var _e = __read(_d.value, 2), i = _e[0], key = _e[1];
579
+ for (var _b = __values(Object.keys(obj).entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
580
+ var _d = __read(_c.value, 2), i = _d[0], key = _d[1];
554
581
  ret[key] = values[i];
555
582
  }
556
583
  }
557
584
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
558
585
  finally {
559
586
  try {
560
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
587
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
561
588
  }
562
589
  finally { if (e_1) throw e_1.error; }
563
590
  }
@@ -567,8 +594,8 @@
567
594
  // callback can either return a Promise, or a value.
568
595
  // The Promise<any> type is redundant but it shows that it can return a promise
569
596
  callback) {
570
- var values = promiseAllMayAsync(Object.entries(obj).map(function (_b) {
571
- var _c = __read(_b, 2), key = _c[0], value = _c[1];
597
+ var values = promiseAllMayAsync(Object.entries(obj).map(function (_a) {
598
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
572
599
  return callback(value, key, obj);
573
600
  }));
574
601
  if (values.then) {
@@ -584,8 +611,8 @@
584
611
  // By default, it returns the value without any process, so you can use
585
612
  // this to simply wait for all promises in an object to resolve.
586
613
  callback) {
587
- var values = Promise.all(Object.entries(obj).map(function (_b) {
588
- var _c = __read(_b, 2), key = _c[0], value = _c[1];
614
+ var values = Promise.all(Object.entries(obj).map(function (_a) {
615
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
589
616
  return callback ? callback(value, key, obj) : value;
590
617
  }));
591
618
  return values.then(function (resolvedValues) { return remap(obj, resolvedValues); });
@@ -601,14 +628,14 @@
601
628
  function getAccessJwtToken(auth) {
602
629
  return __awaiter(this, void 0, void 0, function () {
603
630
  var error_1;
604
- return __generator(this, function (_b) {
605
- switch (_b.label) {
631
+ return __generator(this, function (_a) {
632
+ switch (_a.label) {
606
633
  case 0:
607
- _b.trys.push([0, 2, , 3]);
634
+ _a.trys.push([0, 2, , 3]);
608
635
  return [4 /*yield*/, auth.currentSession()];
609
- case 1: return [2 /*return*/, (_b.sent()).getAccessToken().getJwtToken()];
636
+ case 1: return [2 /*return*/, (_a.sent()).getAccessToken().getJwtToken()];
610
637
  case 2:
611
- error_1 = _b.sent();
638
+ error_1 = _a.sent();
612
639
  // The error thrown by Cognito is of type string.
613
640
  if (error_1 == 'No current user') {
614
641
  return [2 /*return*/, ''];
@@ -619,24 +646,6 @@
619
646
  });
620
647
  });
621
648
  }
622
- function httpOptions(auth, config) {
623
- var _a;
624
- return __awaiter(this, void 0, void 0, function () {
625
- var token, debugUsername;
626
- return __generator(this, function (_b) {
627
- switch (_b.label) {
628
- case 0: return [4 /*yield*/, getAccessJwtToken(auth)];
629
- case 1:
630
- token = _b.sent();
631
- debugUsername = (_a = config.debug) === null || _a === void 0 ? void 0 : _a.username;
632
- return [2 /*return*/, {
633
- withCredentials: true,
634
- headers: Object.assign(Object.assign({}, (token && { authorization: "Bearer " + token })), (debugUsername && { 'x-kc-dev-user': debugUsername })),
635
- }];
636
- }
637
- });
638
- });
639
- }
640
649
 
641
650
  // Ref: https://stackoverflow.com/questions/59735280/angular-8-moment-error-cannot-call-a-namespace-moment
642
651
  var moment = moment___namespace;
@@ -686,10 +695,7 @@
686
695
  serverTime = now + this.offsetMs;
687
696
  diff = Math.abs(serverTime - verifyTime);
688
697
  if (diff > this.MAX_DIFF_MSEC) {
689
- throw new LrException({
690
- code: exports.LrErrorCode.BadTimeSync,
691
- message: "Server time does not match independent source. ServerTime: " + serverTime + ", Cognito time: " + verifyTime,
692
- });
698
+ throw new KcBadTimeSyncException("Server time does not match independent source. ServerTime: " + serverTime + ", Cognito time: " + verifyTime);
693
699
  }
694
700
  this.verified = true;
695
701
  return [2 /*return*/];
@@ -983,10 +989,7 @@
983
989
  return [3 /*break*/, 4];
984
990
  case 3:
985
991
  error_1 = _a.sent();
986
- throw new LrException({
987
- code: exports.LrErrorCode.BadSignature,
988
- message: "Bad signature: " + error_1,
989
- });
992
+ throw new KcBadSignatureException("Bad signature: " + error_1);
990
993
  case 4: return [2 /*return*/];
991
994
  }
992
995
  });
@@ -1022,7 +1025,7 @@
1022
1025
  case 'ArrayBuffer':
1023
1026
  return payload;
1024
1027
  default:
1025
- throw new LrBadArgumentException("Unknown payloadType: " + payloadType);
1028
+ throw new KcBadArgumentException("Unknown payloadType: " + payloadType);
1026
1029
  }
1027
1030
  };
1028
1031
  return EncryptionService;
@@ -1099,7 +1102,7 @@
1099
1102
  };
1100
1103
  KeyFactoryService.prototype.randomString = function (digits) {
1101
1104
  if (digits <= 0) {
1102
- throw new LrBadArgumentException('digits <= 0');
1105
+ throw new KcBadArgumentException('digits <= 0');
1103
1106
  }
1104
1107
  var validChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
1105
1108
  var array = new Uint32Array(digits);
@@ -1112,10 +1115,10 @@
1112
1115
  };
1113
1116
  KeyFactoryService.prototype.randomChoices = function (array, chooseN) {
1114
1117
  if (array.length <= 1) {
1115
- throw new LrBadArgumentException('array.length <= 0');
1118
+ throw new KcBadArgumentException('array.length <= 0');
1116
1119
  }
1117
1120
  if (chooseN <= 0) {
1118
- throw new LrBadArgumentException('chooseN <= 0');
1121
+ throw new KcBadArgumentException('chooseN <= 0');
1119
1122
  }
1120
1123
  var values = new Uint32Array(chooseN);
1121
1124
  this.kcCrypto.getRandomValues(values);
@@ -1267,7 +1270,7 @@
1267
1270
  return __awaiter(this, void 0, void 0, function () {
1268
1271
  return __generator(this, function (_a) {
1269
1272
  if (params.iterations < this.MIN_PASS_IDP_PBKDF_ITER) {
1270
- throw new LrSuspiciousException("The number of PassIdp key derivation iterations sent from the server (" + params.iterations + ") is lower than the minimum (" + this.MIN_PASS_IDP_PBKDF_ITER + ")");
1273
+ throw new KcSuspiciousOperationException("The number of PassIdp key derivation iterations sent from the server (" + params.iterations + ") is lower than the minimum (" + this.MIN_PASS_IDP_PBKDF_ITER + ")");
1271
1274
  }
1272
1275
  return [2 /*return*/, this.deriveKey(params)];
1273
1276
  });
@@ -1277,7 +1280,7 @@
1277
1280
  return __awaiter(this, void 0, void 0, function () {
1278
1281
  return __generator(this, function (_a) {
1279
1282
  if (params.iterations < this.MIN_PASS_KEY_PBKDF_ITER) {
1280
- throw new LrSuspiciousException("The number of PassKey key derivation iterations sent from the server(" + params.iterations + ") is lower than the minimum(" + this.MIN_PASS_KEY_PBKDF_ITER + ")");
1283
+ throw new KcSuspiciousOperationException("The number of PassKey key derivation iterations sent from the server(" + params.iterations + ") is lower than the minimum(" + this.MIN_PASS_KEY_PBKDF_ITER + ")");
1281
1284
  }
1282
1285
  return [2 /*return*/, this.deriveKey(params)];
1283
1286
  });
@@ -1287,7 +1290,7 @@
1287
1290
  return __awaiter(this, void 0, void 0, function () {
1288
1291
  return __generator(this, function (_a) {
1289
1292
  if (params.iterations < this.MIN_LBOP_KEY_PBKDF_ITER) {
1290
- throw new LrSuspiciousException("The number of LbopKey key derivation iterations sent from the server(" + params.iterations + ") is lower than the minimum(" + this.MIN_LBOP_KEY_PBKDF_ITER + ")");
1293
+ throw new KcSuspiciousOperationException("The number of LbopKey key derivation iterations sent from the server(" + params.iterations + ") is lower than the minimum(" + this.MIN_LBOP_KEY_PBKDF_ITER + ")");
1291
1294
  }
1292
1295
  return [2 /*return*/, this.deriveKey(params)];
1293
1296
  });
@@ -1373,7 +1376,25 @@
1373
1376
  // can possibly have different tokens with the same type (i.e. KcConfig). So it would not
1374
1377
  // be appropriate to use "KcConfig" as the token string.
1375
1378
  var KC_CONFIG = new i0.InjectionToken('KC_CONFIG');
1376
- var RETRY_ERROR_CODES = [exports.LrApiErrorCode.CONCURRENT_ACCESS];
1379
+ var RETRY_ERROR_CODES = [exports.KcErrorCode.CONCURRENT_ACCESS];
1380
+ function httpOptions(auth, config) {
1381
+ var _a;
1382
+ return __awaiter(this, void 0, void 0, function () {
1383
+ var token, debugUsername;
1384
+ return __generator(this, function (_b) {
1385
+ switch (_b.label) {
1386
+ case 0: return [4 /*yield*/, getAccessJwtToken(auth)];
1387
+ case 1:
1388
+ token = _b.sent();
1389
+ debugUsername = (_a = config.debug) === null || _a === void 0 ? void 0 : _a.username;
1390
+ return [2 /*return*/, {
1391
+ withCredentials: true,
1392
+ headers: Object.assign(Object.assign({}, (token && { authorization: "Bearer " + token })), (debugUsername && { 'x-kc-dev-user': debugUsername })),
1393
+ }];
1394
+ }
1395
+ });
1396
+ });
1397
+ }
1377
1398
  var configureApollo = function (config, auth) {
1378
1399
  var defaultOptions = {
1379
1400
  watchQuery: {
@@ -1506,7 +1527,7 @@
1506
1527
  console.warn('The cookie secure flag in persistService has been set to false, set it to true in production mode');
1507
1528
  }
1508
1529
  else {
1509
- throw new LrBadArgumentException('Can not set PersistService cookie secure flag to false in production mode.');
1530
+ throw new KcBadArgumentException('Can not set PersistService cookie secure flag to false in production mode.');
1510
1531
  }
1511
1532
  }
1512
1533
  };
@@ -1750,7 +1771,7 @@
1750
1771
  case 1:
1751
1772
  storedKey = _a.sent();
1752
1773
  if (storedKey == null) {
1753
- throw new LrNotFoundException("Can not find masterKey in persisted storage using name: " + this.STORE_MASTER_KEY);
1774
+ throw new KcNotFoundException("Can not find masterKey in persisted storage using name: " + this.STORE_MASTER_KEY);
1754
1775
  }
1755
1776
  return [4 /*yield*/, this.persistService.set({
1756
1777
  name: this.STORE_MASTER_KEY,
@@ -1783,10 +1804,10 @@
1783
1804
  case 1:
1784
1805
  storedKey = _b.sent();
1785
1806
  if (!storedKey) {
1786
- throw new LrNotFoundException('Could not find masterKey in persisted storage');
1807
+ throw new KcNotFoundException('Could not find masterKey in persisted storage');
1787
1808
  }
1788
1809
  if (storedKey.id !== masterKeyId) {
1789
- throw new LrNotFoundException("masterKeyId " + storedKey.id + " in persisted storage does not match the one requested " + masterKeyId);
1810
+ throw new KcNotFoundException("masterKeyId " + storedKey.id + " in persisted storage does not match the one requested " + masterKeyId);
1790
1811
  }
1791
1812
  _a = storedKey;
1792
1813
  return [4 /*yield*/, KeyFactoryService.asKey(storedKey.jwk)];
@@ -1871,12 +1892,10 @@
1871
1892
  KeyGraphService.prototype.getNode = function (id, type) {
1872
1893
  var node = this.graph.node(id);
1873
1894
  if (!node) {
1874
- throw new LrNotFoundException("Key graphs does not contain key id: " + id);
1895
+ throw new KcNotFoundException("Key graphs does not contain key id: " + id);
1875
1896
  }
1876
1897
  if (node.type !== type) {
1877
- throw new LrException({
1878
- message: "Key with id " + id + " is not of type " + type,
1879
- });
1898
+ throw new KcBadStateException("Key with id " + id + " is not of type " + type);
1880
1899
  }
1881
1900
  return node.data;
1882
1901
  };
@@ -1983,10 +2002,10 @@
1983
2002
  };
1984
2003
  KeyGraphService.prototype.getPath = function (knownKeyId, keyId) {
1985
2004
  if (!knownKeyId || typeof knownKeyId !== 'string') {
1986
- throw new LrEncryptionException("Param knownKeyId wrong format: " + knownKeyId);
2005
+ throw new KcEncryptionException("Param knownKeyId wrong format: " + knownKeyId);
1987
2006
  }
1988
2007
  if (!keyId || typeof keyId !== 'string') {
1989
- throw new LrEncryptionException("Param keyId wrong format: " + keyId);
2008
+ throw new KcEncryptionException("Param keyId wrong format: " + keyId);
1990
2009
  }
1991
2010
  // => { A: { distance: 0 },
1992
2011
  // B: { distance: 6, predecessor: 'C' },
@@ -2217,7 +2236,7 @@
2217
2236
  return __awaiter(this, void 0, void 0, function () {
2218
2237
  return __generator(this, function (_a) {
2219
2238
  if (!isSymmetricKey(key)) {
2220
- throw new LrBadArgumentException('Only allowing wrapping of symmetric keys.');
2239
+ throw new KcBadArgumentException('Only allowing wrapping of symmetric keys.');
2221
2240
  }
2222
2241
  return [2 /*return*/, this.encryptToString(wrappingKey, key.toJSON(true))];
2223
2242
  });
@@ -2320,7 +2339,7 @@
2320
2339
  function getAstOperation(astDocument, operation) {
2321
2340
  var operations = astDocument.definitions.filter(function (def) { return def.kind === 'OperationDefinition'; });
2322
2341
  if (operations.length > 1) {
2323
- throw new LrBadLogicException("There can be only one '" + operation + "' operation, instead there are " + operations.length);
2342
+ throw new KcBadLogicException("There can be only one '" + operation + "' operation, instead there are " + operations.length);
2324
2343
  }
2325
2344
  return operations[0];
2326
2345
  }
@@ -2336,7 +2355,7 @@
2336
2355
  function getFragment(astDocument) {
2337
2356
  var fragments = getFragments(astDocument);
2338
2357
  if (fragments.length > 1) {
2339
- throw new LrBadArgumentException('GraphQL document can only contain one fragment.');
2358
+ throw new KcBadArgumentException('GraphQL document can only contain one fragment.');
2340
2359
  }
2341
2360
  return fragments[0];
2342
2361
  }
@@ -2407,7 +2426,7 @@
2407
2426
  function run(original, args) {
2408
2427
  var _this = this;
2409
2428
  if (!this[ngZoneName]) {
2410
- throw new LrBadLogicException("RunOutsideAngular decorator requires that " + target.name + " inject NgZone as " + ngZoneName);
2429
+ throw new KcBadLogicException("RunOutsideAngular decorator requires that " + target.name + " inject NgZone as " + ngZoneName);
2411
2430
  }
2412
2431
  // runOutsideAngular() synchronously runs the callback and returns the result.
2413
2432
  var result = this[ngZoneName].runOutsideAngular(function () { return original.apply(_this, args); });
@@ -2588,7 +2607,7 @@
2588
2607
  keyId = _b;
2589
2608
  if (!keyId) {
2590
2609
  keyIdName = getKeyId ? 'key-id' : 'keyId or key.id';
2591
- throw new LrBadLogicException("Query response does not contain " + keyIdName + " field: " + context.path.join('.'));
2610
+ throw new KcBadLogicException("Query response does not contain " + keyIdName + " field: " + context.path.join('.'));
2592
2611
  }
2593
2612
  return [2 /*return*/, this.keyGraph
2594
2613
  .decryptFromString(keyId, cipherField)
@@ -2685,7 +2704,7 @@
2685
2704
  ret = Object.assign({}, field);
2686
2705
  if (!field.assembly) return [3 /*break*/, 2];
2687
2706
  if (field.applied == null) {
2688
- throw new LrBadRequestException('If you request for field "assembly" in the TpPasswordResetNode, then you must also request the "applied" field');
2707
+ throw new KcBadRequestException('If you request for field "assembly" in the TpPasswordResetNode, then you must also request the "applied" field');
2689
2708
  }
2690
2709
  _b = ret;
2691
2710
  return [4 /*yield*/, this.processTpAssemblyNode(field.assembly, field.applied)];
@@ -2991,7 +3010,7 @@
2991
3010
  var _this = this;
2992
3011
  return __generator(this, function (_a) {
2993
3012
  if (field === null || field === void 0 ? void 0 : field.then) {
2994
- throw new LrBadLogicException('processField() should not receive thenable.');
3013
+ throw new KcBadLogicException('processField() should not receive thenable.');
2995
3014
  }
2996
3015
  if (field == null) {
2997
3016
  return [2 /*return*/, null];
@@ -3056,7 +3075,7 @@
3056
3075
  };
3057
3076
  QueryProcessorService.prototype.registerProcessor = function (name, processor) {
3058
3077
  if (this.processors[name]) {
3059
- throw new LrBadLogicException("Processor for field " + name + " already exists.");
3078
+ throw new KcBadLogicException("Processor for field " + name + " already exists.");
3060
3079
  }
3061
3080
  this.processors[name] = processor;
3062
3081
  };
@@ -3167,7 +3186,7 @@
3167
3186
  });
3168
3187
  LrMutationBase.prototype.setExecuted = function () {
3169
3188
  if (this._executed) {
3170
- throw new LrBadStateException('Already executed');
3189
+ throw new KcBadStateException('Already executed');
3171
3190
  }
3172
3191
  this._executed = true;
3173
3192
  };
@@ -3297,7 +3316,7 @@
3297
3316
  var ret = new Set();
3298
3317
  var addOrThrow = function (item) {
3299
3318
  if (ret.has(item)) {
3300
- throw new LrBadLogicException('Classes that are derived from LrMutationBase can not be used more than once in a merged mutation.');
3319
+ throw new KcBadLogicException('Classes that are derived from LrMutationBase can not be used more than once in a merged mutation.');
3301
3320
  }
3302
3321
  ret.add(item);
3303
3322
  };
@@ -3309,7 +3328,7 @@
3309
3328
  lrMutation.descendants.forEach(function (t) { return addOrThrow(t); });
3310
3329
  }
3311
3330
  else {
3312
- throw new LrUnsupportedException("LrMergeMutation can not handle class: " + lrMutation.constructor.name);
3331
+ throw new KcUnsupportedException("LrMergeMutation can not handle class: " + lrMutation.constructor.name);
3313
3332
  }
3314
3333
  });
3315
3334
  return ret;
@@ -3528,10 +3547,10 @@
3528
3547
  return __awaiter(this, void 0, void 0, function () {
3529
3548
  return __generator(this, function (_a) {
3530
3549
  if (options === null || options === void 0 ? void 0 : options.variables) {
3531
- throw new LrUnsupportedException('Unsupported field: "options.variables"');
3550
+ throw new KcUnsupportedException('Unsupported field: "options.variables"');
3532
3551
  }
3533
3552
  if (lrMutation.executed) {
3534
- throw new LrBadStateException('LrMutation has already executed. LrMutation can only be used once in a lrMutate() call. Create new instances of LrMutation.');
3553
+ throw new KcBadStateException('LrMutation has already executed. LrMutation can only be used once in a lrMutate() call. Create new instances of LrMutation.');
3535
3554
  }
3536
3555
  lrMutation.setExecuted();
3537
3556
  return [2 /*return*/, this.apolloMutate(Object.assign(Object.assign({}, options), lrMutation.lrMutationData))
@@ -3855,15 +3874,6 @@
3855
3874
  }
3856
3875
  return CognitoChallengeUser;
3857
3876
  }(Auth.CognitoUser));
3858
- (function (FeatureAction) {
3859
- // Just the one for now
3860
- FeatureAction["ACCESS"] = "access";
3861
- })(exports.FeatureAction || (exports.FeatureAction = {}));
3862
- var Features = /** @class */ (function () {
3863
- function Features() {
3864
- }
3865
- return Features;
3866
- }());
3867
3877
  var CurrentUser = /** @class */ (function () {
3868
3878
  function CurrentUser() {
3869
3879
  }
@@ -3905,7 +3915,7 @@
3905
3915
  }
3906
3916
  IdleService.prototype.assertInit = function () {
3907
3917
  if (!this.initCalled) {
3908
- throw new LrBadStateException('Call IdleService.init() first.');
3918
+ throw new KcBadStateException('Call IdleService.init() first.');
3909
3919
  }
3910
3920
  };
3911
3921
  IdleService.prototype.init = function (params) {
@@ -3916,14 +3926,14 @@
3916
3926
  switch (_a.label) {
3917
3927
  case 0:
3918
3928
  if (this.initCalled) {
3919
- throw new LrBadStateException('IdleService.init() can only be called once. IdleService.start() calls init() with default values if init() has not been called yet.');
3929
+ throw new KcBadStateException('IdleService.init() can only be called once. IdleService.start() calls init() with default values if init() has not been called yet.');
3920
3930
  }
3921
3931
  this.initCalled = true;
3922
3932
  // Defaults
3923
3933
  params = Object.assign({ onTimeout: null, onKeepalive: null, idleSec: exports.Config.IDLE, timeoutSec: exports.Config.TIMEOUT, keepAliveIntervalSec: exports.Config.KEEP_ALIVE_INTERVAL }, params);
3924
3934
  // If timeoutSec == 0 then the onTimeout() callback is never called.
3925
3935
  if (params.timeoutSec < 0.01) {
3926
- throw new LrBadArgumentException('Minimum value for IdleService.init({ timeoutSec }) is 0.01');
3936
+ throw new KcBadArgumentException('Minimum value for IdleService.init({ timeoutSec }) is 0.01');
3927
3937
  }
3928
3938
  this.onTimeout = params.onTimeout;
3929
3939
  this.onKeepalive = params.onKeepalive;
@@ -4551,7 +4561,7 @@
4551
4561
  switch (_b.label) {
4552
4562
  case 0:
4553
4563
  if (planPeriodEnd == null && planPeriodEndAfterSeconds == null) {
4554
- throw new LrBadArgumentException('Must specify either "planPeriodEnd" or "planPeriodEndAfterSeconds"');
4564
+ throw new KcBadArgumentException('Must specify either "planPeriodEnd" or "planPeriodEndAfterSeconds"');
4555
4565
  }
4556
4566
  return [4 /*yield*/, this.lrApollo.mutate({
4557
4567
  mutation: CreateUserIssuedPlanMutation,
@@ -4706,6 +4716,15 @@
4706
4716
  var UpdateContactCardMutation$1 = gql__default['default'](templateObject_3$4 || (templateObject_3$4 = __makeTemplateObject(["\n mutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n key {\n id\n }\n cipherData\n }\n }\n }\n"], ["\n mutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n key {\n id\n }\n cipherData\n }\n }\n }\n"])));
4707
4717
  var templateObject_1$7, templateObject_2$5, templateObject_3$4;
4708
4718
 
4719
+ (function (FeatureAction) {
4720
+ // Just the one for now
4721
+ FeatureAction["ACCESS"] = "access";
4722
+ })(exports.FeatureAction || (exports.FeatureAction = {}));
4723
+ var Features = /** @class */ (function () {
4724
+ function Features() {
4725
+ }
4726
+ return Features;
4727
+ }());
4709
4728
  var CurrentUserKey = /** @class */ (function () {
4710
4729
  function CurrentUserKey() {
4711
4730
  }
@@ -5266,7 +5285,7 @@
5266
5285
  return [2 /*return*/, KeyFactoryService.asKey(prkJson)];
5267
5286
  case 2:
5268
5287
  error_1 = _a.sent();
5269
- throw new LrAuthException('Wrong current password');
5288
+ throw new KcAuthException('Wrong current password');
5270
5289
  case 3: return [2 /*return*/];
5271
5290
  }
5272
5291
  });
@@ -5669,7 +5688,7 @@
5669
5688
  if (assemblyKeyParams) {
5670
5689
  if (JSON.stringify(assemblyKeyParams) !==
5671
5690
  JSON.stringify(partial.assemblyKeyParams)) {
5672
- throw new LrBadStateException('The assembly key parameters are different between the approvals.');
5691
+ throw new KcBadStateException('The assembly key parameters are different between the approvals.');
5673
5692
  }
5674
5693
  }
5675
5694
  else {
@@ -5775,7 +5794,7 @@
5775
5794
  var _this = this;
5776
5795
  return __generator(this, function (_c) {
5777
5796
  if (slipSubAssemblies.length !== input.length) {
5778
- throw new LrBadArgumentException('The slipSubAssemblies must be the same length as the input');
5797
+ throw new KcBadArgumentException('The slipSubAssemblies must be the same length as the input');
5779
5798
  }
5780
5799
  return [2 /*return*/, Promise.all(input.map(function (sa, saIndex) { return __awaiter(_this, void 0, void 0, function () {
5781
5800
  var subjectCipherData, existingSa, createApprovers, updateApprovers, slipSubAssembly, _c;
@@ -5949,7 +5968,7 @@
5949
5968
  if (createSubAssembliesInput.length === 0 &&
5950
5969
  updateSubAssembliesInput.length === 0 &&
5951
5970
  deleteSubAssembliesInput.length === 0) {
5952
- throw new LrBadArgumentException('Must specify at least one of: [createSubAssemblies, updateSubAssemblies, deleteSubAssemblies]');
5971
+ throw new KcBadArgumentException('Must specify at least one of: [createSubAssemblies, updateSubAssemblies, deleteSubAssemblies]');
5953
5972
  }
5954
5973
  return [4 /*yield*/, this.keyService.getCurrentRootKey()];
5955
5974
  case 1:
@@ -6104,7 +6123,7 @@
6104
6123
  if (!tp.currentUserSharedKey.userSharedKey.mkSharedKey) {
6105
6124
  var msg = "tp " + tp.other.username + " does not have mkSharedKey";
6106
6125
  console.log(msg);
6107
- throw new LrBadArgumentException(msg);
6126
+ throw new KcBadArgumentException(msg);
6108
6127
  }
6109
6128
  }
6110
6129
  }
@@ -6125,7 +6144,7 @@
6125
6144
  case 0:
6126
6145
  // Is there enough sub assemblies to meet quorum
6127
6146
  if (subAssemblies.length < assemblyQuorum) {
6128
- throw new LrBadArgumentException('Not enough sub assemblies to meet quorum');
6147
+ throw new KcBadArgumentException('Not enough sub assemblies to meet quorum');
6129
6148
  }
6130
6149
  slipAssembly = new Assembly(assemblyQuorum);
6131
6150
  subAssemblies.forEach(function (sa, index) {
@@ -6226,7 +6245,7 @@
6226
6245
  this.logoutListeners = new Set();
6227
6246
  if (!i0.isDevMode()) {
6228
6247
  if (this.config.debug != null) {
6229
- throw new LrBadLogicException('In production mode, "config.debug" must be set to null');
6248
+ throw new KcBadRequestException('In production mode, "config.debug" must be set to null');
6230
6249
  }
6231
6250
  }
6232
6251
  }
@@ -6352,7 +6371,7 @@
6352
6371
  case 1:
6353
6372
  passIdpApiResult = _b.sent();
6354
6373
  if (passIdpApiResult.passwordChangeStatus === exports.PasswordChangeStatus.InProgress) {
6355
- throw new LrConcurrentAccessException('A password change is in progress');
6374
+ throw new KcConcurrentAccessException('A password change is in progress');
6356
6375
  }
6357
6376
  if (!(passIdpApiResult.passwordChangeStatus === exports.PasswordChangeStatus.Recovery)) return [3 /*break*/, 8];
6358
6377
  console.log('In recovery mode.');
@@ -6386,7 +6405,7 @@
6386
6405
  error_2 = _b.sent();
6387
6406
  // Just bubble up any other type of error.
6388
6407
  throw error_2.code === 'NotAuthorizedException'
6389
- ? new LrBadRequestException('The password change request was interrupted, please try to login with both your new and old password')
6408
+ ? new KcBadRequestException('The password change request was interrupted, please try to login with both your new and old password')
6390
6409
  : error_2;
6391
6410
  case 8:
6392
6411
  if (!passIdpApiResult.tpPasswordReset) return [3 /*break*/, 12];
@@ -6814,7 +6833,7 @@
6814
6833
  case 1:
6815
6834
  resetUser = _b.sent();
6816
6835
  if (resetUser.state !== exports.TpClaimState.APPROVED) {
6817
- throw new LrBadStateException('Password reset request has not been approved.');
6836
+ throw new KcBadStateException('Password reset request has not been approved.');
6818
6837
  }
6819
6838
  return [4 /*yield*/, this.recoverAssemblyKey(resetUser)];
6820
6839
  case 2:
@@ -6904,9 +6923,7 @@
6904
6923
  case 12:
6905
6924
  user = _b.sent();
6906
6925
  if (user.challengeName !== 'NEW_PASSWORD_REQUIRED') {
6907
- throw new LrException({
6908
- message: 'Internal error. Expecting Cognito to have done a password reset after call to PreCompleteTpPasswordResetRequestMutation.',
6909
- });
6926
+ throw new KcInternalErrorException('Expecting Cognito to have done a password reset after call to PreCompleteTpPasswordResetRequestMutation.');
6910
6927
  }
6911
6928
  return [4 /*yield*/, this.auth.completeNewPassword(user, newIdpPassword, {})];
6912
6929
  case 13:
@@ -7040,7 +7057,7 @@
7040
7057
  case 2:
7041
7058
  defaultVaults = _b.sent();
7042
7059
  if (defaultVaults.length > 1) {
7043
- throw new LrBadStateException('There are more than one default vaults');
7060
+ throw new KcBadStateException('There are more than one default vaults');
7044
7061
  }
7045
7062
  return [2 /*return*/, defaultVaults[0] || null];
7046
7063
  }
@@ -8759,7 +8776,7 @@
8759
8776
  directoryKey = _d.sent();
8760
8777
  options.parentDirectories = options.parentDirectories || [];
8761
8778
  if (!options.asRootDirectory && !((_a = options.parentDirectories) === null || _a === void 0 ? void 0 : _a.length)) {
8762
- throw new LrBadArgumentException('A new directory must be either a root directory or a sub-directory. So you must provide either parentDirectories and/or asRootDirectory parameter.');
8779
+ throw new KcBadArgumentException('A new directory must be either a root directory or a sub-directory. So you must provide either parentDirectories and/or asRootDirectory parameter.');
8763
8780
  }
8764
8781
  return [4 /*yield*/, Promise.all((_b = options.parentDirectories) === null || _b === void 0 ? void 0 : _b.map(function (t) { return _this.prepareParentDirectory(t, directoryKey); }))];
8765
8782
  case 2:
@@ -9521,7 +9538,7 @@
9521
9538
  plainInitiatorOneTimePbkCipher = _r.sent();
9522
9539
  // Check the nonce match to ensure the responder was the one holding the OTK
9523
9540
  if (plainInitiatorRootKeyCipher.nonce !== plainInitiatorOneTimePbkCipher.nonce) {
9524
- throw new LrCodeMismatchException('The nonce returned by responder does not match with the one created by the initiator.');
9541
+ throw new KcCodeMismatchException('The nonce returned by responder does not match with the one created by the initiator.');
9525
9542
  }
9526
9543
  return [4 /*yield*/, this.keyService.getCurrentSigPxk()];
9527
9544
  case 7:
@@ -10266,7 +10283,7 @@
10266
10283
  // Check the nonce match to ensure the responder was the one holding the OTK
10267
10284
  if (initiatorRootKeyCipherClearJson.nonce !==
10268
10285
  plainInitiatorOneTimePbkCipher.nonce) {
10269
- throw new LrCodeMismatchException('The nonce returned by responder does not match with the one created by the initiator.');
10286
+ throw new KcCodeMismatchException('The nonce returned by responder does not match with the one created by the initiator.');
10270
10287
  }
10271
10288
  return [4 /*yield*/, this.keyService.getCurrentSigPxk()];
10272
10289
  case 7:
@@ -10401,6 +10418,10 @@
10401
10418
  })
10402
10419
  ], exports.KeyExchange2Service);
10403
10420
 
10421
+ var ERROR_SOURCE = 'LBOP';
10422
+ (function (KcLbopErrorCode) {
10423
+ KcLbopErrorCode["INVALID_PASSPHRASE"] = "INVALID_PASSPHRASE";
10424
+ })(exports.KcLbopErrorCode || (exports.KcLbopErrorCode = {}));
10404
10425
  var CreateLbopQuery = gql__default['default'](templateObject_1$l || (templateObject_1$l = __makeTemplateObject(["\n mutation CreateLbop($input: CreateLbopInput!) {\n createLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"], ["\n mutation CreateLbop($input: CreateLbopInput!) {\n createLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"])));
10405
10426
  var DeleteLbopQuery = gql__default['default'](templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n mutation DeleteLbop($input: DeleteLbopInput!) {\n deleteLbop(input: $input) {\n id\n }\n }\n"], ["\n mutation DeleteLbop($input: DeleteLbopInput!) {\n deleteLbop(input: $input) {\n id\n }\n }\n"])));
10406
10427
  var UpdateLbopQuery = gql__default['default'](templateObject_3$g || (templateObject_3$g = __makeTemplateObject(["\n mutation UpdateLbop($input: UpdateLbopInput!) {\n updateLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"], ["\n mutation UpdateLbop($input: UpdateLbopInput!) {\n updateLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"])));
@@ -10538,7 +10559,7 @@
10538
10559
  switch (_f.label) {
10539
10560
  case 0:
10540
10561
  if (slip39.Slip39Helper.WORD_LIST.length !== 1024) {
10541
- throw new LrBadLogicException('Slip39Helper.WORD_LIST.length != 1024');
10562
+ throw new KcBadLogicException('Slip39Helper.WORD_LIST.length != 1024');
10542
10563
  }
10543
10564
  return [4 /*yield*/, this.list()];
10544
10565
  case 1:
@@ -10681,11 +10702,11 @@
10681
10702
  }
10682
10703
  finally { if (e_1) throw e_1.error; }
10683
10704
  return [7 /*endfinally*/];
10684
- case 13: throw new LrException({
10685
- source: 'LBOP',
10686
- code: 'INVALID_PASSPHRASE',
10705
+ case 13: throw new KcException(new KcError({
10706
+ source: ERROR_SOURCE,
10707
+ code: exports.KcLbopErrorCode.INVALID_PASSPHRASE,
10687
10708
  message: 'Invalid passphrase.',
10688
- });
10709
+ }));
10689
10710
  }
10690
10711
  });
10691
10712
  });
@@ -10789,9 +10810,7 @@
10789
10810
  case 4:
10790
10811
  user = _a.sent();
10791
10812
  if (user.challengeName !== 'NEW_PASSWORD_REQUIRED') {
10792
- throw new LrException({
10793
- message: 'Internal error. Expecting Cognito to have done a password reset.',
10794
- });
10813
+ throw new KcInternalErrorException('Expecting Cognito to have done a password reset.');
10795
10814
  }
10796
10815
  return [4 /*yield*/, this.auth.completeNewPassword(user, this.passwordService.getPassIdpString(passKeyBundle.passIdp), {})];
10797
10816
  case 5:
@@ -13193,10 +13212,10 @@
13193
13212
  var templateObject_1$s, templateObject_2$o;
13194
13213
 
13195
13214
  function throwClaimIdMismatch() {
13196
- throw new LrBadArgumentException('claimId does not match with the current claimId of the scenario');
13215
+ throw new KcBadArgumentException('claimId does not match with the current claimId of the scenario');
13197
13216
  }
13198
13217
  function throwClaimNotApproved() {
13199
- throw new LrBadStateException('Scenario claim has not been approved');
13218
+ throw new KcBadStateException('Scenario claim has not been approved');
13200
13219
  }
13201
13220
  exports.ScenarioService = /** @class */ (function (_super) {
13202
13221
  __extends(ScenarioService, _super);
@@ -14324,7 +14343,7 @@
14324
14343
  TpPasswordResetRequestService.prototype.activeRequestOrRaise = function (sharedReset) {
14325
14344
  var state = sharedReset.sharedRequest.claim.state;
14326
14345
  if (state !== exports.TpAssemblyState.CLAIMED) {
14327
- throw new LrBadStateException("Claim is already in " + state + " state.");
14346
+ throw new KcBadStateException("Claim is already in " + state + " state.");
14328
14347
  }
14329
14348
  };
14330
14349
  TpPasswordResetRequestService.prototype.rejectRequest = function (sharedResetId) {
@@ -14452,7 +14471,7 @@
14452
14471
  */
14453
14472
  function clearLocalStorage(prefix) {
14454
14473
  if (!prefix) {
14455
- throw new LrBadArgumentException('You must specify a non empty prefix.');
14474
+ throw new KcBadArgumentException('You must specify a non empty prefix.');
14456
14475
  }
14457
14476
  // Remove all persisted session variables
14458
14477
  Object.keys(localStorage).forEach(function (key) {
@@ -14878,7 +14897,7 @@
14878
14897
  case 1:
14879
14898
  userSharedKey = _a.sent();
14880
14899
  if (userSharedKey.mkSharedKey) {
14881
- throw new LrBadStateException('TP already has mkSharedKey');
14900
+ throw new KcBadStateException('TP already has mkSharedKey');
14882
14901
  }
14883
14902
  return [4 /*yield*/, this.keyService.getCurrentMasterKey()];
14884
14903
  case 2:
@@ -14924,7 +14943,7 @@
14924
14943
  case 1:
14925
14944
  userSharedKey = _d.sent();
14926
14945
  if (!userSharedKey.mkSharedKey) {
14927
- throw new LrBadStateException('No access to the mkSharedKey so cannot reshare it with TP');
14946
+ throw new KcBadStateException('No access to the mkSharedKey so cannot reshare it with TP');
14928
14947
  }
14929
14948
  return [4 /*yield*/, this.keyGraph.getKey(userSharedKey.sharedKey.id)];
14930
14949
  case 2:
@@ -15147,7 +15166,7 @@
15147
15166
  code = _b.sent();
15148
15167
  email = userInfo.attributes.email;
15149
15168
  if (!email) {
15150
- throw new LrBadArgumentException('No email associated with user.');
15169
+ throw new KcBadArgumentException('No email associated with user.');
15151
15170
  }
15152
15171
  return [2 /*return*/, {
15153
15172
  code: code,
@@ -15229,6 +15248,7 @@
15229
15248
  exports.DeleteLbopQuery = DeleteLbopQuery;
15230
15249
  exports.DeleteRecordMutation = DeleteRecordMutation;
15231
15250
  exports.DirectoryQuery = DirectoryQuery;
15251
+ exports.ERROR_SOURCE = ERROR_SOURCE;
15232
15252
  exports.Features = Features;
15233
15253
  exports.FetchKeyGraphField = FetchKeyGraphField;
15234
15254
  exports.FileQuery = FileQuery;
@@ -15244,6 +15264,23 @@
15244
15264
  exports.IdleService = IdleService;
15245
15265
  exports.InitiateOtkMutation = InitiateOtkMutation;
15246
15266
  exports.KC_CONFIG = KC_CONFIG;
15267
+ exports.KcAuthException = KcAuthException;
15268
+ exports.KcBadArgumentException = KcBadArgumentException;
15269
+ exports.KcBadLogicException = KcBadLogicException;
15270
+ exports.KcBadRequestException = KcBadRequestException;
15271
+ exports.KcBadSignatureException = KcBadSignatureException;
15272
+ exports.KcBadStateException = KcBadStateException;
15273
+ exports.KcBadTimeSyncException = KcBadTimeSyncException;
15274
+ exports.KcCodeMismatchException = KcCodeMismatchException;
15275
+ exports.KcConcurrentAccessException = KcConcurrentAccessException;
15276
+ exports.KcEncryptionException = KcEncryptionException;
15277
+ exports.KcError = KcError;
15278
+ exports.KcException = KcException;
15279
+ exports.KcInternalErrorException = KcInternalErrorException;
15280
+ exports.KcLockedException = KcLockedException;
15281
+ exports.KcNotFoundException = KcNotFoundException;
15282
+ exports.KcSuspiciousOperationException = KcSuspiciousOperationException;
15283
+ exports.KcUnsupportedException = KcUnsupportedException;
15247
15284
  exports.KeyExchangeFields = KeyExchangeFields;
15248
15285
  exports.KeyExchangeQuery = KeyExchangeQuery;
15249
15286
  exports.KeyExchangeService = KeyExchangeService;
@@ -15260,28 +15297,12 @@
15260
15297
  exports.LoginHistoryQuery = LoginHistoryQuery;
15261
15298
  exports.LoginResult = LoginResult;
15262
15299
  exports.LrApolloService = LrApolloService;
15263
- exports.LrAuthException = LrAuthException;
15264
- exports.LrBadArgumentException = LrBadArgumentException;
15265
- exports.LrBadLogicException = LrBadLogicException;
15266
- exports.LrBadRequestException = LrBadRequestException;
15267
- exports.LrBadStateException = LrBadStateException;
15268
- exports.LrCodeMismatchException = LrCodeMismatchException;
15269
- exports.LrConcurrentAccessException = LrConcurrentAccessException;
15270
- exports.LrEncryptionException = LrEncryptionException;
15271
- exports.LrError = LrError;
15272
- exports.LrException = LrException;
15273
- exports.LrExpiredCodeException = LrExpiredCodeException;
15274
- exports.LrExpiredException = LrExpiredException;
15275
15300
  exports.LrGraphQLService = exports.ɵf;
15276
- exports.LrLockedException = LrLockedException;
15277
15301
  exports.LrMergedMutation = LrMergedMutation;
15278
15302
  exports.LrMutation = LrMutation;
15279
15303
  exports.LrMutationBase = LrMutationBase;
15280
- exports.LrNotFoundException = LrNotFoundException;
15281
15304
  exports.LrRecord = LrRecord;
15282
15305
  exports.LrService = LrService;
15283
- exports.LrSuspiciousException = LrSuspiciousException;
15284
- exports.LrUnsupportedException = LrUnsupportedException;
15285
15306
  exports.MainContactCard = MainContactCard;
15286
15307
  exports.MainContactCardFields = MainContactCardFields;
15287
15308
  exports.MainContactCardPlainFields = MainContactCardPlainFields;
@@ -15351,6 +15372,7 @@
15351
15372
  exports.gqlTyped = gqlTyped;
15352
15373
  exports.handleApolloError = handleApolloError;
15353
15374
  exports.handleCognitoCallback = handleCognitoCallback;
15375
+ exports.httpOptions = httpOptions;
15354
15376
  exports.initialiseAuth = initialiseAuth;
15355
15377
  exports.mapEdges = mapEdges;
15356
15378
  exports.mapUserPlans = mapUserPlans;