dce-expresskit 4.0.0 → 4.2.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/lib/constants/LOG_REVIEW_PAGE_SIZE.d.ts +6 -0
- package/lib/constants/LOG_REVIEW_PAGE_SIZE.js +9 -0
- package/lib/constants/LOG_REVIEW_PAGE_SIZE.js.map +1 -0
- package/lib/helpers/dataSigner.js +7 -5
- package/lib/helpers/dataSigner.js.map +1 -1
- package/lib/helpers/genRouteHandler.js +45 -20
- package/lib/helpers/genRouteHandler.js.map +1 -1
- package/lib/helpers/getLogReviewerLogs.d.ts +27 -0
- package/lib/helpers/getLogReviewerLogs.js +238 -0
- package/lib/helpers/getLogReviewerLogs.js.map +1 -0
- package/lib/helpers/initExpressKitCollections.d.ts +33 -0
- package/lib/helpers/initExpressKitCollections.js +180 -0
- package/lib/helpers/initExpressKitCollections.js.map +1 -0
- package/lib/helpers/initServer.d.ts +0 -33
- package/lib/helpers/initServer.js +31 -75
- package/lib/helpers/initServer.js.map +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +3 -5
- package/lib/index.js.map +1 -1
- package/lib/types/ExpressKitErrorCode.d.ts +2 -1
- package/lib/types/ExpressKitErrorCode.js +1 -0
- package/lib/types/ExpressKitErrorCode.js.map +1 -1
- package/lib/types/LogReviewerAdmin.d.ts +10 -0
- package/lib/types/LogReviewerAdmin.js +3 -0
- package/lib/types/LogReviewerAdmin.js.map +1 -0
- package/lib/types/SelectAdmin.d.ts +10 -0
- package/lib/types/SelectAdmin.js +3 -0
- package/lib/types/SelectAdmin.js.map +1 -0
- package/package.json +2 -2
- package/src/constants/LOG_REVIEW_PAGE_SIZE.ts +7 -0
- package/src/helpers/dataSigner.ts +2 -2
- package/src/helpers/genRouteHandler.ts +28 -4
- package/src/helpers/getLogReviewerLogs.ts +260 -0
- package/src/helpers/initExpressKitCollections.ts +144 -0
- package/src/helpers/initServer.ts +43 -84
- package/src/index.ts +2 -4
- package/src/types/ExpressKitErrorCode.ts +1 -0
- package/src/types/LogReviewerAdmin.ts +14 -0
- package/src/types/SelectAdmin.ts +14 -0
- package/src/helpers/initCrossServerCredentialCollection.ts +0 -19
- package/src/helpers/initLogCollection.ts +0 -30
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.internalGetLogReviewerAdminCollection = exports.internalGetSelectAdminCollection = exports.internalGetCrossServerCredentialCollection = exports.internalGetLogCollection = void 0;
|
|
40
|
+
/*------------------------------------------------------------------------*/
|
|
41
|
+
/* ------------------------- Collection Storage ------------------------- */
|
|
42
|
+
/*------------------------------------------------------------------------*/
|
|
43
|
+
// Variables to store collections
|
|
44
|
+
var logCollection;
|
|
45
|
+
var crossServerCredentialCollection;
|
|
46
|
+
var selectAdminCollection;
|
|
47
|
+
var logReviewerAdminCollection;
|
|
48
|
+
// Promise that resolves when all collections are initialized
|
|
49
|
+
var collectionsInitializedResolve;
|
|
50
|
+
var collectionsInitializedReject;
|
|
51
|
+
var collectionsInitialized = new Promise(function (resolve, reject) {
|
|
52
|
+
collectionsInitializedResolve = resolve;
|
|
53
|
+
collectionsInitializedReject = reject;
|
|
54
|
+
});
|
|
55
|
+
/*------------------------------------------------------------------------*/
|
|
56
|
+
/* ------------------------- Collection Getters ------------------------- */
|
|
57
|
+
/*------------------------------------------------------------------------*/
|
|
58
|
+
/**
|
|
59
|
+
* Get the log collection after initialization
|
|
60
|
+
* @author Gardenia Liu
|
|
61
|
+
*/
|
|
62
|
+
var internalGetLogCollection = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
switch (_a.label) {
|
|
65
|
+
case 0:
|
|
66
|
+
// Wait for collections to be initialized
|
|
67
|
+
return [4 /*yield*/, collectionsInitialized];
|
|
68
|
+
case 1:
|
|
69
|
+
// Wait for collections to be initialized
|
|
70
|
+
_a.sent();
|
|
71
|
+
// Return the log collection
|
|
72
|
+
return [2 /*return*/, logCollection];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}); };
|
|
76
|
+
exports.internalGetLogCollection = internalGetLogCollection;
|
|
77
|
+
/**
|
|
78
|
+
* Get the cross server credential collection after initialization
|
|
79
|
+
* @author Gardenia Liu
|
|
80
|
+
*/
|
|
81
|
+
var internalGetCrossServerCredentialCollection = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
|
+
return __generator(this, function (_a) {
|
|
83
|
+
switch (_a.label) {
|
|
84
|
+
case 0:
|
|
85
|
+
// Wait for collections to be initialized
|
|
86
|
+
return [4 /*yield*/, collectionsInitialized];
|
|
87
|
+
case 1:
|
|
88
|
+
// Wait for collections to be initialized
|
|
89
|
+
_a.sent();
|
|
90
|
+
// Return the cross server credential collection
|
|
91
|
+
return [2 /*return*/, crossServerCredentialCollection];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}); };
|
|
95
|
+
exports.internalGetCrossServerCredentialCollection = internalGetCrossServerCredentialCollection;
|
|
96
|
+
/**
|
|
97
|
+
* Get the select admin collection after initialization
|
|
98
|
+
* @author Gardenia Liu
|
|
99
|
+
*/
|
|
100
|
+
var internalGetSelectAdminCollection = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
switch (_a.label) {
|
|
103
|
+
case 0:
|
|
104
|
+
// Wait for collections to be initialized
|
|
105
|
+
return [4 /*yield*/, collectionsInitialized];
|
|
106
|
+
case 1:
|
|
107
|
+
// Wait for collections to be initialized
|
|
108
|
+
_a.sent();
|
|
109
|
+
// Return the cross server credential collection
|
|
110
|
+
return [2 /*return*/, selectAdminCollection];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}); };
|
|
114
|
+
exports.internalGetSelectAdminCollection = internalGetSelectAdminCollection;
|
|
115
|
+
/**
|
|
116
|
+
* Get the log reviewer admin collection after initialization
|
|
117
|
+
* @author Yuen Ler Chow
|
|
118
|
+
*/
|
|
119
|
+
var internalGetLogReviewerAdminCollection = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
120
|
+
return __generator(this, function (_a) {
|
|
121
|
+
switch (_a.label) {
|
|
122
|
+
case 0:
|
|
123
|
+
// Wait for collections to be initialized
|
|
124
|
+
return [4 /*yield*/, collectionsInitialized];
|
|
125
|
+
case 1:
|
|
126
|
+
// Wait for collections to be initialized
|
|
127
|
+
_a.sent();
|
|
128
|
+
// Return the log reviewer admin collection
|
|
129
|
+
return [2 /*return*/, logReviewerAdminCollection];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}); };
|
|
133
|
+
exports.internalGetLogReviewerAdminCollection = internalGetLogReviewerAdminCollection;
|
|
134
|
+
/*------------------------------------------------------------------------*/
|
|
135
|
+
/* -------------------------------- Main -------------------------------- */
|
|
136
|
+
/*------------------------------------------------------------------------*/
|
|
137
|
+
/**
|
|
138
|
+
* Initialize all collections required for expresskit
|
|
139
|
+
* @author Gardenia Liu
|
|
140
|
+
* @author Gabe Abrams
|
|
141
|
+
* @param Collection the Collection class from dce-mango
|
|
142
|
+
*/
|
|
143
|
+
var initExpressKitCollections = function (Collection) {
|
|
144
|
+
try {
|
|
145
|
+
// Create and store log collection
|
|
146
|
+
logCollection = new Collection('Log', {
|
|
147
|
+
uniqueIndexKey: 'id',
|
|
148
|
+
indexKeys: [
|
|
149
|
+
'courseId',
|
|
150
|
+
'context',
|
|
151
|
+
'subcontext',
|
|
152
|
+
'tags',
|
|
153
|
+
'year',
|
|
154
|
+
'month',
|
|
155
|
+
'day',
|
|
156
|
+
'hour',
|
|
157
|
+
'type',
|
|
158
|
+
],
|
|
159
|
+
});
|
|
160
|
+
// Create and store cross server credential collection
|
|
161
|
+
crossServerCredentialCollection = new Collection('CrossServerCredential', {
|
|
162
|
+
uniqueIndexKey: 'key',
|
|
163
|
+
});
|
|
164
|
+
// Create and store select admin collection
|
|
165
|
+
selectAdminCollection = new Collection('SelectAdmin', {
|
|
166
|
+
uniqueIndexKey: 'id',
|
|
167
|
+
});
|
|
168
|
+
// Create and store log reviewer admin collection
|
|
169
|
+
logReviewerAdminCollection = new Collection('LogReviewerAdmin', {
|
|
170
|
+
uniqueIndexKey: 'id',
|
|
171
|
+
});
|
|
172
|
+
// Finished! Resolve the promise
|
|
173
|
+
collectionsInitializedResolve();
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
return collectionsInitializedReject(err);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
exports.default = initExpressKitCollections;
|
|
180
|
+
//# sourceMappingURL=initExpressKitCollections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initExpressKitCollections.js","sourceRoot":"","sources":["../../src/helpers/initExpressKitCollections.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,iCAAiC;AACjC,IAAI,aAAmC,CAAC;AACxC,IAAI,+BAAuE,CAAC;AAC5E,IAAI,qBAAmD,CAAC;AACxD,IAAI,0BAA6D,CAAC;AAElE,6DAA6D;AAC7D,IAAI,6BA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AAa,GAAG,IAAI,UAAU,CAC5B,KAAK,EACL;YACE,cAAc,EAAE,IAAI;YACpB,SAAS,EAAE;gBACT,UAAU;gBACV,SAAS;gBACT,YAAY;gBACZ,MAAM;gBACN,MAAM;gBACN,OAAO;gBACP,KAAK;gBACL,MAAM;gBACN,MAAM;aACP;SACF,CACF,CAAC;QAEF,sDAAsD;QACtD,+BAA+B,GAAG,IAAI,UAAU,CAC9C,uBAAuB,EACvB;YACE,cAAc,EAAE,KAAK;SACtB,CACF,CAAC;QAEF,2CAA2C;QAC3C,qBAAqB,GAAG,IAAI,UAAU,CACpC,aAAa,EACb;YACE,cAAc,EAAE,IAAI;SACrB,CACF,CAAC;QAEF,iDAAiD;QACjD,0BAA0B,GAAG,IAAI,UAAU,CACzC,kBAAkB,EAClB;YACE,cAAc,EAAE,IAAI;SACrB,CACF,CAAC;QAEF,gCAAgC;QAChC,6BAA6B,EAAE,CAAC;IAClC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,4BAA4B,CAAC,GAAY,CAAC,CAAC;IACpD,CAAC;AACH,CAAC,CAAC;AAEF,kBAAe,yBAAyB,CAAC"}
|
|
@@ -1,45 +1,12 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
-
import { Collection } from 'dce-mango';
|
|
3
|
-
import { Log } from 'dce-reactkit';
|
|
4
|
-
import CrossServerCredential from '../types/CrossServerCredential';
|
|
5
|
-
/**
|
|
6
|
-
* Get log collection
|
|
7
|
-
* @author Gabe Abrams
|
|
8
|
-
* @returns log collection if one was included during launch or null if we don't
|
|
9
|
-
* have a log collection (yet)
|
|
10
|
-
*/
|
|
11
|
-
export declare const internalGetLogCollection: () => Collection<Log>;
|
|
12
|
-
/**
|
|
13
|
-
* Get cross-server credential collection
|
|
14
|
-
* @author Gabe Abrams
|
|
15
|
-
* @return cross-server credential collection if one was included during launch or null
|
|
16
|
-
* if we don't have a cross-server credential collection (yet)
|
|
17
|
-
*/
|
|
18
|
-
export declare const internalGetCrossServerCredentialCollection: () => Collection<CrossServerCredential>;
|
|
19
2
|
/**
|
|
20
3
|
* Prepare dce-reactkit to run on the server
|
|
21
4
|
* @author Gabe Abrams
|
|
22
5
|
* @param opts object containing all arguments
|
|
23
6
|
* @param opts.app express app from inside of the postprocessor function that
|
|
24
7
|
* we will add routes to
|
|
25
|
-
* @param opts.getLaunchInfo CACCL LTI's get launch info function
|
|
26
|
-
* @param [opts.logCollection] mongo collection from dce-mango to use for
|
|
27
|
-
* storing logs. If none is included, logs are written to the console
|
|
28
|
-
* @param [opts.logReviewAdmins=all] info on which admins can review
|
|
29
|
-
* logs from the client. If not included, all Canvas admins are allowed to
|
|
30
|
-
* review logs. If null, no Canvas admins are allowed to review logs.
|
|
31
|
-
* If an array of Canvas userIds (numbers), only Canvas admins with those
|
|
32
|
-
* userIds are allowed to review logs. If a dce-mango collection, only
|
|
33
|
-
* Canvas admins with entries in that collection ({ userId, ...}) are allowed
|
|
34
|
-
* to review logs
|
|
35
|
-
* @param [opts.crossServerCredentialCollection] mongo collection from dce-mango to use for
|
|
36
|
-
* storing cross-server credentials. If none is included, cross-server credentials
|
|
37
|
-
* are not supported
|
|
38
8
|
*/
|
|
39
9
|
declare const initServer: (opts: {
|
|
40
10
|
app: express.Application;
|
|
41
|
-
logReviewAdmins?: (number[] | Collection<any>);
|
|
42
|
-
logCollection?: Collection<Log>;
|
|
43
|
-
crossServerCredentialCollection?: Collection<CrossServerCredential>;
|
|
44
11
|
}) => void;
|
|
45
12
|
export default initServer;
|
|
@@ -50,40 +50,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.internalGetCrossServerCredentialCollection = exports.internalGetLogCollection = void 0;
|
|
54
53
|
// Import dce-reactkit
|
|
55
54
|
var dce_reactkit_1 = require("dce-reactkit");
|
|
56
55
|
// Import shared helpers
|
|
57
56
|
var genRouteHandler_1 = __importDefault(require("./genRouteHandler"));
|
|
57
|
+
var getLogReviewerLogs_1 = __importDefault(require("./getLogReviewerLogs"));
|
|
58
58
|
// Import shared types
|
|
59
59
|
var ExpressKitErrorCode_1 = __importDefault(require("../types/ExpressKitErrorCode"));
|
|
60
|
-
//
|
|
61
|
-
var
|
|
62
|
-
// Stored copy of dce-mango cross-server credential collection
|
|
63
|
-
var _crossServerCredentialCollection;
|
|
64
|
-
/*------------------------------------------------------------------------*/
|
|
65
|
-
/* Helpers */
|
|
66
|
-
/*------------------------------------------------------------------------*/
|
|
67
|
-
/**
|
|
68
|
-
* Get log collection
|
|
69
|
-
* @author Gabe Abrams
|
|
70
|
-
* @returns log collection if one was included during launch or null if we don't
|
|
71
|
-
* have a log collection (yet)
|
|
72
|
-
*/
|
|
73
|
-
var internalGetLogCollection = function () {
|
|
74
|
-
return _logCollection !== null && _logCollection !== void 0 ? _logCollection : null;
|
|
75
|
-
};
|
|
76
|
-
exports.internalGetLogCollection = internalGetLogCollection;
|
|
77
|
-
/**
|
|
78
|
-
* Get cross-server credential collection
|
|
79
|
-
* @author Gabe Abrams
|
|
80
|
-
* @return cross-server credential collection if one was included during launch or null
|
|
81
|
-
* if we don't have a cross-server credential collection (yet)
|
|
82
|
-
*/
|
|
83
|
-
var internalGetCrossServerCredentialCollection = function () {
|
|
84
|
-
return _crossServerCredentialCollection !== null && _crossServerCredentialCollection !== void 0 ? _crossServerCredentialCollection : null;
|
|
85
|
-
};
|
|
86
|
-
exports.internalGetCrossServerCredentialCollection = internalGetCrossServerCredentialCollection;
|
|
60
|
+
// Import shared helpers
|
|
61
|
+
var initExpressKitCollections_1 = require("./initExpressKitCollections");
|
|
87
62
|
/*------------------------------------------------------------------------*/
|
|
88
63
|
/* Main */
|
|
89
64
|
/*------------------------------------------------------------------------*/
|
|
@@ -93,23 +68,8 @@ exports.internalGetCrossServerCredentialCollection = internalGetCrossServerCrede
|
|
|
93
68
|
* @param opts object containing all arguments
|
|
94
69
|
* @param opts.app express app from inside of the postprocessor function that
|
|
95
70
|
* we will add routes to
|
|
96
|
-
* @param opts.getLaunchInfo CACCL LTI's get launch info function
|
|
97
|
-
* @param [opts.logCollection] mongo collection from dce-mango to use for
|
|
98
|
-
* storing logs. If none is included, logs are written to the console
|
|
99
|
-
* @param [opts.logReviewAdmins=all] info on which admins can review
|
|
100
|
-
* logs from the client. If not included, all Canvas admins are allowed to
|
|
101
|
-
* review logs. If null, no Canvas admins are allowed to review logs.
|
|
102
|
-
* If an array of Canvas userIds (numbers), only Canvas admins with those
|
|
103
|
-
* userIds are allowed to review logs. If a dce-mango collection, only
|
|
104
|
-
* Canvas admins with entries in that collection ({ userId, ...}) are allowed
|
|
105
|
-
* to review logs
|
|
106
|
-
* @param [opts.crossServerCredentialCollection] mongo collection from dce-mango to use for
|
|
107
|
-
* storing cross-server credentials. If none is included, cross-server credentials
|
|
108
|
-
* are not supported
|
|
109
71
|
*/
|
|
110
72
|
var initServer = function (opts) {
|
|
111
|
-
_logCollection = opts.logCollection;
|
|
112
|
-
_crossServerCredentialCollection = opts.crossServerCredentialCollection;
|
|
113
73
|
/*----------------------------------------*/
|
|
114
74
|
/* Logging */
|
|
115
75
|
/*----------------------------------------*/
|
|
@@ -191,7 +151,7 @@ var initServer = function (opts) {
|
|
|
191
151
|
* @returns true if the user can review logs
|
|
192
152
|
*/
|
|
193
153
|
var canReviewLogs = function (userId, isAdmin) { return __awaiter(void 0, void 0, void 0, function () {
|
|
194
|
-
var matches, err_1;
|
|
154
|
+
var logReviewerAdminCollection, matches, err_1;
|
|
195
155
|
return __generator(this, function (_a) {
|
|
196
156
|
switch (_a.label) {
|
|
197
157
|
case 0:
|
|
@@ -199,29 +159,22 @@ var initServer = function (opts) {
|
|
|
199
159
|
if (!isAdmin) {
|
|
200
160
|
return [2 /*return*/, false];
|
|
201
161
|
}
|
|
202
|
-
|
|
203
|
-
if (!opts.logReviewAdmins) {
|
|
204
|
-
return [2 /*return*/, true];
|
|
205
|
-
}
|
|
206
|
-
_a.label = 1;
|
|
162
|
+
return [4 /*yield*/, (0, initExpressKitCollections_1.internalGetLogReviewerAdminCollection)()];
|
|
207
163
|
case 1:
|
|
208
|
-
_a.
|
|
209
|
-
|
|
210
|
-
if (Array.isArray(opts.logReviewAdmins)) {
|
|
211
|
-
return [2 /*return*/, opts.logReviewAdmins.some(function (allowedId) {
|
|
212
|
-
return (userId === allowedId);
|
|
213
|
-
})];
|
|
214
|
-
}
|
|
215
|
-
return [4 /*yield*/, opts.logReviewAdmins.find({ userId: userId })];
|
|
164
|
+
logReviewerAdminCollection = _a.sent();
|
|
165
|
+
_a.label = 2;
|
|
216
166
|
case 2:
|
|
167
|
+
_a.trys.push([2, 4, , 5]);
|
|
168
|
+
return [4 /*yield*/, logReviewerAdminCollection.find({ id: userId })];
|
|
169
|
+
case 3:
|
|
217
170
|
matches = _a.sent();
|
|
218
171
|
// Make sure at least one entry matches
|
|
219
172
|
return [2 /*return*/, matches.length > 0];
|
|
220
|
-
case
|
|
173
|
+
case 4:
|
|
221
174
|
err_1 = _a.sent();
|
|
222
175
|
// If an error occurred, simply return false
|
|
223
176
|
return [2 /*return*/, false];
|
|
224
|
-
case
|
|
177
|
+
case 5: return [2 /*return*/];
|
|
225
178
|
}
|
|
226
179
|
});
|
|
227
180
|
}); };
|
|
@@ -241,46 +194,49 @@ var initServer = function (opts) {
|
|
|
241
194
|
return [4 /*yield*/, canReviewLogs(userId, isAdmin)];
|
|
242
195
|
case 1:
|
|
243
196
|
canReview = _c.sent();
|
|
197
|
+
// Return result
|
|
244
198
|
return [2 /*return*/, canReview];
|
|
245
199
|
}
|
|
246
200
|
});
|
|
247
201
|
}); },
|
|
248
202
|
}));
|
|
249
203
|
/**
|
|
250
|
-
* Get
|
|
204
|
+
* Get filtered logs based on provided filters
|
|
251
205
|
* @author Gabe Abrams
|
|
252
|
-
* @
|
|
253
|
-
* @param
|
|
254
|
-
* @
|
|
206
|
+
* @author Yuen Ler Chow
|
|
207
|
+
* @param pageNumber the page number to get
|
|
208
|
+
* @param filters the filters to apply to the logs
|
|
209
|
+
* @returns {Log[]} list of logs that match the filters
|
|
255
210
|
*/
|
|
256
|
-
opts.app.get(
|
|
211
|
+
opts.app.get(dce_reactkit_1.LOG_REVIEW_GET_LOGS_ROUTE, (0, genRouteHandler_1.default)({
|
|
257
212
|
paramTypes: {
|
|
258
|
-
year: dce_reactkit_1.ParamType.Int,
|
|
259
|
-
month: dce_reactkit_1.ParamType.Int,
|
|
260
213
|
pageNumber: dce_reactkit_1.ParamType.Int,
|
|
214
|
+
filters: dce_reactkit_1.ParamType.JSON,
|
|
215
|
+
countDocuments: dce_reactkit_1.ParamType.Boolean,
|
|
261
216
|
},
|
|
262
217
|
handler: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
263
|
-
var
|
|
218
|
+
var pageNumber, userId, isAdmin, filters, countDocuments, canReview, logCollection, response;
|
|
264
219
|
var params = _b.params;
|
|
265
220
|
return __generator(this, function (_c) {
|
|
266
221
|
switch (_c.label) {
|
|
267
222
|
case 0:
|
|
268
|
-
|
|
223
|
+
pageNumber = params.pageNumber, userId = params.userId, isAdmin = params.isAdmin, filters = params.filters, countDocuments = params.countDocuments;
|
|
269
224
|
return [4 /*yield*/, canReviewLogs(userId, isAdmin)];
|
|
270
225
|
case 1:
|
|
271
226
|
canReview = _c.sent();
|
|
272
227
|
if (!canReview) {
|
|
273
228
|
throw new dce_reactkit_1.ErrorWithCode('You cannot access this resource because you do not have the appropriate permissions.', ExpressKitErrorCode_1.default.NotAllowedToReviewLogs);
|
|
274
229
|
}
|
|
275
|
-
return [4 /*yield*/,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
},
|
|
280
|
-
perPage: 1000,
|
|
230
|
+
return [4 /*yield*/, (0, initExpressKitCollections_1.internalGetLogCollection)()];
|
|
231
|
+
case 2:
|
|
232
|
+
logCollection = _c.sent();
|
|
233
|
+
return [4 /*yield*/, (0, getLogReviewerLogs_1.default)({
|
|
281
234
|
pageNumber: pageNumber,
|
|
235
|
+
filters: filters,
|
|
236
|
+
countDocuments: countDocuments,
|
|
237
|
+
logCollection: logCollection,
|
|
282
238
|
})];
|
|
283
|
-
case
|
|
239
|
+
case 3:
|
|
284
240
|
response = _c.sent();
|
|
285
241
|
// Return response
|
|
286
242
|
return [2 /*return*/, response];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initServer.js","sourceRoot":"","sources":["../../src/helpers/initServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initServer.js","sourceRoot":"","sources":["../../src/helpers/initServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,sBAAsB;AACtB,6CAOsB;AAEtB,wBAAwB;AACxB,sEAAgD;AAChD,4EAAsD;AAEtD,sBAAsB;AACtB,qFAA+D;AAE/D,wBAAwB;AACxB,yEAGqC;AAErC,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E;;;;;;GAMG;AACH,IAAM,UAAU,GAAG,UACjB,IAEC;IAED,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAE5C;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,CAAC,GAAG,CAAC,IAAI,CACX,6BAAc,EACd,IAAA,yBAAe,EAAC;QACd,UAAU,EAAE;YACV,OAAO,EAAE,wBAAS,CAAC,MAAM;YACzB,UAAU,EAAE,wBAAS,CAAC,MAAM;YAC5B,IAAI,EAAE,wBAAS,CAAC,IAAI;YACpB,KAAK,EAAE,wBAAS,CAAC,MAAM;YACvB,QAAQ,EAAE,wBAAS,CAAC,IAAI;YACxB,YAAY,EAAE,wBAAS,CAAC,cAAc;YACtC,SAAS,EAAE,wBAAS,CAAC,cAAc;YACnC,UAAU,EAAE,wBAAS,CAAC,cAAc;YACpC,MAAM,EAAE,wBAAS,CAAC,cAAc;YA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CACL;wBAGO,qBAAM,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EAAA;;wBAAhD,SAAS,GAAG,SAAoC;wBACtD,IAAI,CAAC,SAAS,EAAE,CAAC;4BACf,MAAM,IAAI,4BAAa,CACrB,sFAAsF,EACtF,6BAAmB,CAAC,sBAAsB,CAC3C,CAAC;wBACJ,CAAC;wBAGqB,qBAAM,IAAA,oDAAwB,GAAE,EAAA;;wBAAhD,aAAa,GAAG,SAAgC;wBAGrC,qBAAM,IAAA,4BAAkB,EAAC;gCACxC,UAAU,YAAA;gCACV,OAAO,SAAA;gCACP,cAAc,gBAAA;gCACd,aAAa,eAAA;6BACd,CAAC,EAAA;;wBALI,QAAQ,GAAG,SAKf;wBAEF,kBAAkB;wBAClB,sBAAO,QAAQ,EAAC;;;aACjB;KACF,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, extractProp, compareArraysByProp, getLocalTimeInfo, genCommaList, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, ErrorWithCode, ParamType } from 'dce-reactkit';
|
|
2
|
-
import initCrossServerCredentialCollection from './helpers/initCrossServerCredentialCollection';
|
|
3
|
-
import initLogCollection from './helpers/initLogCollection';
|
|
4
2
|
import initServer from './helpers/initServer';
|
|
5
3
|
import genRouteHandler from './helpers/genRouteHandler';
|
|
6
4
|
import handleError from './helpers/handleError';
|
|
7
5
|
import handleSuccess from './helpers/handleSuccess';
|
|
8
6
|
import addDBEditorEndpoints from './helpers/addDBEditorEndpoints';
|
|
9
7
|
import visitEndpointOnAnotherServer from './helpers/visitEndpointOnAnotherServer';
|
|
8
|
+
import initExpressKitCollections from './helpers/initExpressKitCollections';
|
|
10
9
|
import CrossServerCredential from './types/CrossServerCredential';
|
|
11
|
-
export { ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, extractProp, compareArraysByProp, genCommaList, getLocalTimeInfo, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, initServer, genRouteHandler, handleError, handleSuccess,
|
|
10
|
+
export { ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, extractProp, compareArraysByProp, genCommaList, getLocalTimeInfo, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, initServer, genRouteHandler, handleError, handleSuccess, initExpressKitCollections, addDBEditorEndpoints, visitEndpointOnAnotherServer, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, CrossServerCredential, ParamType, };
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ParamType = exports.LogBuiltInMetadata = exports.LogAction = exports.LogSource = exports.LogType = exports.DayOfWeek = exports.visitEndpointOnAnotherServer = exports.addDBEditorEndpoints = exports.
|
|
6
|
+
exports.ParamType = exports.LogBuiltInMetadata = exports.LogAction = exports.LogSource = exports.LogType = exports.DayOfWeek = exports.visitEndpointOnAnotherServer = exports.addDBEditorEndpoints = exports.initExpressKitCollections = exports.handleSuccess = exports.handleError = exports.genRouteHandler = exports.initServer = exports.shuffleArray = exports.capitalize = exports.someAsync = exports.mapAsync = exports.forEachAsync = exports.filterAsync = exports.everyAsync = exports.prefixWithAOrAn = exports.getLocalTimeInfo = exports.genCommaList = exports.compareArraysByProp = exports.extractProp = exports.genCSV = exports.getMonthName = exports.parallelLimit = exports.onlyKeepLetters = exports.stringsToHumanReadableList = exports.getPartOfDay = exports.getHumanReadableDate = exports.startMinWait = exports.getTimeInfoInET = exports.getOrdinal = exports.waitMs = exports.sum = exports.roundToNumDecimals = exports.padZerosLeft = exports.padDecimalZeros = exports.forceNumIntoBounds = exports.floorToNumDecimals = exports.ceilToNumDecimals = exports.avg = exports.abbreviate = exports.DAY_IN_MS = exports.HOUR_IN_MS = exports.MINUTE_IN_MS = exports.ErrorWithCode = void 0;
|
|
7
7
|
// Import dce-reactkit
|
|
8
8
|
var dce_reactkit_1 = require("dce-reactkit");
|
|
9
9
|
Object.defineProperty(exports, "abbreviate", { enumerable: true, get: function () { return dce_reactkit_1.abbreviate; } });
|
|
@@ -49,10 +49,6 @@ Object.defineProperty(exports, "DAY_IN_MS", { enumerable: true, get: function ()
|
|
|
49
49
|
Object.defineProperty(exports, "ErrorWithCode", { enumerable: true, get: function () { return dce_reactkit_1.ErrorWithCode; } });
|
|
50
50
|
Object.defineProperty(exports, "ParamType", { enumerable: true, get: function () { return dce_reactkit_1.ParamType; } });
|
|
51
51
|
// Import helpers
|
|
52
|
-
var initCrossServerCredentialCollection_1 = __importDefault(require("./helpers/initCrossServerCredentialCollection"));
|
|
53
|
-
exports.initCrossServerCredentialCollection = initCrossServerCredentialCollection_1.default;
|
|
54
|
-
var initLogCollection_1 = __importDefault(require("./helpers/initLogCollection"));
|
|
55
|
-
exports.initLogCollection = initLogCollection_1.default;
|
|
56
52
|
var initServer_1 = __importDefault(require("./helpers/initServer"));
|
|
57
53
|
exports.initServer = initServer_1.default;
|
|
58
54
|
var genRouteHandler_1 = __importDefault(require("./helpers/genRouteHandler"));
|
|
@@ -65,4 +61,6 @@ var addDBEditorEndpoints_1 = __importDefault(require("./helpers/addDBEditorEndpo
|
|
|
65
61
|
exports.addDBEditorEndpoints = addDBEditorEndpoints_1.default;
|
|
66
62
|
var visitEndpointOnAnotherServer_1 = __importDefault(require("./helpers/visitEndpointOnAnotherServer"));
|
|
67
63
|
exports.visitEndpointOnAnotherServer = visitEndpointOnAnotherServer_1.default;
|
|
64
|
+
var initExpressKitCollections_1 = __importDefault(require("./helpers/initExpressKitCollections"));
|
|
65
|
+
exports.initExpressKitCollections = initExpressKitCollections_1.default;
|
|
68
66
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,sBAAsB;AACtB,6CA8CsB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,sBAAsB;AACtB,6CA8CsB;AAuBpB,2FApEA,yBAAU,OAoEA;AACV,oFApEA,kBAAG,OAoEA;AACH,kGApEA,gCAAiB,OAoEA;AACjB,mGApEA,iCAAkB,OAoEA;AAClB,mGApEA,iCAAkB,OAoEA;AAClB,gGApEA,8BAAe,OAoEA;AACf,6FApEA,2BAAY,OAoEA;AACZ,mGApEA,iCAAkB,OAoEA;AAClB,oFApEA,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kGAA4E;AAmD1E,oCAnDK,mCAAyB,CAmDL"}
|
|
@@ -26,6 +26,7 @@ declare enum ExpressKitErrorCode {
|
|
|
26
26
|
NoOauthLib = "DEK31",
|
|
27
27
|
NoCryptoLib = "DEK32",
|
|
28
28
|
InvalidCrossServerCredentialsFormat = "DEK33",
|
|
29
|
-
UnknownCrossServerError = "DEK34"
|
|
29
|
+
UnknownCrossServerError = "DEK34",
|
|
30
|
+
NotSelectAdmin = "DEK35"
|
|
30
31
|
}
|
|
31
32
|
export default ExpressKitErrorCode;
|
|
@@ -33,6 +33,7 @@ var ExpressKitErrorCode;
|
|
|
33
33
|
ExpressKitErrorCode["NoCryptoLib"] = "DEK32";
|
|
34
34
|
ExpressKitErrorCode["InvalidCrossServerCredentialsFormat"] = "DEK33";
|
|
35
35
|
ExpressKitErrorCode["UnknownCrossServerError"] = "DEK34";
|
|
36
|
+
ExpressKitErrorCode["NotSelectAdmin"] = "DEK35";
|
|
36
37
|
})(ExpressKitErrorCode || (ExpressKitErrorCode = {}));
|
|
37
38
|
exports.default = ExpressKitErrorCode;
|
|
38
39
|
//# sourceMappingURL=ExpressKitErrorCode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressKitErrorCode.js","sourceRoot":"","sources":["../../src/types/ExpressKitErrorCode.ts"],"names":[],"mappings":";AAAA,6BAA6B;;AAE7B;;;GAGG;AACH,IAAK,
|
|
1
|
+
{"version":3,"file":"ExpressKitErrorCode.js","sourceRoot":"","sources":["../../src/types/ExpressKitErrorCode.ts"],"names":[],"mappings":";AAAA,6BAA6B;;AAE7B;;;GAGG;AACH,IAAK,mBA6BJ;AA7BD,WAAK,mBAAmB;IACtB,iBAAiB;IACjB,2CAAoB,CAAA;IACpB,sCAAe,CAAA;IACf,yCAAkB,CAAA;IAClB,uDAAgC,CAAA;IAChC,gEAAyC,CAAA;IACzC,gDAAyB,CAAA;IACzB,gDAAyB,CAAA;IAEzB,4BAA4B;IAC5B,6CAAsB,CAAA;IACtB,2CAAoB,CAAA;IACpB,mDAA4B,CAAA;IAC5B,yDAAkC,CAAA;IAClC,+DAAwC,CAAA;IACxC,+DAAwC,CAAA;IACxC,0DAAmC,CAAA;IACnC,8DAAuC,CAAA;IACvC,8DAAuC,CAAA;IACvC,yDAAkC,CAAA;IAClC,mEAA4C,CAAA;IAC5C,oEAA6C,CAAA;IAC7C,oEAA6C,CAAA;IAC7C,2CAAoB,CAAA;IACpB,4CAAqB,CAAA;IACrB,oEAA6C,CAAA;IAC7C,wDAAiC,CAAA;IACjC,+CAAwB,CAAA;AAC1B,CAAC,EA7BI,mBAAmB,KAAnB,mBAAmB,QA6BvB;AAED,kBAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogReviewerAdmin.js","sourceRoot":"","sources":["../../src/types/LogReviewerAdmin.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectAdmin.js","sourceRoot":"","sources":["../../src/types/SelectAdmin.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dce-expresskit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Shared functions, helpers, and tools for Harvard DCE Express-based servers",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
|
26
26
|
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
27
27
|
"bootstrap": "^5.3.3",
|
|
28
|
-
"dce-reactkit": "
|
|
28
|
+
"dce-reactkit": "4.0.0-beta-logreviewer.1",
|
|
29
29
|
"react": "^19.0.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
@@ -11,7 +11,7 @@ import oauth from 'oauth-signature';
|
|
|
11
11
|
import crypto from 'crypto';
|
|
12
12
|
|
|
13
13
|
// Import shared helpers
|
|
14
|
-
import { internalGetCrossServerCredentialCollection } from './
|
|
14
|
+
import { internalGetCrossServerCredentialCollection } from './initExpressKitCollections';
|
|
15
15
|
|
|
16
16
|
// Import shared types
|
|
17
17
|
import ExpressKitErrorCode from '../types/ExpressKitErrorCode';
|
|
@@ -240,7 +240,7 @@ export const validateSignedRequest = async (
|
|
|
240
240
|
/* ------- Look Up Credential ------- */
|
|
241
241
|
|
|
242
242
|
// Get the cross-server credential collection
|
|
243
|
-
const crossServerCredentialCollection = internalGetCrossServerCredentialCollection();
|
|
243
|
+
const crossServerCredentialCollection = await internalGetCrossServerCredentialCollection();
|
|
244
244
|
if (!crossServerCredentialCollection) {
|
|
245
245
|
throw new ErrorWithCode(
|
|
246
246
|
'Could not validate a cross-server request because the cross-server credential collection was not ready in time.',
|