@lifeready/core 8.0.11 → 8.0.12

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.
@@ -2,11 +2,14 @@ import { __awaiter, __decorate, __rest } from 'tslib';
2
2
  import { ɵɵdefineInjectable, ɵɵinject, Injectable, InjectionToken, isDevMode, INJECTOR, Injector, Inject, NgZone, APP_INITIALIZER, NgModule } from '@angular/core';
3
3
  import { Apollo, APOLLO_OPTIONS } from 'apollo-angular';
4
4
  import graphlib, { Graph } from '@dagrejs/graphlib';
5
- import _, { cloneDeep } from 'lodash';
6
5
  import { JWE, JWS, JWK } from 'node-jose';
7
6
  import { AuthClass } from '@aws-amplify/auth/lib-esm/Auth';
8
7
  import gql from 'graphql-tag';
9
8
  import * as moment_ from 'moment';
9
+ import lodash$1 from 'lodash/cloneDeep';
10
+ import lodash$2 from 'lodash/isEqual';
11
+ import 'lodash/keyBy';
12
+ import lodash from 'lodash/omit';
10
13
  import { ApolloLink, createHttpLink, from, InMemoryCache } from '@apollo/client/core';
11
14
  import { setContext } from '@apollo/client/link/context';
12
15
  import { RetryLink } from '@apollo/client/link/retry';
@@ -35,6 +38,8 @@ var PayloadType;
35
38
  PayloadType["UINT_8_ARRAY"] = "UINT_8_ARRAY";
36
39
  })(PayloadType || (PayloadType = {}));
37
40
 
41
+ // This file is in the "lr-lodash" directory so that we can use the barrel file
42
+
38
43
  function handleApolloError(errors) {
39
44
  if (!errors || !errors.length)
40
45
  return;
@@ -42,6 +47,7 @@ function handleApolloError(errors) {
42
47
  return new KcError({
43
48
  code: x.extensions && x.extensions.code,
44
49
  source: x.extensions && x.extensions.source,
50
+ data: x.extensions && lodash(x.extensions, ['code', 'source']),
45
51
  message: x.message,
46
52
  debug: {
47
53
  locations: x.locations,
@@ -69,6 +75,7 @@ class KcError {
69
75
  this._type = 'KcError';
70
76
  this.code = options.code;
71
77
  this.source = options.source;
78
+ this.data = options.data;
72
79
  this.message = options.message;
73
80
  this.debug = options.debug;
74
81
  }
@@ -1283,7 +1290,7 @@ class KeyGraphService {
1283
1290
  }
1284
1291
  const node = {
1285
1292
  type: KeyGraphNodeType.Key,
1286
- data: _.cloneDeep(key),
1293
+ data: lodash$1(key),
1287
1294
  };
1288
1295
  this.graph.setNode(key.id, node);
1289
1296
  }
@@ -1296,7 +1303,7 @@ class KeyGraphService {
1296
1303
  }
1297
1304
  const edge = {
1298
1305
  type: KeyGraphEdgeType.KeyLink,
1299
- data: _.cloneDeep(keyLink),
1306
+ data: lodash$1(keyLink),
1300
1307
  };
1301
1308
  // Edge goes from wrapping key to wrapped key.
1302
1309
  this.graph.setEdge(keyLink.wrappingKeyId, keyLink.keyId, edge);
@@ -1310,7 +1317,7 @@ class KeyGraphService {
1310
1317
  }
1311
1318
  const edge = {
1312
1319
  type: KeyGraphEdgeType.PassKeyLink,
1313
- data: _.cloneDeep(passKeyLink),
1320
+ data: lodash$1(passKeyLink),
1314
1321
  };
1315
1322
  // Edge goes from wrapping key to wrapped key.
1316
1323
  this.graph.setEdge(passKeyLink.passKeyId, passKeyLink.keyId, edge);
@@ -2313,7 +2320,7 @@ class LrMutation extends LrMutationBase {
2313
2320
  */
2314
2321
  select(fragments) {
2315
2322
  // Don't touch the original
2316
- const mutationDoc = cloneDeep(this.mutation);
2323
+ const mutationDoc = lodash$1(this.mutation);
2317
2324
  const mutationNode = getMutation(mutationDoc);
2318
2325
  const fragmentMap = {};
2319
2326
  getFragments(fragments).forEach((fragment) => {
@@ -2541,7 +2548,7 @@ class LrMergedMutation extends LrMutationBase {
2541
2548
  ...this.renameFragmentDefinitions(fragments, prefix),
2542
2549
  ];
2543
2550
  });
2544
- const mergedMutation = cloneDeep(lrMergedMutationDoc);
2551
+ const mergedMutation = lodash$1(lrMergedMutationDoc);
2545
2552
  const mutationNode = getMutation(mergedMutation);
2546
2553
  // Add in the mutation selections
2547
2554
  mutationNode.selectionSet.selections = selections;
@@ -2587,7 +2594,7 @@ let LrGraphQLService = class LrGraphQLService {
2587
2594
  query(options) {
2588
2595
  return __awaiter(this, void 0, void 0, function* () {
2589
2596
  // Make copies to avoid side effect.
2590
- options = cloneDeep(options);
2597
+ options = lodash$1(options);
2591
2598
  // Append the key graph query
2592
2599
  const includeKeyGraph = this.isIncludeKeyGraph(options.includeKeyGraph);
2593
2600
  if (includeKeyGraph) {
@@ -2637,7 +2644,7 @@ let LrGraphQLService = class LrGraphQLService {
2637
2644
  apolloMutate(options) {
2638
2645
  return __awaiter(this, void 0, void 0, function* () {
2639
2646
  // Make copies to avoid side effect.
2640
- options = Object.assign(Object.assign({}, options), { mutation: cloneDeep(options.mutation) });
2647
+ options = Object.assign(Object.assign({}, options), { mutation: lodash$1(options.mutation) });
2641
2648
  // Append the key graph query
2642
2649
  const includeKeyGraph = this.isIncludeKeyGraph(options.includeKeyGraph);
2643
2650
  if (includeKeyGraph) {
@@ -2667,7 +2674,7 @@ let LrGraphQLService = class LrGraphQLService {
2667
2674
  });
2668
2675
  }
2669
2676
  statsSnapshot() {
2670
- return cloneDeep(this.stats);
2677
+ return lodash$1(this.stats);
2671
2678
  }
2672
2679
  addKeys(response) {
2673
2680
  if (response.data.keyGraph) {
@@ -5525,10 +5532,17 @@ let AuthService = AuthService_1 = class AuthService extends LrService {
5525
5532
  // Debug utilities
5526
5533
  // ------------------------------------------------------
5527
5534
  debugLogin(username, password) {
5528
- // This will fail if debug is null. But when debug is null, this function
5529
- // should not be called.
5530
- this.kcConfig.debug.username = username;
5531
- return this.debugLoadUser(password);
5535
+ return __awaiter(this, void 0, void 0, function* () {
5536
+ // This will fail if debug is null. But when debug is null, this function
5537
+ // should not be called.
5538
+ this.kcConfig.debug.username = username;
5539
+ // This mechanism only works in a browser session because it needs to set cookies etc.
5540
+ // But it sets the last_login field for the users which we need in some tests.
5541
+ yield this.http
5542
+ .get(`${this.kcConfig.authUrl}debug_only/users/login/?username=${encodeURIComponent(username)}`)
5543
+ .toPromise();
5544
+ return this.debugLoadUser(password);
5545
+ });
5532
5546
  }
5533
5547
  debugLoadUser(password) {
5534
5548
  return __awaiter(this, void 0, void 0, function* () {
@@ -8117,7 +8131,7 @@ class ProfileDetailsService {
8117
8131
  oldValue: oldValue.value,
8118
8132
  });
8119
8133
  }
8120
- else if (!_.isEqual(newValue.value, oldValue.value)) {
8134
+ else if (!lodash$2(newValue.value, oldValue.value)) {
8121
8135
  changes.push({
8122
8136
  field,
8123
8137
  id: oldValue.id,
@@ -8158,7 +8172,7 @@ class ProfileDetailsService {
8158
8172
  break;
8159
8173
  default: {
8160
8174
  const value = details[change.field];
8161
- if (_.isEqual(value, change.oldValue)) {
8175
+ if (lodash$2(value, change.oldValue)) {
8162
8176
  hasChanged = true;
8163
8177
  details[change.field] = change.newValue;
8164
8178
  }
@@ -8175,7 +8189,7 @@ class ProfileDetailsService {
8175
8189
  property = property || { value: field, hasMultiple: false };
8176
8190
  property.values = property.values || [];
8177
8191
  if (property.values.length === 0 ||
8178
- property.values.every((x) => !_.isEqual(field, x.value))) {
8192
+ property.values.every((x) => !lodash$2(field, x.value))) {
8179
8193
  property.values.push({
8180
8194
  id: `${label}-${new Date().getTime()}`,
8181
8195
  label,
@@ -9031,6 +9045,7 @@ let ScenarioService = class ScenarioService extends LrService {
9031
9045
  const createClaimants = yield Promise.all(createClaimantsOptions.map((x) => this.prepareCreateClaimant(x)));
9032
9046
  return {
9033
9047
  enabled: options.enabled,
9048
+ inactiveSeconds: options.inactiveSeconds,
9034
9049
  createAssembly,
9035
9050
  createReceivers,
9036
9051
  createClaimants,
@@ -9084,6 +9099,7 @@ let ScenarioService = class ScenarioService extends LrService {
9084
9099
  return {
9085
9100
  scenarioId: options.scenarioId,
9086
9101
  enabled: options.enabled,
9102
+ inactiveSeconds: options.inactiveSeconds,
9087
9103
  updateAssembly,
9088
9104
  createReceivers,
9089
9105
  updateReceivers,