dce-expresskit 4.0.0-beta-logreviewer.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/.eslintrc.js +93 -0
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/genEncodedSecret.ts +107 -0
- package/genSalt.ts +15 -0
- 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/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +6 -0
- package/lib/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.js +13 -0
- package/lib/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.js.map +1 -0
- package/lib/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +7 -0
- package/lib/constants/LOG_REVIEW_STATUS_ROUTE.js +14 -0
- package/lib/constants/LOG_REVIEW_STATUS_ROUTE.js.map +1 -0
- package/lib/constants/LOG_ROUTE_PATH.d.ts +6 -0
- package/lib/constants/LOG_ROUTE_PATH.js +13 -0
- package/lib/constants/LOG_ROUTE_PATH.js.map +1 -0
- package/lib/constants/ROUTE_PATH_PREFIX.d.ts +6 -0
- package/lib/constants/ROUTE_PATH_PREFIX.js +9 -0
- package/lib/constants/ROUTE_PATH_PREFIX.js.map +1 -0
- package/lib/errors/ErrorWithCode.d.ts +9 -0
- package/lib/errors/ErrorWithCode.js +33 -0
- package/lib/errors/ErrorWithCode.js.map +1 -0
- package/lib/helpers/addDBEditorEndpoints/generateEndpointPath.d.ts +9 -0
- package/lib/helpers/addDBEditorEndpoints/generateEndpointPath.js +17 -0
- package/lib/helpers/addDBEditorEndpoints/generateEndpointPath.js.map +1 -0
- package/lib/helpers/addDBEditorEndpoints/index.d.ts +41 -0
- package/lib/helpers/addDBEditorEndpoints/index.js +134 -0
- package/lib/helpers/addDBEditorEndpoints/index.js.map +1 -0
- package/lib/helpers/dataSigner.d.ts +40 -0
- package/lib/helpers/dataSigner.js +242 -0
- package/lib/helpers/dataSigner.js.map +1 -0
- package/lib/helpers/genRouteHandler.d.ts +75 -0
- package/lib/helpers/genRouteHandler.js +662 -0
- package/lib/helpers/genRouteHandler.js.map +1 -0
- 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/handleError.d.ts +18 -0
- package/lib/helpers/handleError.js +51 -0
- package/lib/helpers/handleError.js.map +1 -0
- package/lib/helpers/handleSuccess.d.ts +8 -0
- package/lib/helpers/handleSuccess.js +20 -0
- package/lib/helpers/handleSuccess.js.map +1 -0
- package/lib/helpers/initCrossServerCredentialCollection.d.ts +11 -0
- package/lib/helpers/initCrossServerCredentialCollection.js +15 -0
- package/lib/helpers/initCrossServerCredentialCollection.js.map +1 -0
- package/lib/helpers/initLogCollection.d.ts +11 -0
- package/lib/helpers/initLogCollection.js +26 -0
- package/lib/helpers/initLogCollection.js.map +1 -0
- package/lib/helpers/initServer.d.ts +45 -0
- package/lib/helpers/initServer.js +292 -0
- package/lib/helpers/initServer.js.map +1 -0
- package/lib/helpers/parseUserAgent.d.ts +17 -0
- package/lib/helpers/parseUserAgent.js +108 -0
- package/lib/helpers/parseUserAgent.js.map +1 -0
- package/lib/helpers/visitEndpointOnAnotherServer/index.d.ts +18 -0
- package/lib/helpers/visitEndpointOnAnotherServer/index.js +89 -0
- package/lib/helpers/visitEndpointOnAnotherServer/index.js.map +1 -0
- package/lib/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +23 -0
- package/lib/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.js +236 -0
- package/lib/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.js.map +1 -0
- package/lib/html/genErrorPage.d.ts +19 -0
- package/lib/html/genErrorPage.js +27 -0
- package/lib/html/genErrorPage.js.map +1 -0
- package/lib/html/genInfoPage.d.ts +13 -0
- package/lib/html/genInfoPage.js +16 -0
- package/lib/html/genInfoPage.js.map +1 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +68 -0
- package/lib/index.js.map +1 -0
- package/lib/types/CrossServerCredential.d.ts +11 -0
- package/lib/types/CrossServerCredential.js +3 -0
- package/lib/types/CrossServerCredential.js.map +1 -0
- package/lib/types/ExpressKitErrorCode.d.ts +31 -0
- package/lib/types/ExpressKitErrorCode.js +38 -0
- package/lib/types/ExpressKitErrorCode.js.map +1 -0
- package/package.json +53 -0
- package/src/constants/LOG_REVIEW_PAGE_SIZE.ts +7 -0
- package/src/errors/ErrorWithCode.tsx +15 -0
- package/src/helpers/addDBEditorEndpoints/generateEndpointPath.ts +16 -0
- package/src/helpers/addDBEditorEndpoints/index.ts +130 -0
- package/src/helpers/dataSigner.ts +319 -0
- package/src/helpers/genRouteHandler.ts +920 -0
- package/src/helpers/getLogReviewerLogs.ts +259 -0
- package/src/helpers/handleError.ts +66 -0
- package/src/helpers/handleSuccess.ts +18 -0
- package/src/helpers/initCrossServerCredentialCollection.ts +19 -0
- package/src/helpers/initLogCollection.ts +30 -0
- package/src/helpers/initServer.ts +283 -0
- package/src/helpers/parseUserAgent.ts +108 -0
- package/src/helpers/visitEndpointOnAnotherServer/index.ts +70 -0
- package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +257 -0
- package/src/html/genErrorPage.ts +144 -0
- package/src/html/genInfoPage.ts +101 -0
- package/src/index.ts +125 -0
- package/src/types/CrossServerCredential.ts +16 -0
- package/src/types/ExpressKitErrorCode.ts +37 -0
- package/tsconfig.json +19 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Import dce-reactkit
|
|
2
|
+
import {
|
|
3
|
+
abbreviate,
|
|
4
|
+
avg,
|
|
5
|
+
ceilToNumDecimals,
|
|
6
|
+
floorToNumDecimals,
|
|
7
|
+
forceNumIntoBounds,
|
|
8
|
+
padDecimalZeros,
|
|
9
|
+
padZerosLeft,
|
|
10
|
+
roundToNumDecimals,
|
|
11
|
+
sum,
|
|
12
|
+
waitMs,
|
|
13
|
+
getOrdinal,
|
|
14
|
+
getTimeInfoInET,
|
|
15
|
+
startMinWait,
|
|
16
|
+
getHumanReadableDate,
|
|
17
|
+
getPartOfDay,
|
|
18
|
+
stringsToHumanReadableList,
|
|
19
|
+
onlyKeepLetters,
|
|
20
|
+
parallelLimit,
|
|
21
|
+
getMonthName,
|
|
22
|
+
genCSV,
|
|
23
|
+
extractProp,
|
|
24
|
+
compareArraysByProp,
|
|
25
|
+
getLocalTimeInfo,
|
|
26
|
+
genCommaList,
|
|
27
|
+
prefixWithAOrAn,
|
|
28
|
+
everyAsync,
|
|
29
|
+
filterAsync,
|
|
30
|
+
forEachAsync,
|
|
31
|
+
mapAsync,
|
|
32
|
+
someAsync,
|
|
33
|
+
capitalize,
|
|
34
|
+
shuffleArray,
|
|
35
|
+
DayOfWeek,
|
|
36
|
+
Log,
|
|
37
|
+
LogType,
|
|
38
|
+
LogSource,
|
|
39
|
+
LogAction,
|
|
40
|
+
LogBuiltInMetadata,
|
|
41
|
+
LogMetadataType,
|
|
42
|
+
LogFunction,
|
|
43
|
+
MINUTE_IN_MS,
|
|
44
|
+
HOUR_IN_MS,
|
|
45
|
+
DAY_IN_MS,
|
|
46
|
+
ErrorWithCode,
|
|
47
|
+
ParamType,
|
|
48
|
+
} from 'dce-reactkit';
|
|
49
|
+
|
|
50
|
+
// Import helpers
|
|
51
|
+
import initCrossServerCredentialCollection from './helpers/initCrossServerCredentialCollection';
|
|
52
|
+
import initLogCollection from './helpers/initLogCollection';
|
|
53
|
+
import initServer from './helpers/initServer';
|
|
54
|
+
import genRouteHandler from './helpers/genRouteHandler';
|
|
55
|
+
import handleError from './helpers/handleError';
|
|
56
|
+
import handleSuccess from './helpers/handleSuccess';
|
|
57
|
+
import addDBEditorEndpoints from './helpers/addDBEditorEndpoints';
|
|
58
|
+
import visitEndpointOnAnotherServer from './helpers/visitEndpointOnAnotherServer';
|
|
59
|
+
|
|
60
|
+
// Import types
|
|
61
|
+
import CrossServerCredential from './types/CrossServerCredential';
|
|
62
|
+
|
|
63
|
+
// Export each item
|
|
64
|
+
export {
|
|
65
|
+
// Errors
|
|
66
|
+
ErrorWithCode,
|
|
67
|
+
// Constants
|
|
68
|
+
MINUTE_IN_MS,
|
|
69
|
+
HOUR_IN_MS,
|
|
70
|
+
DAY_IN_MS,
|
|
71
|
+
// Helpers
|
|
72
|
+
abbreviate,
|
|
73
|
+
avg,
|
|
74
|
+
ceilToNumDecimals,
|
|
75
|
+
floorToNumDecimals,
|
|
76
|
+
forceNumIntoBounds,
|
|
77
|
+
padDecimalZeros,
|
|
78
|
+
padZerosLeft,
|
|
79
|
+
roundToNumDecimals,
|
|
80
|
+
sum,
|
|
81
|
+
waitMs,
|
|
82
|
+
getOrdinal,
|
|
83
|
+
getTimeInfoInET,
|
|
84
|
+
startMinWait,
|
|
85
|
+
getHumanReadableDate,
|
|
86
|
+
getPartOfDay,
|
|
87
|
+
stringsToHumanReadableList,
|
|
88
|
+
onlyKeepLetters,
|
|
89
|
+
parallelLimit,
|
|
90
|
+
getMonthName,
|
|
91
|
+
genCSV,
|
|
92
|
+
extractProp,
|
|
93
|
+
compareArraysByProp,
|
|
94
|
+
genCommaList,
|
|
95
|
+
getLocalTimeInfo,
|
|
96
|
+
prefixWithAOrAn,
|
|
97
|
+
everyAsync,
|
|
98
|
+
filterAsync,
|
|
99
|
+
forEachAsync,
|
|
100
|
+
mapAsync,
|
|
101
|
+
someAsync,
|
|
102
|
+
capitalize,
|
|
103
|
+
shuffleArray,
|
|
104
|
+
// Server helpers
|
|
105
|
+
initServer,
|
|
106
|
+
genRouteHandler,
|
|
107
|
+
handleError,
|
|
108
|
+
handleSuccess,
|
|
109
|
+
initLogCollection,
|
|
110
|
+
initCrossServerCredentialCollection,
|
|
111
|
+
addDBEditorEndpoints,
|
|
112
|
+
visitEndpointOnAnotherServer,
|
|
113
|
+
// Types
|
|
114
|
+
DayOfWeek,
|
|
115
|
+
Log,
|
|
116
|
+
LogType,
|
|
117
|
+
LogSource,
|
|
118
|
+
LogAction,
|
|
119
|
+
LogBuiltInMetadata,
|
|
120
|
+
LogMetadataType,
|
|
121
|
+
LogFunction,
|
|
122
|
+
CrossServerCredential,
|
|
123
|
+
// Server types
|
|
124
|
+
ParamType,
|
|
125
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single cross-server credential
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
*/
|
|
5
|
+
type CrossServerCredential = {
|
|
6
|
+
// Description of the credential (human-readable)
|
|
7
|
+
description: string,
|
|
8
|
+
// The key of the credential
|
|
9
|
+
key: string,
|
|
10
|
+
// The encoded secret of the credential
|
|
11
|
+
encodedeSecret: string,
|
|
12
|
+
// The list of scopes for the credential
|
|
13
|
+
scopes: string[],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default CrossServerCredential;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Highest error code = DEK34
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* List of error codes built into the express kit
|
|
5
|
+
* @author Gabe Abrams
|
|
6
|
+
*/
|
|
7
|
+
enum ExpressKitErrorCode {
|
|
8
|
+
// General errors
|
|
9
|
+
WrongCourse = 'DEK6',
|
|
10
|
+
NotTTM = 'DEK9',
|
|
11
|
+
NotAdmin = 'DEK10',
|
|
12
|
+
NotAllowedToReviewLogs = 'DEK11',
|
|
13
|
+
ThemeCheckedBeforeReactKitReady = 'DEK12',
|
|
14
|
+
InvalidParameter = 'DEK5',
|
|
15
|
+
MissingParameter = 'DEK4',
|
|
16
|
+
|
|
17
|
+
// Server-to-server requests
|
|
18
|
+
NotConnected = 'DEK14',
|
|
19
|
+
SelfSigned = 'DEK15',
|
|
20
|
+
ResponseParseError = 'DEK16',
|
|
21
|
+
SignedRequestUnparseable = 'DEK28',
|
|
22
|
+
SignedRequestInvalidCollection = 'DEK21',
|
|
23
|
+
SignedRequestInvalidCredential = 'DEK23',
|
|
24
|
+
SignedRequestInvalidScope = 'DEK22',
|
|
25
|
+
SignedRequestInvalidTimestamp = 'DEK24',
|
|
26
|
+
SignedRequestInvalidSignature = 'DEK25',
|
|
27
|
+
SignedRequestInvalidBody = 'DEK26',
|
|
28
|
+
CrossServerNoCredentialsToSignWith = 'DEK27',
|
|
29
|
+
CrossServerMissingSignedRequestInfo = 'DEK29',
|
|
30
|
+
CrossServerNoCredentialEncodingSalt = 'DEK30',
|
|
31
|
+
NoOauthLib = 'DEK31',
|
|
32
|
+
NoCryptoLib = 'DEK32',
|
|
33
|
+
InvalidCrossServerCredentialsFormat = 'DEK33',
|
|
34
|
+
UnknownCrossServerError = 'DEK34',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default ExpressKitErrorCode;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"noImplicitAny": true,
|
|
6
|
+
"noEmitOnError": true,
|
|
7
|
+
"removeComments": false,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"target": "es5",
|
|
11
|
+
"outDir": "./lib"
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"./src"
|
|
15
|
+
],
|
|
16
|
+
"ts-node": {
|
|
17
|
+
"files": true
|
|
18
|
+
}
|
|
19
|
+
}
|