@magda/auth-api-client 1.2.1-alpha.0 → 1.2.2-alpha.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.
Files changed (2) hide show
  1. package/dist/index.js +127 -30
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -6021,14 +6021,15 @@ Request.prototype.clone = function() {
6021
6021
  var undefined;
6022
6022
 
6023
6023
  /** Used as the semantic version number. */
6024
- var VERSION = '4.17.15';
6024
+ var VERSION = '4.17.21';
6025
6025
 
6026
6026
  /** Used as the size to enable large array optimizations. */
6027
6027
  var LARGE_ARRAY_SIZE = 200;
6028
6028
 
6029
6029
  /** Error message constants. */
6030
6030
  var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
6031
- FUNC_ERROR_TEXT = 'Expected a function';
6031
+ FUNC_ERROR_TEXT = 'Expected a function',
6032
+ INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
6032
6033
 
6033
6034
  /** Used to stand-in for `undefined` hash values. */
6034
6035
  var HASH_UNDEFINED = '__lodash_hash_undefined__';
@@ -6161,10 +6162,11 @@ Request.prototype.clone = function() {
6161
6162
  var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
6162
6163
  reHasRegExpChar = RegExp(reRegExpChar.source);
6163
6164
 
6164
- /** Used to match leading and trailing whitespace. */
6165
- var reTrim = /^\s+|\s+$/g,
6166
- reTrimStart = /^\s+/,
6167
- reTrimEnd = /\s+$/;
6165
+ /** Used to match leading whitespace. */
6166
+ var reTrimStart = /^\s+/;
6167
+
6168
+ /** Used to match a single whitespace character. */
6169
+ var reWhitespace = /\s/;
6168
6170
 
6169
6171
  /** Used to match wrap detail comments. */
6170
6172
  var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
@@ -6174,6 +6176,18 @@ Request.prototype.clone = function() {
6174
6176
  /** Used to match words composed of alphanumeric characters. */
6175
6177
  var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
6176
6178
 
6179
+ /**
6180
+ * Used to validate the `validate` option in `_.template` variable.
6181
+ *
6182
+ * Forbids characters which could potentially change the meaning of the function argument definition:
6183
+ * - "()," (modification of function parameters)
6184
+ * - "=" (default value)
6185
+ * - "[]{}" (destructuring of function parameters)
6186
+ * - "/" (beginning of a comment)
6187
+ * - whitespace
6188
+ */
6189
+ var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
6190
+
6177
6191
  /** Used to match backslashes in property paths. */
6178
6192
  var reEscapeChar = /\\(\\)?/g;
6179
6193
 
@@ -7002,6 +7016,19 @@ Request.prototype.clone = function() {
7002
7016
  });
7003
7017
  }
7004
7018
 
7019
+ /**
7020
+ * The base implementation of `_.trim`.
7021
+ *
7022
+ * @private
7023
+ * @param {string} string The string to trim.
7024
+ * @returns {string} Returns the trimmed string.
7025
+ */
7026
+ function baseTrim(string) {
7027
+ return string
7028
+ ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
7029
+ : string;
7030
+ }
7031
+
7005
7032
  /**
7006
7033
  * The base implementation of `_.unary` without support for storing metadata.
7007
7034
  *
@@ -7335,6 +7362,21 @@ Request.prototype.clone = function() {
7335
7362
  : asciiToArray(string);
7336
7363
  }
7337
7364
 
7365
+ /**
7366
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
7367
+ * character of `string`.
7368
+ *
7369
+ * @private
7370
+ * @param {string} string The string to inspect.
7371
+ * @returns {number} Returns the index of the last non-whitespace character.
7372
+ */
7373
+ function trimmedEndIndex(string) {
7374
+ var index = string.length;
7375
+
7376
+ while (index-- && reWhitespace.test(string.charAt(index))) {}
7377
+ return index;
7378
+ }
7379
+
7338
7380
  /**
7339
7381
  * Used by `_.unescape` to convert HTML entities to characters.
7340
7382
  *
@@ -9728,8 +9770,21 @@ Request.prototype.clone = function() {
9728
9770
  * @returns {Array} Returns the new sorted array.
9729
9771
  */
9730
9772
  function baseOrderBy(collection, iteratees, orders) {
9773
+ if (iteratees.length) {
9774
+ iteratees = arrayMap(iteratees, function(iteratee) {
9775
+ if (isArray(iteratee)) {
9776
+ return function(value) {
9777
+ return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
9778
+ }
9779
+ }
9780
+ return iteratee;
9781
+ });
9782
+ } else {
9783
+ iteratees = [identity];
9784
+ }
9785
+
9731
9786
  var index = -1;
9732
- iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
9787
+ iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
9733
9788
 
9734
9789
  var result = baseMap(collection, function(value, key, collection) {
9735
9790
  var criteria = arrayMap(iteratees, function(iteratee) {
@@ -9986,6 +10041,10 @@ Request.prototype.clone = function() {
9986
10041
  var key = toKey(path[index]),
9987
10042
  newValue = value;
9988
10043
 
10044
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
10045
+ return object;
10046
+ }
10047
+
9989
10048
  if (index != lastIndex) {
9990
10049
  var objValue = nested[key];
9991
10050
  newValue = customizer ? customizer(objValue, key, nested) : undefined;
@@ -10138,11 +10197,14 @@ Request.prototype.clone = function() {
10138
10197
  * into `array`.
10139
10198
  */
10140
10199
  function baseSortedIndexBy(array, value, iteratee, retHighest) {
10141
- value = iteratee(value);
10142
-
10143
10200
  var low = 0,
10144
- high = array == null ? 0 : array.length,
10145
- valIsNaN = value !== value,
10201
+ high = array == null ? 0 : array.length;
10202
+ if (high === 0) {
10203
+ return 0;
10204
+ }
10205
+
10206
+ value = iteratee(value);
10207
+ var valIsNaN = value !== value,
10146
10208
  valIsNull = value === null,
10147
10209
  valIsSymbol = isSymbol(value),
10148
10210
  valIsUndefined = value === undefined;
@@ -11627,10 +11689,11 @@ Request.prototype.clone = function() {
11627
11689
  if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
11628
11690
  return false;
11629
11691
  }
11630
- // Assume cyclic values are equal.
11631
- var stacked = stack.get(array);
11632
- if (stacked && stack.get(other)) {
11633
- return stacked == other;
11692
+ // Check that cyclic values are equal.
11693
+ var arrStacked = stack.get(array);
11694
+ var othStacked = stack.get(other);
11695
+ if (arrStacked && othStacked) {
11696
+ return arrStacked == other && othStacked == array;
11634
11697
  }
11635
11698
  var index = -1,
11636
11699
  result = true,
@@ -11792,10 +11855,11 @@ Request.prototype.clone = function() {
11792
11855
  return false;
11793
11856
  }
11794
11857
  }
11795
- // Assume cyclic values are equal.
11796
- var stacked = stack.get(object);
11797
- if (stacked && stack.get(other)) {
11798
- return stacked == other;
11858
+ // Check that cyclic values are equal.
11859
+ var objStacked = stack.get(object);
11860
+ var othStacked = stack.get(other);
11861
+ if (objStacked && othStacked) {
11862
+ return objStacked == other && othStacked == object;
11799
11863
  }
11800
11864
  var result = true;
11801
11865
  stack.set(object, other);
@@ -15176,6 +15240,10 @@ Request.prototype.clone = function() {
15176
15240
  * // The `_.property` iteratee shorthand.
15177
15241
  * _.filter(users, 'active');
15178
15242
  * // => objects for ['barney']
15243
+ *
15244
+ * // Combining several predicates using `_.overEvery` or `_.overSome`.
15245
+ * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
15246
+ * // => objects for ['fred', 'barney']
15179
15247
  */
15180
15248
  function filter(collection, predicate) {
15181
15249
  var func = isArray(collection) ? arrayFilter : baseFilter;
@@ -15925,15 +15993,15 @@ Request.prototype.clone = function() {
15925
15993
  * var users = [
15926
15994
  * { 'user': 'fred', 'age': 48 },
15927
15995
  * { 'user': 'barney', 'age': 36 },
15928
- * { 'user': 'fred', 'age': 40 },
15996
+ * { 'user': 'fred', 'age': 30 },
15929
15997
  * { 'user': 'barney', 'age': 34 }
15930
15998
  * ];
15931
15999
  *
15932
16000
  * _.sortBy(users, [function(o) { return o.user; }]);
15933
- * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
16001
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
15934
16002
  *
15935
16003
  * _.sortBy(users, ['user', 'age']);
15936
- * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
16004
+ * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
15937
16005
  */
15938
16006
  var sortBy = baseRest(function(collection, iteratees) {
15939
16007
  if (collection == null) {
@@ -18477,7 +18545,7 @@ Request.prototype.clone = function() {
18477
18545
  if (typeof value != 'string') {
18478
18546
  return value === 0 ? value : +value;
18479
18547
  }
18480
- value = value.replace(reTrim, '');
18548
+ value = baseTrim(value);
18481
18549
  var isBinary = reIsBinary.test(value);
18482
18550
  return (isBinary || reIsOctal.test(value))
18483
18551
  ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
@@ -20808,11 +20876,11 @@ Request.prototype.clone = function() {
20808
20876
 
20809
20877
  // Use a sourceURL for easier debugging.
20810
20878
  // The sourceURL gets injected into the source that's eval-ed, so be careful
20811
- // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
20812
- // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
20879
+ // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
20880
+ // and escape the comment, thus injecting code that gets evaled.
20813
20881
  var sourceURL = '//# sourceURL=' +
20814
20882
  (hasOwnProperty.call(options, 'sourceURL')
20815
- ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
20883
+ ? (options.sourceURL + '').replace(/\s/g, ' ')
20816
20884
  : ('lodash.templateSources[' + (++templateCounter) + ']')
20817
20885
  ) + '\n';
20818
20886
 
@@ -20845,12 +20913,16 @@ Request.prototype.clone = function() {
20845
20913
 
20846
20914
  // If `variable` is not specified wrap a with-statement around the generated
20847
20915
  // code to add the data object to the top of the scope chain.
20848
- // Like with sourceURL, we take care to not check the option's prototype,
20849
- // as this configuration is a code injection vector.
20850
20916
  var variable = hasOwnProperty.call(options, 'variable') && options.variable;
20851
20917
  if (!variable) {
20852
20918
  source = 'with (obj) {\n' + source + '\n}\n';
20853
20919
  }
20920
+ // Throw an error if a forbidden character was found in `variable`, to prevent
20921
+ // potential command injection attacks.
20922
+ else if (reForbiddenIdentifierChars.test(variable)) {
20923
+ throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
20924
+ }
20925
+
20854
20926
  // Cleanup code by stripping empty strings.
20855
20927
  source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
20856
20928
  .replace(reEmptyStringMiddle, '$1')
@@ -20964,7 +21036,7 @@ Request.prototype.clone = function() {
20964
21036
  function trim(string, chars, guard) {
20965
21037
  string = toString(string);
20966
21038
  if (string && (guard || chars === undefined)) {
20967
- return string.replace(reTrim, '');
21039
+ return baseTrim(string);
20968
21040
  }
20969
21041
  if (!string || !(chars = baseToString(chars))) {
20970
21042
  return string;
@@ -20999,7 +21071,7 @@ Request.prototype.clone = function() {
20999
21071
  function trimEnd(string, chars, guard) {
21000
21072
  string = toString(string);
21001
21073
  if (string && (guard || chars === undefined)) {
21002
- return string.replace(reTrimEnd, '');
21074
+ return string.slice(0, trimmedEndIndex(string) + 1);
21003
21075
  }
21004
21076
  if (!string || !(chars = baseToString(chars))) {
21005
21077
  return string;
@@ -21553,6 +21625,9 @@ Request.prototype.clone = function() {
21553
21625
  * values against any array or object value, respectively. See `_.isEqual`
21554
21626
  * for a list of supported value comparisons.
21555
21627
  *
21628
+ * **Note:** Multiple values can be checked by combining several matchers
21629
+ * using `_.overSome`
21630
+ *
21556
21631
  * @static
21557
21632
  * @memberOf _
21558
21633
  * @since 3.0.0
@@ -21568,6 +21643,10 @@ Request.prototype.clone = function() {
21568
21643
  *
21569
21644
  * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
21570
21645
  * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
21646
+ *
21647
+ * // Checking for several possible values
21648
+ * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
21649
+ * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
21571
21650
  */
21572
21651
  function matches(source) {
21573
21652
  return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
@@ -21582,6 +21661,9 @@ Request.prototype.clone = function() {
21582
21661
  * `srcValue` values against any array or object value, respectively. See
21583
21662
  * `_.isEqual` for a list of supported value comparisons.
21584
21663
  *
21664
+ * **Note:** Multiple values can be checked by combining several matchers
21665
+ * using `_.overSome`
21666
+ *
21585
21667
  * @static
21586
21668
  * @memberOf _
21587
21669
  * @since 3.2.0
@@ -21598,6 +21680,10 @@ Request.prototype.clone = function() {
21598
21680
  *
21599
21681
  * _.find(objects, _.matchesProperty('a', 4));
21600
21682
  * // => { 'a': 4, 'b': 5, 'c': 6 }
21683
+ *
21684
+ * // Checking for several possible values
21685
+ * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
21686
+ * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
21601
21687
  */
21602
21688
  function matchesProperty(path, srcValue) {
21603
21689
  return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
@@ -21821,6 +21907,10 @@ Request.prototype.clone = function() {
21821
21907
  * Creates a function that checks if **all** of the `predicates` return
21822
21908
  * truthy when invoked with the arguments it receives.
21823
21909
  *
21910
+ * Following shorthands are possible for providing predicates.
21911
+ * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
21912
+ * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
21913
+ *
21824
21914
  * @static
21825
21915
  * @memberOf _
21826
21916
  * @since 4.0.0
@@ -21847,6 +21937,10 @@ Request.prototype.clone = function() {
21847
21937
  * Creates a function that checks if **any** of the `predicates` return
21848
21938
  * truthy when invoked with the arguments it receives.
21849
21939
  *
21940
+ * Following shorthands are possible for providing predicates.
21941
+ * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
21942
+ * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
21943
+ *
21850
21944
  * @static
21851
21945
  * @memberOf _
21852
21946
  * @since 4.0.0
@@ -21866,6 +21960,9 @@ Request.prototype.clone = function() {
21866
21960
  *
21867
21961
  * func(NaN);
21868
21962
  * // => false
21963
+ *
21964
+ * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
21965
+ * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
21869
21966
  */
21870
21967
  var overSome = createOver(arraySome);
21871
21968
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@magda/auth-api-client",
3
3
  "description": "MAGDA Auth API Client",
4
- "version": "1.2.1-alpha.0",
4
+ "version": "1.2.2-alpha.0",
5
5
  "scripts": {
6
6
  "prebuild": "rimraf dist tsconfig.tsbuildinfo",
7
7
  "build": "webpack && api-extractor run -l",
@@ -12,7 +12,7 @@
12
12
  "main": "dist/index.js",
13
13
  "types": "dist/index.d.ts",
14
14
  "devDependencies": {
15
- "@magda/typescript-common": "^1.2.1-alpha.0",
15
+ "@magda/typescript-common": "^1.2.2-alpha.0",
16
16
  "@microsoft/api-extractor": "^7.7.8",
17
17
  "ts-loader": "^6.2.1",
18
18
  "typescript": "^3.7.2",