reviewable-enterprise-tools 1.4.0 → 1.5.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.
- package/extract_data.js +12 -1
- package/lib/loadFirebase.js +5 -5
- package/orgs.json +3 -0
- package/package.json +4 -4
- package/users.json +3 -0
- package/.github/workflows/project.yaml +0 -15
package/extract_data.js
CHANGED
|
@@ -93,10 +93,11 @@ async function extract() {
|
|
|
93
93
|
await extractRepositories();
|
|
94
94
|
await extractRules();
|
|
95
95
|
reviewKeys = _.uniq(reviewKeys);
|
|
96
|
-
pace.total +=
|
|
96
|
+
pace.total += 4 * reviewKeys.length;
|
|
97
97
|
await extractReviews();
|
|
98
98
|
await extractLinemaps();
|
|
99
99
|
await extractFilemaps();
|
|
100
|
+
await extractBasemaps();
|
|
100
101
|
await extractUsers();
|
|
101
102
|
await out.end();
|
|
102
103
|
pace.op();
|
|
@@ -306,6 +307,16 @@ async function extractFilemaps() {
|
|
|
306
307
|
});
|
|
307
308
|
}
|
|
308
309
|
|
|
310
|
+
async function extractBasemaps() {
|
|
311
|
+
if (!reviewKeys.length) return;
|
|
312
|
+
log('Extracting basemaps');
|
|
313
|
+
await forEachLimit(reviewKeys, 25, async reviewKey => {
|
|
314
|
+
const basemap = await db.child('basemaps/:reviewKey', {reviewKey}).get();
|
|
315
|
+
await writeItem(`basemaps/${reviewKey}`, basemap);
|
|
316
|
+
pace.op();
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
309
320
|
async function extractUsers() {
|
|
310
321
|
if (_.isEmpty(userMap)) return;
|
|
311
322
|
log('Extracting users');
|
package/lib/loadFirebase.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as path from 'path';
|
|
|
5
5
|
import {fileURLToPath} from 'url';
|
|
6
6
|
import admin from 'firebase-admin';
|
|
7
7
|
import nodefireModule from 'nodefire';
|
|
8
|
-
import {
|
|
8
|
+
import {wrapDatabaseWithEncryption} from 'firecrypt';
|
|
9
9
|
|
|
10
10
|
const NodeFire = nodefireModule.default;
|
|
11
11
|
|
|
@@ -21,8 +21,6 @@ if (!process.env.REVIEWABLE_FIREBASE_URL) {
|
|
|
21
21
|
process.exit(1);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
if (process.env.REVIEWABLE_ENCRYPTION_AES_KEY) patchFirebase();
|
|
25
|
-
|
|
26
24
|
const firebaseConfig = {
|
|
27
25
|
databaseURL: process.env.REVIEWABLE_FIREBASE_URL,
|
|
28
26
|
databaseAuthVariableOverride: {uid: 'server'},
|
|
@@ -70,7 +68,9 @@ a key JSON file with the required values.`
|
|
|
70
68
|
|
|
71
69
|
admin.initializeApp(firebaseConfig);
|
|
72
70
|
|
|
71
|
+
let database = admin.database();
|
|
73
72
|
if (process.env.REVIEWABLE_ENCRYPTION_AES_KEY) {
|
|
73
|
+
const firecrypt = database = wrapDatabaseWithEncryption(database);
|
|
74
74
|
const options = {
|
|
75
75
|
algorithm: 'aes-siv', key: process.env.REVIEWABLE_ENCRYPTION_AES_KEY,
|
|
76
76
|
cacheSize: FIRECRYPT_CACHE_SIZE
|
|
@@ -78,9 +78,9 @@ if (process.env.REVIEWABLE_ENCRYPTION_AES_KEY) {
|
|
|
78
78
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
79
79
|
const specification = JSON.parse(fs.readFileSync(
|
|
80
80
|
path.join(dirname, '..', 'rules_firecrypt.json'), 'utf8'));
|
|
81
|
-
|
|
81
|
+
firecrypt.configureEncryption(options, specification);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
global.db = new NodeFire(
|
|
84
|
+
global.db = new NodeFire(database.ref());
|
|
85
85
|
|
|
86
86
|
export default admin;
|
package/orgs.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reviewable-enterprise-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Admin tools for Reviewable Enterprise",
|
|
6
6
|
"bin": {
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"command-line-usage": "^6.1.0",
|
|
41
41
|
"download": "^8.0.0",
|
|
42
42
|
"event-stream": "^4.0.1",
|
|
43
|
-
"firebase-admin": "
|
|
44
|
-
"firecrypt": "^
|
|
45
|
-
"hubkit": "^
|
|
43
|
+
"firebase-admin": "11.x",
|
|
44
|
+
"firecrypt": "^3.0.0",
|
|
45
|
+
"hubkit": "^4.0.0",
|
|
46
46
|
"lodash": "^4.17.20",
|
|
47
47
|
"ms": "^2.1.2",
|
|
48
48
|
"nodefire": "^3.0.0",
|
package/users.json
ADDED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
name: Move pull requests into Under Review
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
types: [opened]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
automate-project-columns:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: alex-page/github-project-automation-plus@v0.8.1
|
|
12
|
-
with:
|
|
13
|
-
project: Task Central
|
|
14
|
-
column: Under Review
|
|
15
|
-
repo-token: ${{ secrets.ORGANIZATION_PROJECT_TOKEN }}
|