@magda/org-tree 2.0.0-alpha.8 → 2.0.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.
|
@@ -17843,7 +17843,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
17843
17843
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
17844
17844
|
if (mod && mod.__esModule) return mod;
|
|
17845
17845
|
var result = {};
|
|
17846
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17846
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17847
17847
|
__setModuleDefault(result, mod);
|
|
17848
17848
|
return result;
|
|
17849
17849
|
};
|
|
@@ -18016,16 +18016,19 @@ function searchTableRecord(poolOrClient, table, conditions = [], queryConfig) {
|
|
|
18016
18016
|
if (!table.trim()) {
|
|
18017
18017
|
throw new ServerError_1.default("invalid empty table name is supplied.");
|
|
18018
18018
|
}
|
|
18019
|
-
const objectKind = (queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.objectKind)
|
|
18019
|
+
const objectKind = (queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.objectKind)
|
|
18020
|
+
? queryConfig.objectKind
|
|
18020
18021
|
: "authObject";
|
|
18021
|
-
const authDecision = (queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.authDecision)
|
|
18022
|
+
const authDecision = (queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.authDecision)
|
|
18023
|
+
? queryConfig.authDecision
|
|
18022
18024
|
: AuthDecision_1.UnconditionalTrueDecision;
|
|
18023
18025
|
let limit = parseIntParam(queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.limit);
|
|
18024
18026
|
const offset = parseIntParam(queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.offset);
|
|
18025
18027
|
if (limit > exports.MAX_PAGE_RECORD_NUMBER) {
|
|
18026
18028
|
limit = exports.MAX_PAGE_RECORD_NUMBER;
|
|
18027
18029
|
}
|
|
18028
|
-
const config = (queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.toSqlConfig)
|
|
18030
|
+
const config = (queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.toSqlConfig)
|
|
18031
|
+
? queryConfig.toSqlConfig
|
|
18029
18032
|
: {
|
|
18030
18033
|
prefixes: [
|
|
18031
18034
|
`input.${objectKind}.${lodash_1.camelCase(table.replace(/s$/, ""))}`
|
|
@@ -18033,19 +18036,23 @@ function searchTableRecord(poolOrClient, table, conditions = [], queryConfig) {
|
|
|
18033
18036
|
};
|
|
18034
18037
|
const authConditions = authDecision.toSql(config);
|
|
18035
18038
|
const where = sql_syntax_1.default.where(sql_syntax_1.default.joinWithAnd([...conditions, authConditions]));
|
|
18036
|
-
const sqlSyntax = sql_syntax_1.sqls `SELECT ${(queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.selectedFields)
|
|
18039
|
+
const sqlSyntax = sql_syntax_1.sqls `SELECT ${(queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.selectedFields)
|
|
18040
|
+
? sql_syntax_1.default.csv(...queryConfig.selectedFields)
|
|
18037
18041
|
: sql_syntax_1.sqls `*`}
|
|
18038
18042
|
FROM ${escapeIdentifier(table)}
|
|
18039
|
-
${((_a = queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.leftJoins) === null || _a === void 0 ? void 0 : _a.length)
|
|
18043
|
+
${((_a = queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.leftJoins) === null || _a === void 0 ? void 0 : _a.length)
|
|
18044
|
+
? sql_syntax_1.default.join(queryConfig.leftJoins.map((joinItem) => sql_syntax_1.sqls `LEFT JOIN ${escapeIdentifier(joinItem.table)} ON ${joinItem.joinCondition}`), sql_syntax_1.sqls `\n`)
|
|
18040
18045
|
: sql_syntax_1.default.empty}
|
|
18041
18046
|
${where}
|
|
18042
|
-
${(queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.groupBy)
|
|
18043
|
-
? sql_syntax_1.
|
|
18044
|
-
|
|
18047
|
+
${(queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.groupBy)
|
|
18048
|
+
? sql_syntax_1.sqls `GROUP BY ${typeof ((_b = queryConfig.groupBy) === null || _b === void 0 ? void 0 : _b.length) === "number"
|
|
18049
|
+
? sql_syntax_1.default.csv(...queryConfig.groupBy)
|
|
18050
|
+
: queryConfig.groupBy}`
|
|
18045
18051
|
: sql_syntax_1.default.empty}
|
|
18046
|
-
${(queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.orderBy)
|
|
18047
|
-
? sql_syntax_1.
|
|
18048
|
-
|
|
18052
|
+
${(queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.orderBy)
|
|
18053
|
+
? sql_syntax_1.sqls `ORDER BY ${typeof ((_c = queryConfig.orderBy) === null || _c === void 0 ? void 0 : _c.length) === "number"
|
|
18054
|
+
? sql_syntax_1.default.csv(...queryConfig.orderBy)
|
|
18055
|
+
: queryConfig.orderBy}`
|
|
18049
18056
|
: sql_syntax_1.default.empty}
|
|
18050
18057
|
${offset ? sql_syntax_1.sqls `OFFSET ${offset}` : sql_syntax_1.default.empty}
|
|
18051
18058
|
${limit ? sql_syntax_1.sqls `LIMIT ${limit}` : sql_syntax_1.default.empty}
|
|
@@ -18116,7 +18123,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18116
18123
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18117
18124
|
if (mod && mod.__esModule) return mod;
|
|
18118
18125
|
var result = {};
|
|
18119
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18126
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18120
18127
|
__setModuleDefault(result, mod);
|
|
18121
18128
|
return result;
|
|
18122
18129
|
};
|
|
@@ -18220,6 +18227,8 @@ class ConciseExpression {
|
|
|
18220
18227
|
}
|
|
18221
18228
|
getSqlOperator() {
|
|
18222
18229
|
switch (this.operator) {
|
|
18230
|
+
case "!=":
|
|
18231
|
+
return sql_syntax_1.sqls `!=`;
|
|
18223
18232
|
case "=":
|
|
18224
18233
|
return sql_syntax_1.sqls `=`;
|
|
18225
18234
|
case ">":
|
|
@@ -18364,7 +18373,7 @@ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? fun
|
|
|
18364
18373
|
var __importStar = this && this.__importStar || function (mod) {
|
|
18365
18374
|
if (mod && mod.__esModule) return mod;
|
|
18366
18375
|
var result = {};
|
|
18367
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18376
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18368
18377
|
__setModuleDefault(result, mod);
|
|
18369
18378
|
return result;
|
|
18370
18379
|
};
|
|
@@ -19471,7 +19480,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
19471
19480
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19472
19481
|
if (mod && mod.__esModule) return mod;
|
|
19473
19482
|
var result = {};
|
|
19474
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
19483
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
19475
19484
|
__setModuleDefault(result, mod);
|
|
19476
19485
|
return result;
|
|
19477
19486
|
};
|
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
|
|
4
|
+
"version": "2.0.0",
|
|
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
|
|
18
|
-
"@magda/scripts": "^2.0.0
|
|
19
|
-
"@magda/typescript-common": "^2.0.0
|
|
17
|
+
"@magda/authorization-api": "^2.0.0",
|
|
18
|
+
"@magda/scripts": "^2.0.0",
|
|
19
|
+
"@magda/typescript-common": "^2.0.0",
|
|
20
20
|
"fs-extra": "^2.1.2",
|
|
21
21
|
"webpack": "^4.41.2",
|
|
22
22
|
"webpack-cli": "^3.3.10"
|