@magda/org-tree 2.0.0-alpha.5 → 2.0.0-alpha.6
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.
|
@@ -18010,8 +18010,8 @@ function parseIntParam(p) {
|
|
|
18010
18010
|
}
|
|
18011
18011
|
exports.parseIntParam = parseIntParam;
|
|
18012
18012
|
exports.MAX_PAGE_RECORD_NUMBER = 500;
|
|
18013
|
-
function searchTableRecord(poolOrClient, table,
|
|
18014
|
-
var _a, _b, _c;
|
|
18013
|
+
function searchTableRecord(poolOrClient, table, conditions = [], queryConfig) {
|
|
18014
|
+
var _a, _b, _c, _d;
|
|
18015
18015
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18016
18016
|
if (!table.trim()) {
|
|
18017
18017
|
throw new ServerError_1.default("invalid empty table name is supplied.");
|
|
@@ -18032,7 +18032,7 @@ function searchTableRecord(poolOrClient, table, contiditions = [], queryConfig)
|
|
|
18032
18032
|
]
|
|
18033
18033
|
};
|
|
18034
18034
|
const authConditions = authDecision.toSql(config);
|
|
18035
|
-
const where = sql_syntax_1.default.where(sql_syntax_1.default.joinWithAnd([...
|
|
18035
|
+
const where = sql_syntax_1.default.where(sql_syntax_1.default.joinWithAnd([...conditions, authConditions]));
|
|
18036
18036
|
const sqlSyntax = sql_syntax_1.sqls `SELECT ${(queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.selectedFields) ? sql_syntax_1.default.csv(...queryConfig.selectedFields)
|
|
18037
18037
|
: sql_syntax_1.sqls `*`}
|
|
18038
18038
|
FROM ${escapeIdentifier(table)}
|
|
@@ -18043,11 +18043,15 @@ function searchTableRecord(poolOrClient, table, contiditions = [], queryConfig)
|
|
|
18043
18043
|
? sql_syntax_1.default.csv(...queryConfig.groupBy)
|
|
18044
18044
|
: queryConfig.groupBy}`
|
|
18045
18045
|
: sql_syntax_1.default.empty}
|
|
18046
|
+
${(queryConfig === null || queryConfig === void 0 ? void 0 : queryConfig.orderBy) ? sql_syntax_1.sqls `ORDER BY ${typeof ((_c = queryConfig.orderBy) === null || _c === void 0 ? void 0 : _c.length) === "number"
|
|
18047
|
+
? sql_syntax_1.default.csv(...queryConfig.orderBy)
|
|
18048
|
+
: queryConfig.orderBy}`
|
|
18049
|
+
: sql_syntax_1.default.empty}
|
|
18046
18050
|
${offset ? sql_syntax_1.sqls `OFFSET ${offset}` : sql_syntax_1.default.empty}
|
|
18047
18051
|
${limit ? sql_syntax_1.sqls `LIMIT ${limit}` : sql_syntax_1.default.empty}
|
|
18048
18052
|
`;
|
|
18049
18053
|
const result = yield poolOrClient.query(...sqlSyntax.toQuery());
|
|
18050
|
-
if (!((
|
|
18054
|
+
if (!((_d = result === null || result === void 0 ? void 0 : result.rows) === null || _d === void 0 ? void 0 : _d.length)) {
|
|
18051
18055
|
return [];
|
|
18052
18056
|
}
|
|
18053
18057
|
else {
|
|
@@ -18072,9 +18076,9 @@ function getTableRecord(poolOrClient, table, id, authDecision = AuthDecision_1.U
|
|
|
18072
18076
|
});
|
|
18073
18077
|
}
|
|
18074
18078
|
exports.getTableRecord = getTableRecord;
|
|
18075
|
-
function countTableRecord(poolOrClient, table,
|
|
18079
|
+
function countTableRecord(poolOrClient, table, conditions = [], authDecision, objectKind, toSqlConfig) {
|
|
18076
18080
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18077
|
-
const records = yield searchTableRecord(poolOrClient, table,
|
|
18081
|
+
const records = yield searchTableRecord(poolOrClient, table, conditions, {
|
|
18078
18082
|
authDecision,
|
|
18079
18083
|
objectKind,
|
|
18080
18084
|
toSqlConfig,
|
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.6",
|
|
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.6",
|
|
18
|
+
"@magda/scripts": "^2.0.0-alpha.6",
|
|
19
|
+
"@magda/typescript-common": "^2.0.0-alpha.6",
|
|
20
20
|
"fs-extra": "^2.1.2",
|
|
21
21
|
"webpack": "^4.41.2",
|
|
22
22
|
"webpack-cli": "^3.3.10"
|