@magda/org-tree 2.0.0-alpha.0 → 2.0.0-alpha.3
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.
|
@@ -103,6 +103,18 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
103
103
|
/* 4 */,
|
|
104
104
|
/* 5 */,
|
|
105
105
|
/* 6 */
|
|
106
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
107
|
+
|
|
108
|
+
"use strict";
|
|
109
|
+
|
|
110
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
111
|
+
const uuidRegEx = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
112
|
+
const isUuid = (id) => typeof id === "string" && uuidRegEx.test(id);
|
|
113
|
+
exports.default = isUuid;
|
|
114
|
+
//# sourceMappingURL=isUuid.js.map
|
|
115
|
+
|
|
116
|
+
/***/ }),
|
|
117
|
+
/* 7 */
|
|
106
118
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
107
119
|
|
|
108
120
|
"use strict";
|
|
@@ -602,7 +614,6 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
602
614
|
|
|
603
615
|
|
|
604
616
|
/***/ }),
|
|
605
|
-
/* 7 */,
|
|
606
617
|
/* 8 */,
|
|
607
618
|
/* 9 */
|
|
608
619
|
/***/ (function(module, exports, __webpack_require__) {
|
|
@@ -621,14 +632,15 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
621
632
|
var undefined;
|
|
622
633
|
|
|
623
634
|
/** Used as the semantic version number. */
|
|
624
|
-
var VERSION = '4.17.
|
|
635
|
+
var VERSION = '4.17.21';
|
|
625
636
|
|
|
626
637
|
/** Used as the size to enable large array optimizations. */
|
|
627
638
|
var LARGE_ARRAY_SIZE = 200;
|
|
628
639
|
|
|
629
640
|
/** Error message constants. */
|
|
630
641
|
var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
|
|
631
|
-
FUNC_ERROR_TEXT = 'Expected a function'
|
|
642
|
+
FUNC_ERROR_TEXT = 'Expected a function',
|
|
643
|
+
INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
|
|
632
644
|
|
|
633
645
|
/** Used to stand-in for `undefined` hash values. */
|
|
634
646
|
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
@@ -761,10 +773,11 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
761
773
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
|
|
762
774
|
reHasRegExpChar = RegExp(reRegExpChar.source);
|
|
763
775
|
|
|
764
|
-
/** Used to match leading
|
|
765
|
-
var
|
|
766
|
-
|
|
767
|
-
|
|
776
|
+
/** Used to match leading whitespace. */
|
|
777
|
+
var reTrimStart = /^\s+/;
|
|
778
|
+
|
|
779
|
+
/** Used to match a single whitespace character. */
|
|
780
|
+
var reWhitespace = /\s/;
|
|
768
781
|
|
|
769
782
|
/** Used to match wrap detail comments. */
|
|
770
783
|
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
|
|
@@ -774,6 +787,18 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
774
787
|
/** Used to match words composed of alphanumeric characters. */
|
|
775
788
|
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
776
789
|
|
|
790
|
+
/**
|
|
791
|
+
* Used to validate the `validate` option in `_.template` variable.
|
|
792
|
+
*
|
|
793
|
+
* Forbids characters which could potentially change the meaning of the function argument definition:
|
|
794
|
+
* - "()," (modification of function parameters)
|
|
795
|
+
* - "=" (default value)
|
|
796
|
+
* - "[]{}" (destructuring of function parameters)
|
|
797
|
+
* - "/" (beginning of a comment)
|
|
798
|
+
* - whitespace
|
|
799
|
+
*/
|
|
800
|
+
var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
|
|
801
|
+
|
|
777
802
|
/** Used to match backslashes in property paths. */
|
|
778
803
|
var reEscapeChar = /\\(\\)?/g;
|
|
779
804
|
|
|
@@ -1602,6 +1627,19 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
1602
1627
|
});
|
|
1603
1628
|
}
|
|
1604
1629
|
|
|
1630
|
+
/**
|
|
1631
|
+
* The base implementation of `_.trim`.
|
|
1632
|
+
*
|
|
1633
|
+
* @private
|
|
1634
|
+
* @param {string} string The string to trim.
|
|
1635
|
+
* @returns {string} Returns the trimmed string.
|
|
1636
|
+
*/
|
|
1637
|
+
function baseTrim(string) {
|
|
1638
|
+
return string
|
|
1639
|
+
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
1640
|
+
: string;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1605
1643
|
/**
|
|
1606
1644
|
* The base implementation of `_.unary` without support for storing metadata.
|
|
1607
1645
|
*
|
|
@@ -1935,6 +1973,21 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
1935
1973
|
: asciiToArray(string);
|
|
1936
1974
|
}
|
|
1937
1975
|
|
|
1976
|
+
/**
|
|
1977
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
1978
|
+
* character of `string`.
|
|
1979
|
+
*
|
|
1980
|
+
* @private
|
|
1981
|
+
* @param {string} string The string to inspect.
|
|
1982
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
1983
|
+
*/
|
|
1984
|
+
function trimmedEndIndex(string) {
|
|
1985
|
+
var index = string.length;
|
|
1986
|
+
|
|
1987
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
1988
|
+
return index;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1938
1991
|
/**
|
|
1939
1992
|
* Used by `_.unescape` to convert HTML entities to characters.
|
|
1940
1993
|
*
|
|
@@ -4328,8 +4381,21 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
4328
4381
|
* @returns {Array} Returns the new sorted array.
|
|
4329
4382
|
*/
|
|
4330
4383
|
function baseOrderBy(collection, iteratees, orders) {
|
|
4384
|
+
if (iteratees.length) {
|
|
4385
|
+
iteratees = arrayMap(iteratees, function(iteratee) {
|
|
4386
|
+
if (isArray(iteratee)) {
|
|
4387
|
+
return function(value) {
|
|
4388
|
+
return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
|
|
4389
|
+
}
|
|
4390
|
+
}
|
|
4391
|
+
return iteratee;
|
|
4392
|
+
});
|
|
4393
|
+
} else {
|
|
4394
|
+
iteratees = [identity];
|
|
4395
|
+
}
|
|
4396
|
+
|
|
4331
4397
|
var index = -1;
|
|
4332
|
-
iteratees = arrayMap(iteratees
|
|
4398
|
+
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
|
|
4333
4399
|
|
|
4334
4400
|
var result = baseMap(collection, function(value, key, collection) {
|
|
4335
4401
|
var criteria = arrayMap(iteratees, function(iteratee) {
|
|
@@ -4586,6 +4652,10 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
4586
4652
|
var key = toKey(path[index]),
|
|
4587
4653
|
newValue = value;
|
|
4588
4654
|
|
|
4655
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
4656
|
+
return object;
|
|
4657
|
+
}
|
|
4658
|
+
|
|
4589
4659
|
if (index != lastIndex) {
|
|
4590
4660
|
var objValue = nested[key];
|
|
4591
4661
|
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
|
@@ -4738,11 +4808,14 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
4738
4808
|
* into `array`.
|
|
4739
4809
|
*/
|
|
4740
4810
|
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
|
4741
|
-
value = iteratee(value);
|
|
4742
|
-
|
|
4743
4811
|
var low = 0,
|
|
4744
|
-
high = array == null ? 0 : array.length
|
|
4745
|
-
|
|
4812
|
+
high = array == null ? 0 : array.length;
|
|
4813
|
+
if (high === 0) {
|
|
4814
|
+
return 0;
|
|
4815
|
+
}
|
|
4816
|
+
|
|
4817
|
+
value = iteratee(value);
|
|
4818
|
+
var valIsNaN = value !== value,
|
|
4746
4819
|
valIsNull = value === null,
|
|
4747
4820
|
valIsSymbol = isSymbol(value),
|
|
4748
4821
|
valIsUndefined = value === undefined;
|
|
@@ -6227,10 +6300,11 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
6227
6300
|
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
6228
6301
|
return false;
|
|
6229
6302
|
}
|
|
6230
|
-
//
|
|
6231
|
-
var
|
|
6232
|
-
|
|
6233
|
-
|
|
6303
|
+
// Check that cyclic values are equal.
|
|
6304
|
+
var arrStacked = stack.get(array);
|
|
6305
|
+
var othStacked = stack.get(other);
|
|
6306
|
+
if (arrStacked && othStacked) {
|
|
6307
|
+
return arrStacked == other && othStacked == array;
|
|
6234
6308
|
}
|
|
6235
6309
|
var index = -1,
|
|
6236
6310
|
result = true,
|
|
@@ -6392,10 +6466,11 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
6392
6466
|
return false;
|
|
6393
6467
|
}
|
|
6394
6468
|
}
|
|
6395
|
-
//
|
|
6396
|
-
var
|
|
6397
|
-
|
|
6398
|
-
|
|
6469
|
+
// Check that cyclic values are equal.
|
|
6470
|
+
var objStacked = stack.get(object);
|
|
6471
|
+
var othStacked = stack.get(other);
|
|
6472
|
+
if (objStacked && othStacked) {
|
|
6473
|
+
return objStacked == other && othStacked == object;
|
|
6399
6474
|
}
|
|
6400
6475
|
var result = true;
|
|
6401
6476
|
stack.set(object, other);
|
|
@@ -9776,6 +9851,10 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
9776
9851
|
* // The `_.property` iteratee shorthand.
|
|
9777
9852
|
* _.filter(users, 'active');
|
|
9778
9853
|
* // => objects for ['barney']
|
|
9854
|
+
*
|
|
9855
|
+
* // Combining several predicates using `_.overEvery` or `_.overSome`.
|
|
9856
|
+
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
|
|
9857
|
+
* // => objects for ['fred', 'barney']
|
|
9779
9858
|
*/
|
|
9780
9859
|
function filter(collection, predicate) {
|
|
9781
9860
|
var func = isArray(collection) ? arrayFilter : baseFilter;
|
|
@@ -10525,15 +10604,15 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
10525
10604
|
* var users = [
|
|
10526
10605
|
* { 'user': 'fred', 'age': 48 },
|
|
10527
10606
|
* { 'user': 'barney', 'age': 36 },
|
|
10528
|
-
* { 'user': 'fred', 'age':
|
|
10607
|
+
* { 'user': 'fred', 'age': 30 },
|
|
10529
10608
|
* { 'user': 'barney', 'age': 34 }
|
|
10530
10609
|
* ];
|
|
10531
10610
|
*
|
|
10532
10611
|
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
10533
|
-
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred',
|
|
10612
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
|
10534
10613
|
*
|
|
10535
10614
|
* _.sortBy(users, ['user', 'age']);
|
|
10536
|
-
* // => objects for [['barney', 34], ['barney', 36], ['fred',
|
|
10615
|
+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
|
10537
10616
|
*/
|
|
10538
10617
|
var sortBy = baseRest(function(collection, iteratees) {
|
|
10539
10618
|
if (collection == null) {
|
|
@@ -13077,7 +13156,7 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
13077
13156
|
if (typeof value != 'string') {
|
|
13078
13157
|
return value === 0 ? value : +value;
|
|
13079
13158
|
}
|
|
13080
|
-
value = value
|
|
13159
|
+
value = baseTrim(value);
|
|
13081
13160
|
var isBinary = reIsBinary.test(value);
|
|
13082
13161
|
return (isBinary || reIsOctal.test(value))
|
|
13083
13162
|
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
@@ -15408,11 +15487,11 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
15408
15487
|
|
|
15409
15488
|
// Use a sourceURL for easier debugging.
|
|
15410
15489
|
// The sourceURL gets injected into the source that's eval-ed, so be careful
|
|
15411
|
-
//
|
|
15412
|
-
//
|
|
15490
|
+
// to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
|
|
15491
|
+
// and escape the comment, thus injecting code that gets evaled.
|
|
15413
15492
|
var sourceURL = '//# sourceURL=' +
|
|
15414
15493
|
(hasOwnProperty.call(options, 'sourceURL')
|
|
15415
|
-
? (options.sourceURL + '').replace(/
|
|
15494
|
+
? (options.sourceURL + '').replace(/\s/g, ' ')
|
|
15416
15495
|
: ('lodash.templateSources[' + (++templateCounter) + ']')
|
|
15417
15496
|
) + '\n';
|
|
15418
15497
|
|
|
@@ -15445,12 +15524,16 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
15445
15524
|
|
|
15446
15525
|
// If `variable` is not specified wrap a with-statement around the generated
|
|
15447
15526
|
// code to add the data object to the top of the scope chain.
|
|
15448
|
-
// Like with sourceURL, we take care to not check the option's prototype,
|
|
15449
|
-
// as this configuration is a code injection vector.
|
|
15450
15527
|
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
|
|
15451
15528
|
if (!variable) {
|
|
15452
15529
|
source = 'with (obj) {\n' + source + '\n}\n';
|
|
15453
15530
|
}
|
|
15531
|
+
// Throw an error if a forbidden character was found in `variable`, to prevent
|
|
15532
|
+
// potential command injection attacks.
|
|
15533
|
+
else if (reForbiddenIdentifierChars.test(variable)) {
|
|
15534
|
+
throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
|
|
15535
|
+
}
|
|
15536
|
+
|
|
15454
15537
|
// Cleanup code by stripping empty strings.
|
|
15455
15538
|
source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
|
|
15456
15539
|
.replace(reEmptyStringMiddle, '$1')
|
|
@@ -15564,7 +15647,7 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
15564
15647
|
function trim(string, chars, guard) {
|
|
15565
15648
|
string = toString(string);
|
|
15566
15649
|
if (string && (guard || chars === undefined)) {
|
|
15567
|
-
return string
|
|
15650
|
+
return baseTrim(string);
|
|
15568
15651
|
}
|
|
15569
15652
|
if (!string || !(chars = baseToString(chars))) {
|
|
15570
15653
|
return string;
|
|
@@ -15599,7 +15682,7 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
15599
15682
|
function trimEnd(string, chars, guard) {
|
|
15600
15683
|
string = toString(string);
|
|
15601
15684
|
if (string && (guard || chars === undefined)) {
|
|
15602
|
-
return string.
|
|
15685
|
+
return string.slice(0, trimmedEndIndex(string) + 1);
|
|
15603
15686
|
}
|
|
15604
15687
|
if (!string || !(chars = baseToString(chars))) {
|
|
15605
15688
|
return string;
|
|
@@ -16153,6 +16236,9 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
16153
16236
|
* values against any array or object value, respectively. See `_.isEqual`
|
|
16154
16237
|
* for a list of supported value comparisons.
|
|
16155
16238
|
*
|
|
16239
|
+
* **Note:** Multiple values can be checked by combining several matchers
|
|
16240
|
+
* using `_.overSome`
|
|
16241
|
+
*
|
|
16156
16242
|
* @static
|
|
16157
16243
|
* @memberOf _
|
|
16158
16244
|
* @since 3.0.0
|
|
@@ -16168,6 +16254,10 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
16168
16254
|
*
|
|
16169
16255
|
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
|
|
16170
16256
|
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
|
|
16257
|
+
*
|
|
16258
|
+
* // Checking for several possible values
|
|
16259
|
+
* _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
|
|
16260
|
+
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
|
16171
16261
|
*/
|
|
16172
16262
|
function matches(source) {
|
|
16173
16263
|
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
|
@@ -16182,6 +16272,9 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
16182
16272
|
* `srcValue` values against any array or object value, respectively. See
|
|
16183
16273
|
* `_.isEqual` for a list of supported value comparisons.
|
|
16184
16274
|
*
|
|
16275
|
+
* **Note:** Multiple values can be checked by combining several matchers
|
|
16276
|
+
* using `_.overSome`
|
|
16277
|
+
*
|
|
16185
16278
|
* @static
|
|
16186
16279
|
* @memberOf _
|
|
16187
16280
|
* @since 3.2.0
|
|
@@ -16198,6 +16291,10 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
16198
16291
|
*
|
|
16199
16292
|
* _.find(objects, _.matchesProperty('a', 4));
|
|
16200
16293
|
* // => { 'a': 4, 'b': 5, 'c': 6 }
|
|
16294
|
+
*
|
|
16295
|
+
* // Checking for several possible values
|
|
16296
|
+
* _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
|
|
16297
|
+
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
|
16201
16298
|
*/
|
|
16202
16299
|
function matchesProperty(path, srcValue) {
|
|
16203
16300
|
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
|
|
@@ -16421,6 +16518,10 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
16421
16518
|
* Creates a function that checks if **all** of the `predicates` return
|
|
16422
16519
|
* truthy when invoked with the arguments it receives.
|
|
16423
16520
|
*
|
|
16521
|
+
* Following shorthands are possible for providing predicates.
|
|
16522
|
+
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
|
16523
|
+
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
|
16524
|
+
*
|
|
16424
16525
|
* @static
|
|
16425
16526
|
* @memberOf _
|
|
16426
16527
|
* @since 4.0.0
|
|
@@ -16447,6 +16548,10 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
16447
16548
|
* Creates a function that checks if **any** of the `predicates` return
|
|
16448
16549
|
* truthy when invoked with the arguments it receives.
|
|
16449
16550
|
*
|
|
16551
|
+
* Following shorthands are possible for providing predicates.
|
|
16552
|
+
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
|
16553
|
+
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
|
16554
|
+
*
|
|
16450
16555
|
* @static
|
|
16451
16556
|
* @memberOf _
|
|
16452
16557
|
* @since 4.0.0
|
|
@@ -16466,6 +16571,9 @@ function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName =
|
|
|
16466
16571
|
*
|
|
16467
16572
|
* func(NaN);
|
|
16468
16573
|
* // => false
|
|
16574
|
+
*
|
|
16575
|
+
* var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
|
|
16576
|
+
* var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
|
|
16469
16577
|
*/
|
|
16470
16578
|
var overSome = createOver(arraySome);
|
|
16471
16579
|
|
|
@@ -17753,7 +17861,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17753
17861
|
};
|
|
17754
17862
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17755
17863
|
exports.countTableRecord = exports.getTableRecord = exports.searchTableRecord = exports.MAX_PAGE_RECORD_NUMBER = exports.parseIntParam = exports.deleteTableRecord = exports.updateTableRecord = exports.createTableRecord = exports.getTableColumnName = exports.escapeIdentifier = exports.escapeIdentifierStr = void 0;
|
|
17756
|
-
const sql_syntax_1 = __importStar(__webpack_require__(
|
|
17864
|
+
const sql_syntax_1 = __importStar(__webpack_require__(7));
|
|
17757
17865
|
const AuthDecision_1 = __webpack_require__(11);
|
|
17758
17866
|
const lodash_1 = __webpack_require__(9);
|
|
17759
17867
|
const ServerError_1 = __importDefault(__webpack_require__(17));
|
|
@@ -17799,7 +17907,7 @@ exports.escapeIdentifier = escapeIdentifier;
|
|
|
17799
17907
|
function getTableColumnName(columnName, tableRef = "", useLowerCaseColumnName = false) {
|
|
17800
17908
|
const id = [
|
|
17801
17909
|
tableRef,
|
|
17802
|
-
useLowerCaseColumnName ? columnName.toLowerCase :
|
|
17910
|
+
useLowerCaseColumnName ? columnName.toLowerCase() : columnName
|
|
17803
17911
|
]
|
|
17804
17912
|
.filter((item) => item)
|
|
17805
17913
|
.join(".");
|
|
@@ -18011,7 +18119,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18011
18119
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18012
18120
|
exports.ConciseOperand = exports.ConciseExpression = exports.ConciseRule = exports.UnconditionalFalseDecision = exports.UnconditionalTrueDecision = exports.isTrueEquivalent = void 0;
|
|
18013
18121
|
const AspectQuery_1 = __webpack_require__(16);
|
|
18014
|
-
const sql_syntax_1 = __importStar(__webpack_require__(
|
|
18122
|
+
const sql_syntax_1 = __importStar(__webpack_require__(7));
|
|
18015
18123
|
class AuthDecision {
|
|
18016
18124
|
constructor(hasResidualRules, residualRules, result, hasWarns = false, warns = [], unknowns) {
|
|
18017
18125
|
if (typeof hasResidualRules !== "boolean") {
|
|
@@ -18046,7 +18154,7 @@ class AuthDecision {
|
|
|
18046
18154
|
}
|
|
18047
18155
|
}
|
|
18048
18156
|
toSql(config) {
|
|
18049
|
-
return sql_syntax_1.default.joinWithOr(this.toAspectQueryGroups(config.prefixes).map((item) => item.toSql(config)));
|
|
18157
|
+
return sql_syntax_1.default.joinWithOr(this.toAspectQueryGroups(config.prefixes).map((item) => item.toSql(config))).roundBracket();
|
|
18050
18158
|
}
|
|
18051
18159
|
}
|
|
18052
18160
|
exports.default = AuthDecision;
|
|
@@ -18272,9 +18380,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18272
18380
|
exports.NodeNotFoundError = void 0;
|
|
18273
18381
|
const lodash_1 = __importDefault(__webpack_require__(9));
|
|
18274
18382
|
const tsmonad_1 = __webpack_require__(15);
|
|
18275
|
-
const sql_syntax_1 = __importStar(__webpack_require__(
|
|
18383
|
+
const sql_syntax_1 = __importStar(__webpack_require__(7));
|
|
18276
18384
|
const SQLUtils_1 = __webpack_require__(10);
|
|
18277
18385
|
const AuthDecision_1 = __webpack_require__(11);
|
|
18386
|
+
const isUuid_1 = __importDefault(__webpack_require__(6));
|
|
18278
18387
|
const textTree = __webpack_require__(18);
|
|
18279
18388
|
class NodeNotFoundError extends Error {}
|
|
18280
18389
|
|
|
@@ -18378,9 +18487,13 @@ class NestedSetModelQueryer {
|
|
|
18378
18487
|
* @returns {Promise<NodeRecord[]>}
|
|
18379
18488
|
* @memberof NestedSetModelQueryer
|
|
18380
18489
|
*/
|
|
18381
|
-
getNodes(nodesQuery = {}, fields = null, client = null) {
|
|
18490
|
+
getNodes(nodesQuery = {}, fields = null, client = null, authDecision = AuthDecision_1.UnconditionalTrueDecision) {
|
|
18382
18491
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18492
|
+
const authConditions = authDecision.toSql({
|
|
18493
|
+
prefixes: ["input.authObject.orgUnit"] });
|
|
18494
|
+
|
|
18383
18495
|
const clauses = [
|
|
18496
|
+
authConditions,
|
|
18384
18497
|
nodesQuery.name ?
|
|
18385
18498
|
sql_syntax_1.sqls`"name" = ${nodesQuery.name}` :
|
|
18386
18499
|
sql_syntax_1.default.empty,
|
|
@@ -18421,7 +18534,7 @@ class NestedSetModelQueryer {
|
|
|
18421
18534
|
}
|
|
18422
18535
|
/**
|
|
18423
18536
|
* Get the root node of the tree
|
|
18424
|
-
* Return null if empty tree
|
|
18537
|
+
* Return null if empty tree or the user has no access to the root node
|
|
18425
18538
|
*
|
|
18426
18539
|
* @param {string[]} [fields=null] Selected Fields; If null, use this.defaultSelectFieldList
|
|
18427
18540
|
* @param {pg.Client} [client=null] Optional pg client; Use supplied client connection for query rather than a random connection from Pool
|
|
@@ -18458,7 +18571,7 @@ class NestedSetModelQueryer {
|
|
|
18458
18571
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18459
18572
|
const authConditions = authDecision.toSql({
|
|
18460
18573
|
prefixes: ["input.authObject.orgUnit"],
|
|
18461
|
-
tableRef: "
|
|
18574
|
+
tableRef: "children" });
|
|
18462
18575
|
|
|
18463
18576
|
const tbl = SQLUtils_1.escapeIdentifier(this.tableName);
|
|
18464
18577
|
const conditions = [
|
|
@@ -18491,7 +18604,7 @@ class NestedSetModelQueryer {
|
|
|
18491
18604
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18492
18605
|
const authConditions = authDecision.toSql({
|
|
18493
18606
|
prefixes: ["input.authObject.orgUnit"],
|
|
18494
|
-
tableRef: "
|
|
18607
|
+
tableRef: "parents" });
|
|
18495
18608
|
|
|
18496
18609
|
const tbl = SQLUtils_1.escapeIdentifier(this.tableName);
|
|
18497
18610
|
const conditions = [
|
|
@@ -18522,7 +18635,7 @@ class NestedSetModelQueryer {
|
|
|
18522
18635
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18523
18636
|
const authConditions = authDecision.toSql({
|
|
18524
18637
|
prefixes: ["input.authObject.orgUnit"],
|
|
18525
|
-
tableRef: "
|
|
18638
|
+
tableRef: "children" });
|
|
18526
18639
|
|
|
18527
18640
|
const tbl = SQLUtils_1.escapeIdentifier(this.tableName);
|
|
18528
18641
|
const result = yield (client ? client : this.pool).query(...sql_syntax_1.sqls`SELECT ${this.selectFields("Children", fields)}
|
|
@@ -18556,7 +18669,7 @@ class NestedSetModelQueryer {
|
|
|
18556
18669
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18557
18670
|
const authConditions = authDecision.toSql({
|
|
18558
18671
|
prefixes: ["input.authObject.orgUnit"],
|
|
18559
|
-
tableRef: "
|
|
18672
|
+
tableRef: "parents" });
|
|
18560
18673
|
|
|
18561
18674
|
const tbl = SQLUtils_1.escapeIdentifier(this.tableName);
|
|
18562
18675
|
const result = yield (client ? client : this.pool).query(...sql_syntax_1.sqls`SELECT ${this.selectFields("Parents", fields)}
|
|
@@ -18618,7 +18731,7 @@ class NestedSetModelQueryer {
|
|
|
18618
18731
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18619
18732
|
const authConditions = authDecision.toSql({
|
|
18620
18733
|
prefixes: ["input.authObject.orgUnit"],
|
|
18621
|
-
tableRef: "
|
|
18734
|
+
tableRef: "parents" });
|
|
18622
18735
|
|
|
18623
18736
|
const tbl = SQLUtils_1.escapeIdentifier(this.tableName);
|
|
18624
18737
|
const result = yield this.pool.query(...sql_syntax_1.sqls`SELECT COUNT(Parents.id) AS level
|
|
@@ -18679,7 +18792,7 @@ class NestedSetModelQueryer {
|
|
|
18679
18792
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18680
18793
|
const authConditions = authDecision.toSql({
|
|
18681
18794
|
prefixes: ["input.authObject.orgUnit"],
|
|
18682
|
-
tableRef: "
|
|
18795
|
+
tableRef: "children" });
|
|
18683
18796
|
|
|
18684
18797
|
const tbl = SQLUtils_1.escapeIdentifier(this.tableName);
|
|
18685
18798
|
const result = yield this.pool.query(...sql_syntax_1.sqls`SELECT ${this.selectFields("Children")}
|
|
@@ -18704,7 +18817,7 @@ class NestedSetModelQueryer {
|
|
|
18704
18817
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18705
18818
|
const authConditions = authDecision.toSql({
|
|
18706
18819
|
prefixes: ["input.authObject.orgUnit"],
|
|
18707
|
-
tableRef: "
|
|
18820
|
+
tableRef: "children" });
|
|
18708
18821
|
|
|
18709
18822
|
const tbl = SQLUtils_1.escapeIdentifier(this.tableName);
|
|
18710
18823
|
const result = yield this.pool.query(...sql_syntax_1.sqls`SELECT ${this.selectFields("Children")}
|
|
@@ -18720,9 +18833,11 @@ class NestedSetModelQueryer {
|
|
|
18720
18833
|
}
|
|
18721
18834
|
/**
|
|
18722
18835
|
* Get all nodes on the top to down path between the `higherNode` to the `lowerNode`
|
|
18723
|
-
* Sort from higher level nodes to lower level node
|
|
18724
|
-
*
|
|
18725
|
-
* If
|
|
18836
|
+
* Sort from higher level nodes to lower level node.
|
|
18837
|
+
* Result will include `higherNode` and the `lowerNode`.
|
|
18838
|
+
* If `higherNode` and the `lowerNode` is the same node, an array contains the single node will be return.
|
|
18839
|
+
* If a path doesn't exist, empty array (`[]`) will be returned
|
|
18840
|
+
* If you pass a lower node to the `higherNodeId` and a higher node to `lowerNodeId`, empty array will be returned
|
|
18726
18841
|
*
|
|
18727
18842
|
* @param {string} higherNodeId
|
|
18728
18843
|
* @param {string} lowerNodeId
|
|
@@ -18730,6 +18845,7 @@ class NestedSetModelQueryer {
|
|
|
18730
18845
|
* @memberof NestedSetModelQueryer
|
|
18731
18846
|
*/
|
|
18732
18847
|
getTopDownPathBetween(higherNodeId, lowerNodeId, authDecision = AuthDecision_1.UnconditionalTrueDecision) {
|
|
18848
|
+
var _a;
|
|
18733
18849
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18734
18850
|
const authConditions = authDecision.toSql({
|
|
18735
18851
|
prefixes: ["input.authObject.orgUnit"],
|
|
@@ -18745,9 +18861,12 @@ class NestedSetModelQueryer {
|
|
|
18745
18861
|
sql_syntax_1.default.empty :
|
|
18746
18862
|
sql_syntax_1.sqls` AND ${authConditions}`}
|
|
18747
18863
|
ORDER BY (t2.right-t2.left) DESC`.toQuery());
|
|
18748
|
-
if (!result ||
|
|
18749
|
-
|
|
18750
|
-
|
|
18864
|
+
if (!((_a = result === null || result === void 0 ? void 0 : result.rows) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
18865
|
+
return [];
|
|
18866
|
+
} else
|
|
18867
|
+
{
|
|
18868
|
+
return result.rows;
|
|
18869
|
+
}
|
|
18751
18870
|
});
|
|
18752
18871
|
}
|
|
18753
18872
|
/**
|
|
@@ -19218,24 +19337,17 @@ class NestedSetModelQueryer {
|
|
|
19218
19337
|
*/
|
|
19219
19338
|
updateNode(nodeId, nodeData, client = null) {
|
|
19220
19339
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19221
|
-
if (
|
|
19222
|
-
throw new Error("nodeId
|
|
19223
|
-
}
|
|
19224
|
-
const
|
|
19225
|
-
|
|
19226
|
-
|
|
19340
|
+
if (!isUuid_1.default(nodeId)) {
|
|
19341
|
+
throw new Error("nodeId is not valid UUID!");
|
|
19342
|
+
}
|
|
19343
|
+
const sqlUpdates = Object.keys(nodeData).
|
|
19344
|
+
filter(k => k !== "left" && k !== "right" && k !== "id").
|
|
19345
|
+
map(fieldName => sql_syntax_1.sqls`${SQLUtils_1.escapeIdentifier(fieldName)} = ${nodeData[fieldName]}`);
|
|
19346
|
+
if (!sqlUpdates.length) {
|
|
19347
|
+
console.log("update node parameter: ", nodeId, nodeData);
|
|
19227
19348
|
throw new Error("No valid node data passed for updating.");
|
|
19228
19349
|
}
|
|
19229
|
-
|
|
19230
|
-
map(f => {
|
|
19231
|
-
if (!isValidSqlIdentifier(f)) {
|
|
19232
|
-
throw new Error(`field name: ${f} contains invalid characters!`);
|
|
19233
|
-
}
|
|
19234
|
-
sqlValues.push(nodeData[f]);
|
|
19235
|
-
return `"${f}" = $${sqlValues.length}`;
|
|
19236
|
-
}).
|
|
19237
|
-
join(", ");
|
|
19238
|
-
yield (client ? client : this.pool).query(`UPDATE "${this.tableName}" SET ${setFieldList} WHERE "id" = $1`, sqlValues);
|
|
19350
|
+
yield (client ? client : this.pool).query(...sql_syntax_1.sqls`UPDATE ${SQLUtils_1.escapeIdentifier(this.tableName)} SET ${sql_syntax_1.default.join(sqlUpdates, sql_syntax_1.sqls` , `)} WHERE "id" = ${nodeId}`.toQuery());
|
|
19239
19351
|
});
|
|
19240
19352
|
}
|
|
19241
19353
|
getChildTextTreeNodes(parentId) {
|
|
@@ -19361,7 +19473,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19361
19473
|
};
|
|
19362
19474
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19363
19475
|
exports.AspectQueryGroup = exports.AspectQueryValueInArray = exports.AspectQueryArrayNotEmpty = exports.AspectQueryWithValue = exports.AspectQueryExists = exports.AspectQueryFalse = exports.AspectQueryTrue = exports.AspectQuery = exports.AspectQueryValue = void 0;
|
|
19364
|
-
const sql_syntax_1 = __importStar(__webpack_require__(
|
|
19476
|
+
const sql_syntax_1 = __importStar(__webpack_require__(7));
|
|
19365
19477
|
const SQLUtils_1 = __webpack_require__(10);
|
|
19366
19478
|
class AspectQueryValue {
|
|
19367
19479
|
constructor(value) {
|
|
@@ -19369,10 +19481,13 @@ class AspectQueryValue {
|
|
|
19369
19481
|
switch (typeof value) {
|
|
19370
19482
|
case "number":
|
|
19371
19483
|
this.postgresType = sql_syntax_1.sqls `NUMERIC`;
|
|
19484
|
+
break;
|
|
19372
19485
|
case "boolean":
|
|
19373
19486
|
this.postgresType = sql_syntax_1.sqls `BOOL`;
|
|
19487
|
+
break;
|
|
19374
19488
|
case "string":
|
|
19375
19489
|
this.postgresType = sql_syntax_1.sqls `TEXT`;
|
|
19490
|
+
break;
|
|
19376
19491
|
default:
|
|
19377
19492
|
throw new Error("getPostgresValueTypeCastStr: unsupported data type: `${" +
|
|
19378
19493
|
typeof value +
|
|
@@ -100,7 +100,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
100
100
|
/***/ 19:
|
|
101
101
|
/***/ (function(module, exports, __webpack_require__) {
|
|
102
102
|
|
|
103
|
-
const isUuid = __webpack_require__(
|
|
103
|
+
const isUuid = __webpack_require__(6).default;
|
|
104
104
|
async function getNodeIdByNameOrId(nameOrId, queryer) {
|
|
105
105
|
if (isUuid(nameOrId)) {
|
|
106
106
|
return nameOrId;
|
|
@@ -117,7 +117,7 @@ module.exports = getNodeIdByNameOrId;
|
|
|
117
117
|
|
|
118
118
|
/***/ }),
|
|
119
119
|
|
|
120
|
-
/***/
|
|
120
|
+
/***/ 6:
|
|
121
121
|
/***/ (function(module, exports, __webpack_require__) {
|
|
122
122
|
|
|
123
123
|
"use strict";
|
|
@@ -100,7 +100,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
100
100
|
/***/ 20:
|
|
101
101
|
/***/ (function(module, exports, __webpack_require__) {
|
|
102
102
|
|
|
103
|
-
const isUuid = __webpack_require__(
|
|
103
|
+
const isUuid = __webpack_require__(6).default;
|
|
104
104
|
async function getUserIdFromNameOrId(nameOrId, pool) {
|
|
105
105
|
if (isUuid(nameOrId)) {
|
|
106
106
|
return nameOrId;
|
|
@@ -120,7 +120,7 @@ module.exports = getUserIdFromNameOrId;
|
|
|
120
120
|
|
|
121
121
|
/***/ }),
|
|
122
122
|
|
|
123
|
-
/***/
|
|
123
|
+
/***/ 6:
|
|
124
124
|
/***/ (function(module, exports, __webpack_require__) {
|
|
125
125
|
|
|
126
126
|
"use strict";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magda/org-tree",
|
|
3
3
|
"description": "MAGDA Organizational Hierarchy Management Utilities",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.3",
|
|
5
5
|
"bin": {
|
|
6
6
|
"org-tree": "./bin/org-tree/org-tree.js"
|
|
7
7
|
},
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"author": "",
|
|
15
15
|
"license": "Apache-2.0",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@magda/authorization-api": "^2.0.0-alpha.
|
|
18
|
-
"@magda/scripts": "^2.0.0-alpha.
|
|
19
|
-
"@magda/typescript-common": "^2.0.0-alpha.
|
|
17
|
+
"@magda/authorization-api": "^2.0.0-alpha.3",
|
|
18
|
+
"@magda/scripts": "^2.0.0-alpha.3",
|
|
19
|
+
"@magda/typescript-common": "^2.0.0-alpha.3",
|
|
20
20
|
"fs-extra": "^2.1.2",
|
|
21
21
|
"webpack": "^4.41.2",
|
|
22
22
|
"webpack-cli": "^3.3.10"
|