@magda/scripts 3.0.0-alpha.0 → 3.0.0-alpha.1
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.
- package/acs-cmd/acs-cmd-admin-set.js +1 -1
- package/acs-cmd/acs-cmd-admin-unset.js +1 -1
- package/acs-cmd/acs-cmd-assign-permission.js +2 -2
- package/acs-cmd/acs-cmd-assign-role.js +2 -2
- package/acs-cmd/acs-cmd-create-operation.js +4 -4
- package/acs-cmd/acs-cmd-create-permission.js +2 -2
- package/acs-cmd/acs-cmd-jwt.js +2 -2
- package/acs-cmd/acs-cmd-remove-permission.js +2 -2
- package/acs-cmd/acs-cmd-remove-role.js +2 -2
- package/create-region-synonym-file.js +8 -23
- package/org-tree/org-tree-assign.js +2 -2
- package/org-tree/org-tree-create.js +1 -1
- package/org-tree/org-tree-delete.js +1 -1
- package/org-tree/org-tree-insert.js +2 -2
- package/org-tree/org-tree-move.js +2 -2
- package/org-tree/org-tree-unassign.js +1 -1
- package/package.json +6 -8
- package/tools/swagger-codegen-cli.jar +0 -0
|
@@ -10,8 +10,8 @@ const pool = getDBPool();
|
|
|
10
10
|
|
|
11
11
|
program
|
|
12
12
|
.description("assign the permission to a role")
|
|
13
|
-
.
|
|
14
|
-
.
|
|
13
|
+
.argument("<permissionId>", "Permission ID")
|
|
14
|
+
.argument("<roleId>", "Role ID")
|
|
15
15
|
.version(pkg.version)
|
|
16
16
|
.action(async (permissionId, roleId) => {
|
|
17
17
|
try {
|
|
@@ -10,8 +10,8 @@ const pool = getDBPool();
|
|
|
10
10
|
|
|
11
11
|
program
|
|
12
12
|
.description("assign the role to a user")
|
|
13
|
-
.
|
|
14
|
-
.
|
|
13
|
+
.argument("<roleId>", "Role ID")
|
|
14
|
+
.argument("<userId>", "User ID")
|
|
15
15
|
.version(pkg.version)
|
|
16
16
|
.action(async (roleId, userId) => {
|
|
17
17
|
try {
|
|
@@ -10,10 +10,10 @@ const pool = getDBPool();
|
|
|
10
10
|
program
|
|
11
11
|
.version(pkg.version)
|
|
12
12
|
.description(`A tool for creating operations. Version: ${pkg.version}`)
|
|
13
|
-
.
|
|
14
|
-
.
|
|
15
|
-
.
|
|
16
|
-
.
|
|
13
|
+
.argument("<permission>", "Permission name")
|
|
14
|
+
.argument("<uri>", "Operation uri")
|
|
15
|
+
.argument("<name>", "Operation name")
|
|
16
|
+
.argument("<description>", "Operation description")
|
|
17
17
|
.action(async (permissionName, uri, name, description) => {
|
|
18
18
|
try {
|
|
19
19
|
await pool.query("BEGIN TRANSACTION");
|
|
@@ -10,8 +10,8 @@ const pool = getDBPool();
|
|
|
10
10
|
program
|
|
11
11
|
.version(pkg.version)
|
|
12
12
|
.description(`A tool for creating permissions. Version: ${pkg.version}`)
|
|
13
|
-
.
|
|
14
|
-
.
|
|
13
|
+
.argument("<name>", "Permission name")
|
|
14
|
+
.argument("<description>", "Permission description")
|
|
15
15
|
.action(async (name, description) => {
|
|
16
16
|
try {
|
|
17
17
|
await pool.query(
|
package/acs-cmd/acs-cmd-jwt.js
CHANGED
|
@@ -11,8 +11,8 @@ program
|
|
|
11
11
|
.description(
|
|
12
12
|
`calculate JWT token (only for testing purpose). Version: ${pkg.version}`
|
|
13
13
|
)
|
|
14
|
-
.
|
|
15
|
-
.
|
|
14
|
+
.argument("<userId>", "User ID")
|
|
15
|
+
.argument(
|
|
16
16
|
"[jwtSecret]",
|
|
17
17
|
"Optional JWT secret. Default value: `" + DEFAULT_JWT_SECRET + "`"
|
|
18
18
|
)
|
|
@@ -10,8 +10,8 @@ const pool = getDBPool();
|
|
|
10
10
|
|
|
11
11
|
program
|
|
12
12
|
.description("Remove a permission from a role")
|
|
13
|
-
.
|
|
14
|
-
.
|
|
13
|
+
.argument("<permissionId>", "Permission ID")
|
|
14
|
+
.argument("<roleId>", "Role ID")
|
|
15
15
|
.version(pkg.version)
|
|
16
16
|
.action(async (permissionId, roleId) => {
|
|
17
17
|
try {
|
|
@@ -10,8 +10,8 @@ const pool = getDBPool();
|
|
|
10
10
|
|
|
11
11
|
program
|
|
12
12
|
.description("Remove a role from a user")
|
|
13
|
-
.
|
|
14
|
-
.
|
|
13
|
+
.argument("<roleId>", "Role ID")
|
|
14
|
+
.argument("<userId>", "User ID")
|
|
15
15
|
.version(pkg.version)
|
|
16
16
|
.action(async (roleId, userId) => {
|
|
17
17
|
try {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import _ from "lodash";
|
|
3
3
|
import yargs from "yargs";
|
|
4
4
|
import fs from "fs";
|
|
5
|
-
import
|
|
5
|
+
import fetch from "node-fetch";
|
|
6
6
|
import StreamArray from "stream-json/streamers/StreamArray.js";
|
|
7
7
|
|
|
8
8
|
function getDefaultRegionSourceConfig() {
|
|
@@ -85,28 +85,13 @@ function createLineFromRegionData(regionConfig, item) {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
async function getRemoteDataFileStream(url) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
response.statusCode >= 200 &&
|
|
96
|
-
response.statusCode <= 299
|
|
97
|
-
) {
|
|
98
|
-
resolve(response.pipe(StreamArray.withParser()));
|
|
99
|
-
} else {
|
|
100
|
-
throw new Error(
|
|
101
|
-
`Request failed ${url}, statusCode: ${response.statusCode}`
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
} catch (e) {
|
|
105
|
-
console.error(e);
|
|
106
|
-
reject(e);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
});
|
|
88
|
+
const res = await fetch(url);
|
|
89
|
+
if (!res.ok) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
`Request failed ${url}, statusCode: ${res.status} ${res.statusText}`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return res.body.pipe(StreamArray.withParser());
|
|
110
95
|
}
|
|
111
96
|
|
|
112
97
|
async function processRegionDataPipeline(regionConfig, targetStream) {
|
|
@@ -14,8 +14,8 @@ program
|
|
|
14
14
|
"\nBoth `userNameOrId` & `nodeNameOrId` can be either entity name or Id. \n" +
|
|
15
15
|
"\tIf more than one entities are located by entity name, the first one will be used."
|
|
16
16
|
)
|
|
17
|
-
.
|
|
18
|
-
.
|
|
17
|
+
.argument("<userNameOrId>", "user name or id")
|
|
18
|
+
.argument("<nodeNameOrId>", "org unit node id or name")
|
|
19
19
|
.version(pkg.version)
|
|
20
20
|
.action(async (userNameOrId, parentNodeNameOrId) => {
|
|
21
21
|
try {
|
|
@@ -10,7 +10,7 @@ program
|
|
|
10
10
|
.description(
|
|
11
11
|
`Create a root tree node with specified name. You can then complete other node fields using other DB admin tools.`
|
|
12
12
|
)
|
|
13
|
-
.
|
|
13
|
+
.argument("<nodeName>", "Root node name")
|
|
14
14
|
.version(pkg.version)
|
|
15
15
|
.action(async (nodeName) => {
|
|
16
16
|
try {
|
|
@@ -14,7 +14,7 @@ program
|
|
|
14
14
|
"\nIf -o or --only switch is on, only specified node will be removed and its children (if any) " +
|
|
15
15
|
"will become its parent's children."
|
|
16
16
|
)
|
|
17
|
-
.
|
|
17
|
+
.argument("<nodeNameOrId>", "node name or id that to be removed")
|
|
18
18
|
.option(
|
|
19
19
|
"-o, --only",
|
|
20
20
|
"If only remove specified node and left its children (if any) to its parent"
|
|
@@ -12,8 +12,8 @@ program
|
|
|
12
12
|
"Insert a node as a child node of the specified the parent node with specified name. " +
|
|
13
13
|
"\nIf the parent node name is given instead of the parent node Id, the newly created child node will be inserted to the first located parent node."
|
|
14
14
|
)
|
|
15
|
-
.
|
|
16
|
-
.
|
|
15
|
+
.argument("<parentNodeNameOrId>", "parent node id or name")
|
|
16
|
+
.argument("<nodeName>", "insert node name")
|
|
17
17
|
.version(pkg.version)
|
|
18
18
|
.action(async (parentNodeNameOrId, nodeName) => {
|
|
19
19
|
try {
|
|
@@ -13,8 +13,8 @@ program
|
|
|
13
13
|
"\nIf the node name is given instead of the node Id, the first located node (and its dependents) will be moved." +
|
|
14
14
|
"\nIf the parent node name is given instead of the parent node Id, the specifed node will be moved to the first located parent node."
|
|
15
15
|
)
|
|
16
|
-
.
|
|
17
|
-
.
|
|
16
|
+
.argument("<nodeNameOrId>", "The id or name of the node to be moved")
|
|
17
|
+
.argument("<parentNodeNameOrId>", "The new parent node id or name")
|
|
18
18
|
.version(pkg.version)
|
|
19
19
|
.action(async (nodeNameOrId, parentNodeNameOrId) => {
|
|
20
20
|
try {
|
|
@@ -8,7 +8,7 @@ import getUserIdFromNameOrId from "./getUserIdFromNameOrId.js";
|
|
|
8
8
|
|
|
9
9
|
program
|
|
10
10
|
.description("Remove the specified user to from any org unit.")
|
|
11
|
-
.
|
|
11
|
+
.argument("<userNameOrId>", "user name or id")
|
|
12
12
|
.version(pkg.version)
|
|
13
13
|
.action(async (userNameOrId) => {
|
|
14
14
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magda/scripts",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.1",
|
|
4
4
|
"description": "Scripts for building, running, and deploying MAGDA",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -34,8 +34,7 @@
|
|
|
34
34
|
"release": "npm publish || echo \"Skip releasing npm package @magda/scripts.\""
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/pg": "^8.6.5"
|
|
38
|
-
"@types/request": "^2.48.1"
|
|
37
|
+
"@types/pg": "^8.6.5"
|
|
39
38
|
},
|
|
40
39
|
"magda": {
|
|
41
40
|
"language": "javascript",
|
|
@@ -46,7 +45,7 @@
|
|
|
46
45
|
},
|
|
47
46
|
"dependencies": {
|
|
48
47
|
"@magda/esm-utils": "^1.0.1",
|
|
49
|
-
"@magda/typescript-common": "^3.0.0-alpha.
|
|
48
|
+
"@magda/typescript-common": "^3.0.0-alpha.1",
|
|
50
49
|
"ansi-styles": "^3.2.1",
|
|
51
50
|
"apidoc": "https://github.com/magda-io/apidoc",
|
|
52
51
|
"chalk": "^2.4.1",
|
|
@@ -65,11 +64,10 @@
|
|
|
65
64
|
"klaw-sync": "^2.1.0",
|
|
66
65
|
"lodash": "^4.17.5",
|
|
67
66
|
"moment": "^2.19.4",
|
|
67
|
+
"node-fetch": "^3.3.2",
|
|
68
68
|
"nodemon": "^1.11.0",
|
|
69
|
-
"pg": "^8.
|
|
70
|
-
"pkg": "^4.3.4",
|
|
69
|
+
"pg": "^8.11.3",
|
|
71
70
|
"pwgen": "0.1.6",
|
|
72
|
-
"request": "^2.88.0",
|
|
73
71
|
"stream-json": "^1.1.3",
|
|
74
72
|
"strip-ansi": "^4.0.0",
|
|
75
73
|
"strip-json-comments": "^2.0.1",
|
|
@@ -77,7 +75,7 @@
|
|
|
77
75
|
"tmp": "0.0.31",
|
|
78
76
|
"toposort": "^1.0.6",
|
|
79
77
|
"tsx": "^4.7.0",
|
|
80
|
-
"typescript": "~5.
|
|
78
|
+
"typescript": "~5.3.3",
|
|
81
79
|
"uniqid": "^5.0.3",
|
|
82
80
|
"yaml": "^1.10.0",
|
|
83
81
|
"yargs": "^12.0.5"
|
|
Binary file
|