dce-expresskit 4.3.5 → 5.0.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/lib/helpers/addDBEditorEndpoints/generateEndpointPath.js +2 -1
- package/lib/helpers/addDBEditorEndpoints/generateEndpointPath.js.map +1 -1
- package/lib/helpers/addDBEditorEndpoints/index.js +5 -5
- package/lib/helpers/addDBEditorEndpoints/index.js.map +1 -1
- package/lib/helpers/dataSigner.js +13 -13
- package/lib/helpers/dataSigner.js.map +1 -1
- package/lib/helpers/genRouteHandler.d.ts +1 -1
- package/lib/helpers/genRouteHandler.js +35 -35
- package/lib/helpers/genRouteHandler.js.map +1 -1
- package/lib/helpers/getLogReviewerLogs.d.ts +1 -1
- package/lib/helpers/getLogReviewerLogs.js +5 -5
- package/lib/helpers/getLogReviewerLogs.js.map +1 -1
- package/lib/helpers/handleError.js +2 -2
- package/lib/helpers/handleError.js.map +1 -1
- package/lib/helpers/initExpressKitCollections.d.ts +1 -1
- package/lib/helpers/initServer.d.ts +1 -1
- package/lib/helpers/initServer.js +21 -21
- package/lib/helpers/initServer.js.map +1 -1
- package/lib/helpers/visitEndpointOnAnotherServer/index.d.ts +4 -0
- package/lib/helpers/visitEndpointOnAnotherServer/index.js +9 -5
- package/lib/helpers/visitEndpointOnAnotherServer/index.js.map +1 -1
- package/lib/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +3 -0
- package/lib/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.js +50 -30
- package/lib/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.js.map +1 -1
- package/lib/html/genErrorPage.d.ts +1 -1
- package/lib/html/genErrorPage.js +4 -4
- package/lib/html/genErrorPage.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +45 -45
- package/lib/index.js.map +1 -1
- package/package.json +2 -8
- package/src/helpers/addDBEditorEndpoints/generateEndpointPath.ts +2 -2
- package/src/helpers/addDBEditorEndpoints/index.ts +2 -2
- package/src/helpers/dataSigner.ts +2 -2
- package/src/helpers/genRouteHandler.ts +9 -9
- package/src/helpers/getLogReviewerLogs.ts +2 -2
- package/src/helpers/handleError.ts +2 -3
- package/src/helpers/initExpressKitCollections.ts +2 -2
- package/src/helpers/initServer.ts +3 -3
- package/src/helpers/visitEndpointOnAnotherServer/index.ts +10 -5
- package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +54 -31
- package/src/html/genErrorPage.ts +4 -7
- package/src/index.ts +2 -2
- package/src/errors/ErrorWithCode.tsx +0 -15
|
@@ -50,8 +50,8 @@ 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
|
-
// Import dce-
|
|
54
|
-
var
|
|
53
|
+
// Import dce-commonkit
|
|
54
|
+
var dce_commonkit_1 = require("dce-commonkit");
|
|
55
55
|
// Import shared helpers
|
|
56
56
|
var genRouteHandler_1 = __importDefault(require("./genRouteHandler"));
|
|
57
57
|
var getLogReviewerLogs_1 = __importDefault(require("./getLogReviewerLogs"));
|
|
@@ -63,7 +63,7 @@ var initExpressKitCollections_1 = require("./initExpressKitCollections");
|
|
|
63
63
|
/* Main */
|
|
64
64
|
/*------------------------------------------------------------------------*/
|
|
65
65
|
/**
|
|
66
|
-
* Prepare dce-
|
|
66
|
+
* Prepare dce-commonkit to run on the server
|
|
67
67
|
* @author Gabe Abrams
|
|
68
68
|
* @param opts object containing all arguments
|
|
69
69
|
* @param opts.app express app from inside of the postprocessor function that
|
|
@@ -92,18 +92,18 @@ var initServer = function (opts) {
|
|
|
92
92
|
* @param {LogAction} [action] the type of action performed on the target
|
|
93
93
|
* @returns {Log}
|
|
94
94
|
*/
|
|
95
|
-
opts.app.post(
|
|
95
|
+
opts.app.post(dce_commonkit_1.LOG_ROUTE_PATH, (0, genRouteHandler_1.default)({
|
|
96
96
|
paramTypes: {
|
|
97
|
-
context:
|
|
98
|
-
subcontext:
|
|
99
|
-
tags:
|
|
100
|
-
level:
|
|
101
|
-
metadata:
|
|
102
|
-
errorMessage:
|
|
103
|
-
errorCode:
|
|
104
|
-
errorStack:
|
|
105
|
-
target:
|
|
106
|
-
action:
|
|
97
|
+
context: dce_commonkit_1.ParamType.String,
|
|
98
|
+
subcontext: dce_commonkit_1.ParamType.String,
|
|
99
|
+
tags: dce_commonkit_1.ParamType.JSON,
|
|
100
|
+
level: dce_commonkit_1.ParamType.String,
|
|
101
|
+
metadata: dce_commonkit_1.ParamType.JSON,
|
|
102
|
+
errorMessage: dce_commonkit_1.ParamType.StringOptional,
|
|
103
|
+
errorCode: dce_commonkit_1.ParamType.StringOptional,
|
|
104
|
+
errorStack: dce_commonkit_1.ParamType.StringOptional,
|
|
105
|
+
target: dce_commonkit_1.ParamType.StringOptional,
|
|
106
|
+
action: dce_commonkit_1.ParamType.StringOptional,
|
|
107
107
|
},
|
|
108
108
|
handler: function (_a) {
|
|
109
109
|
var params = _a.params, logServerEvent = _a.logServerEvent;
|
|
@@ -183,7 +183,7 @@ var initServer = function (opts) {
|
|
|
183
183
|
* @author Gabe Abrams
|
|
184
184
|
* @returns {boolean} true if user has access
|
|
185
185
|
*/
|
|
186
|
-
opts.app.get(
|
|
186
|
+
opts.app.get(dce_commonkit_1.LOG_REVIEW_STATUS_ROUTE, (0, genRouteHandler_1.default)({
|
|
187
187
|
handler: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
188
188
|
var userId, isAdmin, canReview;
|
|
189
189
|
var params = _b.params;
|
|
@@ -208,11 +208,11 @@ var initServer = function (opts) {
|
|
|
208
208
|
* @param filters the filters to apply to the logs
|
|
209
209
|
* @returns {Log[]} list of logs that match the filters
|
|
210
210
|
*/
|
|
211
|
-
opts.app.get(
|
|
211
|
+
opts.app.get(dce_commonkit_1.LOG_REVIEW_GET_LOGS_ROUTE, (0, genRouteHandler_1.default)({
|
|
212
212
|
paramTypes: {
|
|
213
|
-
pageNumber:
|
|
214
|
-
filters:
|
|
215
|
-
countDocuments:
|
|
213
|
+
pageNumber: dce_commonkit_1.ParamType.Int,
|
|
214
|
+
filters: dce_commonkit_1.ParamType.JSON,
|
|
215
|
+
countDocuments: dce_commonkit_1.ParamType.Boolean,
|
|
216
216
|
},
|
|
217
217
|
handler: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
218
218
|
var pageNumber, userId, isAdmin, filters, countDocuments, canReview, logCollection, response;
|
|
@@ -225,7 +225,7 @@ var initServer = function (opts) {
|
|
|
225
225
|
case 1:
|
|
226
226
|
canReview = _c.sent();
|
|
227
227
|
if (!canReview) {
|
|
228
|
-
throw new
|
|
228
|
+
throw new dce_commonkit_1.ErrorWithCode('You cannot access this resource because you do not have the appropriate permissions.', ExpressKitErrorCode_1.default.NotAllowedToReviewLogs);
|
|
229
229
|
}
|
|
230
230
|
return [4 /*yield*/, (0, initExpressKitCollections_1.internalGetLogCollection)()];
|
|
231
231
|
case 2:
|
|
@@ -254,7 +254,7 @@ var initServer = function (opts) {
|
|
|
254
254
|
* a select admin, simply because this route starts with the select admin
|
|
255
255
|
* prefix, it will result in an error
|
|
256
256
|
*/
|
|
257
|
-
opts.app.get(
|
|
257
|
+
opts.app.get(dce_commonkit_1.SELECT_ADMIN_CHECK_ROUTE, (0, genRouteHandler_1.default)({
|
|
258
258
|
handler: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
259
259
|
return __generator(this, function (_a) {
|
|
260
260
|
return [2 /*return*/, true];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initServer.js","sourceRoot":"","sources":["../../src/helpers/initServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,
|
|
1
|
+
{"version":3,"file":"initServer.js","sourceRoot":"","sources":["../../src/helpers/initServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;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Kf;wBAEF,kBAAkB;wBAClB,sBAAO,QAAQ,EAAC;;;aACjB;KACF,CAAC,CACH,CAAC;IAEF,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAE5C;;;;;;OAMG;IACH,IAAI,CAAC,GAAG,CAAC,GAAG,CACV,wCAAwB,EACxB,IAAA,yBAAe,EAAC;QACd,OAAO,EAAE;;gBACP,sBAAO,IAAI,EAAC;;aACb;KACF,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
* @param opts.host the host of the other server
|
|
8
8
|
* @param [opts.params={}] query/body parameters to include
|
|
9
9
|
* @param [opts.responseType=JSON] the response type from the other server
|
|
10
|
+
* @param [opts.dceKitCrossServerCredentials] additional cross-server credentials
|
|
11
|
+
* that aren't in the env var list
|
|
12
|
+
* @returns the body of the response from the other server
|
|
10
13
|
*/
|
|
11
14
|
declare const visitEndpointOnAnotherServer: (opts: {
|
|
12
15
|
method: "GET" | "POST" | "DELETE" | "PUT";
|
|
@@ -14,5 +17,6 @@ declare const visitEndpointOnAnotherServer: (opts: {
|
|
|
14
17
|
host: string;
|
|
15
18
|
params?: { [key in string]: any; };
|
|
16
19
|
responseType?: "JSON" | "Text";
|
|
20
|
+
dceKitCrossServerCredentials?: string;
|
|
17
21
|
}) => Promise<any>;
|
|
18
22
|
export default visitEndpointOnAnotherServer;
|
|
@@ -39,8 +39,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
// Import dce-
|
|
43
|
-
var
|
|
42
|
+
// Import dce-commonkit
|
|
43
|
+
var dce_commonkit_1 = require("dce-commonkit");
|
|
44
44
|
// Import shared types
|
|
45
45
|
var sendServerToServerRequest_1 = __importDefault(require("./sendServerToServerRequest"));
|
|
46
46
|
/*------------------------------------------------------------------------*/
|
|
@@ -55,6 +55,9 @@ var sendServerToServerRequest_1 = __importDefault(require("./sendServerToServerR
|
|
|
55
55
|
* @param opts.host the host of the other server
|
|
56
56
|
* @param [opts.params={}] query/body parameters to include
|
|
57
57
|
* @param [opts.responseType=JSON] the response type from the other server
|
|
58
|
+
* @param [opts.dceKitCrossServerCredentials] additional cross-server credentials
|
|
59
|
+
* that aren't in the env var list
|
|
60
|
+
* @returns the body of the response from the other server
|
|
58
61
|
*/
|
|
59
62
|
var visitEndpointOnAnotherServer = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
60
63
|
var response, body;
|
|
@@ -66,18 +69,19 @@ var visitEndpointOnAnotherServer = function (opts) { return __awaiter(void 0, vo
|
|
|
66
69
|
method: opts.method,
|
|
67
70
|
params: opts.params,
|
|
68
71
|
responseType: opts.responseType,
|
|
72
|
+
dceKitCrossServerCredentials: opts.dceKitCrossServerCredentials,
|
|
69
73
|
})];
|
|
70
74
|
case 1:
|
|
71
75
|
response = _a.sent();
|
|
72
76
|
// Check for failure
|
|
73
77
|
if (!response || !response.body) {
|
|
74
|
-
throw new
|
|
78
|
+
throw new dce_commonkit_1.ErrorWithCode('We didn\'t get a response from the other server. Please check the network between the two connection.', dce_commonkit_1.CommonKitErrorCode.NoResponse);
|
|
75
79
|
}
|
|
76
80
|
if (!response.body.success) {
|
|
77
81
|
// Other errors
|
|
78
|
-
throw new
|
|
82
|
+
throw new dce_commonkit_1.ErrorWithCode((response.body.message
|
|
79
83
|
|| 'An unknown error occurred. Please contact an admin.'), (response.body.code
|
|
80
|
-
||
|
|
84
|
+
|| dce_commonkit_1.CommonKitErrorCode.NoCode));
|
|
81
85
|
}
|
|
82
86
|
body = response.body.body;
|
|
83
87
|
// Return
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/visitEndpointOnAnotherServer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;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4B,CAAC"}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* @param [opts.method=GET] http method to use
|
|
8
8
|
* @param [opts.params] body/data to include in the request
|
|
9
9
|
* @param [opts.responseType=JSON] expected response type
|
|
10
|
+
* @param [opts.dceKitCrossServerCredentials] additional cross-server credentials
|
|
11
|
+
* that aren't in the env var list
|
|
10
12
|
* @returns { body, status, headers } on success
|
|
11
13
|
*/
|
|
12
14
|
declare const sendServerToServerRequest: (opts: {
|
|
@@ -15,6 +17,7 @@ declare const sendServerToServerRequest: (opts: {
|
|
|
15
17
|
method?: ("GET" | "POST" | "PUT" | "DELETE");
|
|
16
18
|
params?: { [k in string]: any; };
|
|
17
19
|
responseType?: "Text" | "JSON";
|
|
20
|
+
dceKitCrossServerCredentials?: string;
|
|
18
21
|
}) => Promise<{
|
|
19
22
|
body: any;
|
|
20
23
|
status: number;
|
|
@@ -42,8 +42,8 @@ var _a;
|
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
43
|
// Import libs
|
|
44
44
|
var qs_1 = __importDefault(require("qs"));
|
|
45
|
-
// Import dce-
|
|
46
|
-
var
|
|
45
|
+
// Import dce-commonkit
|
|
46
|
+
var dce_commonkit_1 = require("dce-commonkit");
|
|
47
47
|
// Import data signer
|
|
48
48
|
var dataSigner_1 = require("../dataSigner");
|
|
49
49
|
// Import shared types
|
|
@@ -55,30 +55,44 @@ var ExpressKitErrorCode_1 = __importDefault(require("../../types/ExpressKitError
|
|
|
55
55
|
DCEKIT_CROSS_SERVER_CREDENTIALS format:
|
|
56
56
|
|host:key:secret||host:key:secret|...
|
|
57
57
|
*/
|
|
58
|
-
var credentials =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
58
|
+
var credentials = [];
|
|
59
|
+
/*------------------------------------------------------------------------*/
|
|
60
|
+
/* ------------------------------- Helpers ------------------------------ */
|
|
61
|
+
/*------------------------------------------------------------------------*/
|
|
62
|
+
/**
|
|
63
|
+
* Parse a credentials string into an array of credentials
|
|
64
|
+
* @author Gabe Abrams
|
|
65
|
+
* @param credentialsStr the credentials string to parse
|
|
66
|
+
* @returns an array of credentials
|
|
67
|
+
*/
|
|
68
|
+
var parseCredentials = function (credentialsStr) {
|
|
69
|
+
credentialsStr
|
|
70
|
+
// Replace multiple | with a single one
|
|
71
|
+
.replace(/\|+/g, '|')
|
|
72
|
+
// Split by |
|
|
73
|
+
.split('|')
|
|
74
|
+
// Remove empty strings
|
|
75
|
+
.filter(function (str) {
|
|
76
|
+
return str.trim().length > 0;
|
|
77
|
+
})
|
|
78
|
+
// Process each credential
|
|
79
|
+
.forEach(function (str) {
|
|
80
|
+
// Split by :
|
|
81
|
+
var parts = str.split(':');
|
|
82
|
+
// Check for errors
|
|
83
|
+
if (parts.length !== 3) {
|
|
84
|
+
throw new dce_commonkit_1.ErrorWithCode('Invalid DCEKIT_CROSS_SERVER_CREDENTIALS format. Each credential must be in the format |host:key:secret|', ExpressKitErrorCode_1.default.InvalidCrossServerCredentialsFormat);
|
|
85
|
+
}
|
|
86
|
+
// Add the credential to the array
|
|
87
|
+
credentials.push({
|
|
88
|
+
host: parts[0].trim(),
|
|
89
|
+
key: parts[1].trim(),
|
|
90
|
+
secret: parts[2].trim(),
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
// Auto-parse credentials from env variable
|
|
95
|
+
parseCredentials((_a = process.env.DCEKIT_CROSS_SERVER_CREDENTIALS) !== null && _a !== void 0 ? _a : '');
|
|
82
96
|
/*------------------------------------------------------------------------*/
|
|
83
97
|
/* ------------------------------- Helpers ------------------------------ */
|
|
84
98
|
/*------------------------------------------------------------------------*/
|
|
@@ -94,7 +108,7 @@ var getCrossServerCredential = function (host) {
|
|
|
94
108
|
return cred.host.toLowerCase() === host.toLowerCase();
|
|
95
109
|
});
|
|
96
110
|
if (!credential) {
|
|
97
|
-
throw new
|
|
111
|
+
throw new dce_commonkit_1.ErrorWithCode('Cannot send cross-server signed request there was no credential that matched the host that the request is being sent to.', ExpressKitErrorCode_1.default.CrossServerNoCredentialsToSignWith);
|
|
98
112
|
}
|
|
99
113
|
// Return credential
|
|
100
114
|
return credential;
|
|
@@ -111,6 +125,8 @@ var getCrossServerCredential = function (host) {
|
|
|
111
125
|
* @param [opts.method=GET] http method to use
|
|
112
126
|
* @param [opts.params] body/data to include in the request
|
|
113
127
|
* @param [opts.responseType=JSON] expected response type
|
|
128
|
+
* @param [opts.dceKitCrossServerCredentials] additional cross-server credentials
|
|
129
|
+
* that aren't in the env var list
|
|
114
130
|
* @returns { body, status, headers } on success
|
|
115
131
|
*/
|
|
116
132
|
var sendServerToServerRequest = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -119,6 +135,10 @@ var sendServerToServerRequest = function (opts) { return __awaiter(void 0, void
|
|
|
119
135
|
return __generator(this, function (_b) {
|
|
120
136
|
switch (_b.label) {
|
|
121
137
|
case 0:
|
|
138
|
+
// If additional credentials were provided, parse them and add to the list
|
|
139
|
+
if (opts.dceKitCrossServerCredentials) {
|
|
140
|
+
parseCredentials(opts.dceKitCrossServerCredentials);
|
|
141
|
+
}
|
|
122
142
|
method = (opts.method || 'GET');
|
|
123
143
|
if (opts.params) {
|
|
124
144
|
params = {};
|
|
@@ -218,16 +238,16 @@ var sendServerToServerRequest = function (opts) { return __awaiter(void 0, void
|
|
|
218
238
|
}];
|
|
219
239
|
case 9:
|
|
220
240
|
err_1 = _b.sent();
|
|
221
|
-
throw new
|
|
241
|
+
throw new dce_commonkit_1.ErrorWithCode("Failed to parse response as ".concat(opts.responseType, ": ").concat(err_1 === null || err_1 === void 0 ? void 0 : err_1.message), ExpressKitErrorCode_1.default.ResponseParseError);
|
|
222
242
|
case 10: return [3 /*break*/, 12];
|
|
223
243
|
case 11:
|
|
224
244
|
err_2 = _b.sent();
|
|
225
245
|
// Self-signed certificate error:
|
|
226
246
|
if ((_a = err_2 === null || err_2 === void 0 ? void 0 : err_2.message) === null || _a === void 0 ? void 0 : _a.includes('self signed certificate')) {
|
|
227
|
-
throw new
|
|
247
|
+
throw new dce_commonkit_1.ErrorWithCode('We refused to send a request because the receiver has self-signed certificates.', ExpressKitErrorCode_1.default.SelfSigned);
|
|
228
248
|
}
|
|
229
249
|
// No tries left
|
|
230
|
-
throw new
|
|
250
|
+
throw new dce_commonkit_1.ErrorWithCode("We encountered an error when trying to send a network request. If this issue persists, contact an admin. Error: ".concat(err_2 === null || err_2 === void 0 ? void 0 : err_2.message), ExpressKitErrorCode_1.default.NotConnected);
|
|
231
251
|
case 12: return [2 /*return*/];
|
|
232
252
|
}
|
|
233
253
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendServerToServerRequest.js","sourceRoot":"","sources":["../../../src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,0CAAoB;AAEpB,
|
|
1
|
+
{"version":3,"file":"sendServerToServerRequest.js","sourceRoot":"","sources":["../../../src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,0CAAoB;AAEpB,uBAAuB;AACvB,+CAEuB;AAEvB,qBAAqB;AACrB,4CAA4C;AAE5C,sBAAsB;AACtB,wFAAkE;AAElE,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E;;;EAGE;AAEF,IAAM,WAAW,GAIX,EAAE,CAAC;AAET,4EAA4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AkB,CACvC,CAAC;;;;gBAGJ,iCAAiC;gBACjC,IAAI,MAAC,KAAW,aAAX,KAAG,uBAAH,KAAG,CAAU,OAAO,0CAAE,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC;oBAC/D,MAAM,IAAI,6BAAa,CACrB,iFAAiF,EACjF,6BAAmB,CAAC,UAAU,CAC/B,CAAC;gBACJ,CAAC;gBAED,gBAAgB;gBAChB,MAAM,IAAI,6BAAa,CACrB,0HAAoH,KAAW,aAAX,KAAG,uBAAH,KAAG,CAAU,OAAO,CAAE,EAC1I,6BAAmB,CAAC,YAAY,CACjC,CAAC;;;;KAEL,CAAC;AAEF,kBAAe,yBAAyB,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @param [opts.title=An Error Occurred] title of the error box
|
|
6
6
|
* @param [opts.description=An unknown server error occurred. Please contact support.]
|
|
7
7
|
* a human-readable description of the error
|
|
8
|
-
* @param [opts.code=
|
|
8
|
+
* @param [opts.code=CommonKitErrorCode.NoCode] error code to show
|
|
9
9
|
* @param [opts.pageTitle=opts.title] title of the page/tab if it differs from
|
|
10
10
|
* the title of the error
|
|
11
11
|
* @returns html of the page
|
package/lib/html/genErrorPage.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Import dce-
|
|
4
|
-
var
|
|
3
|
+
// Import dce-commonkit
|
|
4
|
+
var dce_commonkit_1 = require("dce-commonkit");
|
|
5
5
|
/**
|
|
6
6
|
* Generate a static error page
|
|
7
7
|
* @author Gabe Abrams
|
|
@@ -9,7 +9,7 @@ var dce_reactkit_1 = require("dce-reactkit");
|
|
|
9
9
|
* @param [opts.title=An Error Occurred] title of the error box
|
|
10
10
|
* @param [opts.description=An unknown server error occurred. Please contact support.]
|
|
11
11
|
* a human-readable description of the error
|
|
12
|
-
* @param [opts.code=
|
|
12
|
+
* @param [opts.code=CommonKitErrorCode.NoCode] error code to show
|
|
13
13
|
* @param [opts.pageTitle=opts.title] title of the page/tab if it differs from
|
|
14
14
|
* the title of the error
|
|
15
15
|
* @returns html of the page
|
|
@@ -20,7 +20,7 @@ var genErrorPage = function (opts) {
|
|
|
20
20
|
var title = ((_a = opts.title) !== null && _a !== void 0 ? _a : 'An Error Occurred');
|
|
21
21
|
var pageTitle = ((_b = opts.pageTitle) !== null && _b !== void 0 ? _b : title);
|
|
22
22
|
var description = ((_c = opts.description) !== null && _c !== void 0 ? _c : 'An unknown server error occurred. Please contact support.');
|
|
23
|
-
var code = ((_d = opts.code) !== null && _d !== void 0 ? _d :
|
|
23
|
+
var code = ((_d = opts.code) !== null && _d !== void 0 ? _d : dce_commonkit_1.CommonKitErrorCode.NoCode);
|
|
24
24
|
return "\n<head>\n <!-- Metadata -->\n <meta\n name=\"viewport\"\n content=\"width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0\"\n >\n\n <!-- Title -->\n <title>".concat(pageTitle, "</title>\n\n <!-- Bootstrap -->\n <link\n rel=\"stylesheet\"\n href=\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.1/css/bootstrap.min.css\"\n integrity=\"sha512-siwe/oXMhSjGCwLn+scraPOWrJxHlUgMBMZXdPe2Tnk3I0x3ESCoLz7WZ5NTH6SZrywMY+PB1cjyqJ5jAluCOg==\"\n crossorigin=\"anonymous\"\n referrerpolicy=\"no-referrer\"\n />\n <script\n src=\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.1/js/bootstrap.min.js\"\n integrity=\"sha512-vyRAVI0IEm6LI/fVSv/Wq/d0KUfrg3hJq2Qz5FlfER69sf3ZHlOrsLriNm49FxnpUGmhx+TaJKwJ+ByTLKT+Yg==\"\n crossorigin=\"anonymous\"\n referrerpolicy=\"no-referrer\"\n ></script>\n\n <!-- FontAwesome -->\n <link\n rel=\"stylesheet\"\n href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css\"\n integrity=\"sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A==\"\n crossorigin=\"anonymous\"\n referrerpolicy=\"no-referrer\"\n />\n\n <!-- Style -->\n <style>\n .DCEReactKit-pop-in {\n animation-name: DCEReactKit-pop-in;\n animation-duration: 0.5s;\n animation-iteration-count: 1;\n animation-timing-function: ease-out;\n animation-fill-mode: both;\n\n transform-origin: center;\n }\n\n @keyframes DCEReactKit-pop-in {\n 0% {\n opacity: 0;\n transform: scale(0.9);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n .DCEReactKit-slide-in {\n animation-name: DCEReactKit-slide-in;\n animation-duration: 1s;\n animation-iteration-count: 1;\n animation-timing-function: ease-out;\n animation-fill-mode: both;\n animation-delay: 0.2s;\n }\n\n @keyframes DCEReactKit-slide-in {\n 0% {\n opacity: 0;\n transform: translate(0, 0.3em);\n }\n 100% {\n opacity: 1;\n transform: translate(0, 0);\n }\n }\n </style>\n</head>\n\n<!-- Body -->\n<body class=\"bg-dark text-center pt-3 ps-3 pe-3\">\n <!-- Alert -->\n <div\n class=\"DCEReactKit-pop-in alert alert-warning d-inline-block\"\n style=\"width: 50em; max-width: 100%\"\n >\n <!-- Title -->\n <h2>\n <i class=\"me-1 fa-solid fa-triangle-exclamation\"></i>\n ").concat(title, "\n </h2>\n <!-- Description -->\n <div>\n ").concat(description, "\n </div>\n </div>\n\n <!-- Error Code -->\n <div class=\"DCEReactKit-slide-in text-light\">\n <strong>\n Error Code:\n </strong>\n ").concat(code, "\n </div>\n</body>\n ");
|
|
25
25
|
};
|
|
26
26
|
exports.default = genErrorPage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genErrorPage.js","sourceRoot":"","sources":["../../src/html/genErrorPage.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"genErrorPage.js","sourceRoot":"","sources":["../../src/html/genErrorPage.ts"],"names":[],"mappings":";;AAAA,uBAAuB;AACvB,+CAAmD;AAEnD;;;;;;;;;;;GAWG;AACH,IAAM,YAAY,GAAG,UACnB,IAKM;;IALN,qBAAA,EAAA,SAKM;IAEN,IAAM,KAAK,GAAG,CAAC,MAAA,IAAI,CAAC,KAAK,mCAAI,mBAAmB,CAAC,CAAC;IAClD,IAAM,SAAS,GAAG,CAAC,MAAA,IAAI,CAAC,SAAS,mCAAI,KAAK,CAAC,CAAC;IAC5C,IAAM,WAAW,GAAG,CAClB,MAAA,IAAI,CAAC,WAAW,mCACb,2DAA2D,CAC/D,CAAC;IACF,IAAM,IAAI,GAAG,CAAC,MAAA,IAAI,CAAC,IAAI,mCAAI,kCAAkB,CAAC,MAAM,CAAC,CAAC;IAEtD,OAAO,2MASE,SAAS,uuEAiFZ,KAAK,qEAIL,WAAW,qKASb,IAAI,4BAGP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, getTimestampFromTimeInfoInET, 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-
|
|
1
|
+
import { abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, getTimestampFromTimeInfoInET, 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-commonkit';
|
|
2
2
|
import initServer from './helpers/initServer';
|
|
3
3
|
import genRouteHandler from './helpers/genRouteHandler';
|
|
4
4
|
import handleError from './helpers/handleError';
|
package/lib/index.js
CHANGED
|
@@ -38,51 +38,51 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.LogBuiltInMetadata = exports.LogAction = exports.LogSource = exports.LogType = exports.DayOfWeek = exports.visitEndpointOnAnotherServer = exports.addDBEditorEndpoints = exports.getLogCollection = 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.getTimestampFromTimeInfoInET = 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;
|
|
40
40
|
exports.ParamType = void 0;
|
|
41
|
-
// Import dce-
|
|
42
|
-
var
|
|
43
|
-
Object.defineProperty(exports, "abbreviate", { enumerable: true, get: function () { return
|
|
44
|
-
Object.defineProperty(exports, "avg", { enumerable: true, get: function () { return
|
|
45
|
-
Object.defineProperty(exports, "ceilToNumDecimals", { enumerable: true, get: function () { return
|
|
46
|
-
Object.defineProperty(exports, "floorToNumDecimals", { enumerable: true, get: function () { return
|
|
47
|
-
Object.defineProperty(exports, "forceNumIntoBounds", { enumerable: true, get: function () { return
|
|
48
|
-
Object.defineProperty(exports, "padDecimalZeros", { enumerable: true, get: function () { return
|
|
49
|
-
Object.defineProperty(exports, "padZerosLeft", { enumerable: true, get: function () { return
|
|
50
|
-
Object.defineProperty(exports, "roundToNumDecimals", { enumerable: true, get: function () { return
|
|
51
|
-
Object.defineProperty(exports, "sum", { enumerable: true, get: function () { return
|
|
52
|
-
Object.defineProperty(exports, "waitMs", { enumerable: true, get: function () { return
|
|
53
|
-
Object.defineProperty(exports, "getOrdinal", { enumerable: true, get: function () { return
|
|
54
|
-
Object.defineProperty(exports, "getTimeInfoInET", { enumerable: true, get: function () { return
|
|
55
|
-
Object.defineProperty(exports, "getTimestampFromTimeInfoInET", { enumerable: true, get: function () { return
|
|
56
|
-
Object.defineProperty(exports, "startMinWait", { enumerable: true, get: function () { return
|
|
57
|
-
Object.defineProperty(exports, "getHumanReadableDate", { enumerable: true, get: function () { return
|
|
58
|
-
Object.defineProperty(exports, "getPartOfDay", { enumerable: true, get: function () { return
|
|
59
|
-
Object.defineProperty(exports, "stringsToHumanReadableList", { enumerable: true, get: function () { return
|
|
60
|
-
Object.defineProperty(exports, "onlyKeepLetters", { enumerable: true, get: function () { return
|
|
61
|
-
Object.defineProperty(exports, "parallelLimit", { enumerable: true, get: function () { return
|
|
62
|
-
Object.defineProperty(exports, "getMonthName", { enumerable: true, get: function () { return
|
|
63
|
-
Object.defineProperty(exports, "genCSV", { enumerable: true, get: function () { return
|
|
64
|
-
Object.defineProperty(exports, "extractProp", { enumerable: true, get: function () { return
|
|
65
|
-
Object.defineProperty(exports, "compareArraysByProp", { enumerable: true, get: function () { return
|
|
66
|
-
Object.defineProperty(exports, "getLocalTimeInfo", { enumerable: true, get: function () { return
|
|
67
|
-
Object.defineProperty(exports, "genCommaList", { enumerable: true, get: function () { return
|
|
68
|
-
Object.defineProperty(exports, "prefixWithAOrAn", { enumerable: true, get: function () { return
|
|
69
|
-
Object.defineProperty(exports, "everyAsync", { enumerable: true, get: function () { return
|
|
70
|
-
Object.defineProperty(exports, "filterAsync", { enumerable: true, get: function () { return
|
|
71
|
-
Object.defineProperty(exports, "forEachAsync", { enumerable: true, get: function () { return
|
|
72
|
-
Object.defineProperty(exports, "mapAsync", { enumerable: true, get: function () { return
|
|
73
|
-
Object.defineProperty(exports, "someAsync", { enumerable: true, get: function () { return
|
|
74
|
-
Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return
|
|
75
|
-
Object.defineProperty(exports, "shuffleArray", { enumerable: true, get: function () { return
|
|
76
|
-
Object.defineProperty(exports, "DayOfWeek", { enumerable: true, get: function () { return
|
|
77
|
-
Object.defineProperty(exports, "LogType", { enumerable: true, get: function () { return
|
|
78
|
-
Object.defineProperty(exports, "LogSource", { enumerable: true, get: function () { return
|
|
79
|
-
Object.defineProperty(exports, "LogAction", { enumerable: true, get: function () { return
|
|
80
|
-
Object.defineProperty(exports, "LogBuiltInMetadata", { enumerable: true, get: function () { return
|
|
81
|
-
Object.defineProperty(exports, "MINUTE_IN_MS", { enumerable: true, get: function () { return
|
|
82
|
-
Object.defineProperty(exports, "HOUR_IN_MS", { enumerable: true, get: function () { return
|
|
83
|
-
Object.defineProperty(exports, "DAY_IN_MS", { enumerable: true, get: function () { return
|
|
84
|
-
Object.defineProperty(exports, "ErrorWithCode", { enumerable: true, get: function () { return
|
|
85
|
-
Object.defineProperty(exports, "ParamType", { enumerable: true, get: function () { return
|
|
41
|
+
// Import dce-commonkit
|
|
42
|
+
var dce_commonkit_1 = require("dce-commonkit");
|
|
43
|
+
Object.defineProperty(exports, "abbreviate", { enumerable: true, get: function () { return dce_commonkit_1.abbreviate; } });
|
|
44
|
+
Object.defineProperty(exports, "avg", { enumerable: true, get: function () { return dce_commonkit_1.avg; } });
|
|
45
|
+
Object.defineProperty(exports, "ceilToNumDecimals", { enumerable: true, get: function () { return dce_commonkit_1.ceilToNumDecimals; } });
|
|
46
|
+
Object.defineProperty(exports, "floorToNumDecimals", { enumerable: true, get: function () { return dce_commonkit_1.floorToNumDecimals; } });
|
|
47
|
+
Object.defineProperty(exports, "forceNumIntoBounds", { enumerable: true, get: function () { return dce_commonkit_1.forceNumIntoBounds; } });
|
|
48
|
+
Object.defineProperty(exports, "padDecimalZeros", { enumerable: true, get: function () { return dce_commonkit_1.padDecimalZeros; } });
|
|
49
|
+
Object.defineProperty(exports, "padZerosLeft", { enumerable: true, get: function () { return dce_commonkit_1.padZerosLeft; } });
|
|
50
|
+
Object.defineProperty(exports, "roundToNumDecimals", { enumerable: true, get: function () { return dce_commonkit_1.roundToNumDecimals; } });
|
|
51
|
+
Object.defineProperty(exports, "sum", { enumerable: true, get: function () { return dce_commonkit_1.sum; } });
|
|
52
|
+
Object.defineProperty(exports, "waitMs", { enumerable: true, get: function () { return dce_commonkit_1.waitMs; } });
|
|
53
|
+
Object.defineProperty(exports, "getOrdinal", { enumerable: true, get: function () { return dce_commonkit_1.getOrdinal; } });
|
|
54
|
+
Object.defineProperty(exports, "getTimeInfoInET", { enumerable: true, get: function () { return dce_commonkit_1.getTimeInfoInET; } });
|
|
55
|
+
Object.defineProperty(exports, "getTimestampFromTimeInfoInET", { enumerable: true, get: function () { return dce_commonkit_1.getTimestampFromTimeInfoInET; } });
|
|
56
|
+
Object.defineProperty(exports, "startMinWait", { enumerable: true, get: function () { return dce_commonkit_1.startMinWait; } });
|
|
57
|
+
Object.defineProperty(exports, "getHumanReadableDate", { enumerable: true, get: function () { return dce_commonkit_1.getHumanReadableDate; } });
|
|
58
|
+
Object.defineProperty(exports, "getPartOfDay", { enumerable: true, get: function () { return dce_commonkit_1.getPartOfDay; } });
|
|
59
|
+
Object.defineProperty(exports, "stringsToHumanReadableList", { enumerable: true, get: function () { return dce_commonkit_1.stringsToHumanReadableList; } });
|
|
60
|
+
Object.defineProperty(exports, "onlyKeepLetters", { enumerable: true, get: function () { return dce_commonkit_1.onlyKeepLetters; } });
|
|
61
|
+
Object.defineProperty(exports, "parallelLimit", { enumerable: true, get: function () { return dce_commonkit_1.parallelLimit; } });
|
|
62
|
+
Object.defineProperty(exports, "getMonthName", { enumerable: true, get: function () { return dce_commonkit_1.getMonthName; } });
|
|
63
|
+
Object.defineProperty(exports, "genCSV", { enumerable: true, get: function () { return dce_commonkit_1.genCSV; } });
|
|
64
|
+
Object.defineProperty(exports, "extractProp", { enumerable: true, get: function () { return dce_commonkit_1.extractProp; } });
|
|
65
|
+
Object.defineProperty(exports, "compareArraysByProp", { enumerable: true, get: function () { return dce_commonkit_1.compareArraysByProp; } });
|
|
66
|
+
Object.defineProperty(exports, "getLocalTimeInfo", { enumerable: true, get: function () { return dce_commonkit_1.getLocalTimeInfo; } });
|
|
67
|
+
Object.defineProperty(exports, "genCommaList", { enumerable: true, get: function () { return dce_commonkit_1.genCommaList; } });
|
|
68
|
+
Object.defineProperty(exports, "prefixWithAOrAn", { enumerable: true, get: function () { return dce_commonkit_1.prefixWithAOrAn; } });
|
|
69
|
+
Object.defineProperty(exports, "everyAsync", { enumerable: true, get: function () { return dce_commonkit_1.everyAsync; } });
|
|
70
|
+
Object.defineProperty(exports, "filterAsync", { enumerable: true, get: function () { return dce_commonkit_1.filterAsync; } });
|
|
71
|
+
Object.defineProperty(exports, "forEachAsync", { enumerable: true, get: function () { return dce_commonkit_1.forEachAsync; } });
|
|
72
|
+
Object.defineProperty(exports, "mapAsync", { enumerable: true, get: function () { return dce_commonkit_1.mapAsync; } });
|
|
73
|
+
Object.defineProperty(exports, "someAsync", { enumerable: true, get: function () { return dce_commonkit_1.someAsync; } });
|
|
74
|
+
Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return dce_commonkit_1.capitalize; } });
|
|
75
|
+
Object.defineProperty(exports, "shuffleArray", { enumerable: true, get: function () { return dce_commonkit_1.shuffleArray; } });
|
|
76
|
+
Object.defineProperty(exports, "DayOfWeek", { enumerable: true, get: function () { return dce_commonkit_1.DayOfWeek; } });
|
|
77
|
+
Object.defineProperty(exports, "LogType", { enumerable: true, get: function () { return dce_commonkit_1.LogType; } });
|
|
78
|
+
Object.defineProperty(exports, "LogSource", { enumerable: true, get: function () { return dce_commonkit_1.LogSource; } });
|
|
79
|
+
Object.defineProperty(exports, "LogAction", { enumerable: true, get: function () { return dce_commonkit_1.LogAction; } });
|
|
80
|
+
Object.defineProperty(exports, "LogBuiltInMetadata", { enumerable: true, get: function () { return dce_commonkit_1.LogBuiltInMetadata; } });
|
|
81
|
+
Object.defineProperty(exports, "MINUTE_IN_MS", { enumerable: true, get: function () { return dce_commonkit_1.MINUTE_IN_MS; } });
|
|
82
|
+
Object.defineProperty(exports, "HOUR_IN_MS", { enumerable: true, get: function () { return dce_commonkit_1.HOUR_IN_MS; } });
|
|
83
|
+
Object.defineProperty(exports, "DAY_IN_MS", { enumerable: true, get: function () { return dce_commonkit_1.DAY_IN_MS; } });
|
|
84
|
+
Object.defineProperty(exports, "ErrorWithCode", { enumerable: true, get: function () { return dce_commonkit_1.ErrorWithCode; } });
|
|
85
|
+
Object.defineProperty(exports, "ParamType", { enumerable: true, get: function () { return dce_commonkit_1.ParamType; } });
|
|
86
86
|
// Import helpers
|
|
87
87
|
var initServer_1 = __importDefault(require("./helpers/initServer"));
|
|
88
88
|
exports.initServer = initServer_1.default;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAuB;AACvB,+CA+CuB;AAuBrB,2FArEA,0BAAU,OAqEA;AACV,oFArEA,mBAAG,OAqEA;AACH,kGArEA,iCAAiB,OAqEA;AACjB,mGArEA,kCAAkB,OAqEA;AAClB,mGArEA,kCAAkB,OAqEA;AAClB,gGArEA,+BAAe,OAqEA;AACf,6FArEA,4BAAY,OAqEA;AACZ,mGArEA,kCAAkB,OAqEA;AAClB,oFArEA,mBAAG,OAqEA;AACH,uFArEA,sBAAM,OAqEA;AACN,2FArEA,0BAAU,OAqEA;AACV,gGArEA,+BAAe,OAqEA;AACf,6GArEA,4CAA4B,OAqEA;AAC5B,6FArEA,4BAAY,OAqEA;AACZ,qGArEA,oCAAoB,OAqEA;AACpB,6FArEA,4BAAY,OAqEA;AACZ,2GArEA,0CAA0B,OAqEA;AAC1B,gGArEA,+BAAe,OAqEA;AACf,8FArEA,6BAAa,OAqEA;AACb,6FArEA,4BAAY,OAqEA;AACZ,uFArEA,sBAAM,OAqEA;AACN,4FArEA,2BAAW,OAqEA;AACX,oGArEA,mCAAmB,OAqEA;AAEnB,iGAtEA,gCAAgB,OAsEA;AADhB,6FApEA,4BAAY,OAoEA;AAEZ,gGArEA,+BAAe,OAqEA;AACf,2FArEA,0BAAU,OAqEA;AACV,4FArEA,2BAAW,OAqEA;AACX,6FArEA,4BAAY,OAqEA;AACZ,yFArEA,wBAAQ,OAqEA;AACR,0FArEA,yBAAS,OAqEA;AACT,2FArEA,0BAAU,OAqEA;AACV,6FArEA,4BAAY,OAqEA;AAWZ,0FA/EA,yBAAS,OA+EA;AAET,wFA/EA,uBAAO,OA+EA;AACP,0FA/EA,yBAAS,OA+EA;AACT,0FA/EA,yBAAS,OA+EA;AACT,mGA/EA,kCAAkB,OA+EA;AApDlB,6FAxBA,4BAAY,OAwBA;AACZ,2FAxBA,0BAAU,OAwBA;AACV,0FAxBA,yBAAS,OAwBA;AAJT,8FAnBA,6BAAa,OAmBA;AA2Db,0FA7EA,yBAAS,OA6EA;AA1EX,iBAAiB;AACjB,oEAA8C;AAsD5C,qBAtDK,oBAAU,CAsDL;AArDZ,8EAAwD;AAsDtD,0BAtDK,yBAAe,CAsDL;AArDjB,sEAAgD;AAsD9C,sBAtDK,qBAAW,CAsDL;AArDb,0EAAoD;AAsDlD,wBAtDK,uBAAa,CAsDL;AArDf,wFAAkE;AAwDhE,+BAxDK,8BAAoB,CAwDL;AAvDtB,wGAAkF;AAwDhF,uCAxDK,sCAA4B,CAwDL;AAvD9B,+FAAkG;AAoDhG,oCApDK,mCAAyB,CAoDL;AACzB,iGArDkC,4CAAgB,OAqDlC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dce-expresskit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
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",
|
|
@@ -20,13 +20,7 @@
|
|
|
20
20
|
"Toolkit"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"
|
|
24
|
-
"@fortawesome/free-regular-svg-icons": "^6.7.2",
|
|
25
|
-
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
|
26
|
-
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
27
|
-
"bootstrap": "^5.3.3",
|
|
28
|
-
"dce-reactkit": "^4.3.4",
|
|
29
|
-
"react": "^19.2.1"
|
|
23
|
+
"dce-commonkit": "^5.0.0"
|
|
30
24
|
},
|
|
31
25
|
"peerDependencies": {
|
|
32
26
|
"caccl": "^x.x.x",
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* @param [adminsOnly] true if the endpoint is for admins only
|
|
6
6
|
* @returns the endpoint path
|
|
7
7
|
*/
|
|
8
|
-
const generateEndpointPath = (collectionName: string, adminsOnly
|
|
8
|
+
const generateEndpointPath = (collectionName: string, adminsOnly: boolean = true) => {
|
|
9
9
|
// Determine prefix based on whether the endpoint is for admins only
|
|
10
10
|
const userPath = adminsOnly ? 'admin' : 'ttm';
|
|
11
11
|
|
|
12
12
|
// Return the endpoint path
|
|
13
|
-
return `/api/${userPath}/dce-
|
|
13
|
+
return `/api/${userPath}/dce-commonkit/dbeditor/${collectionName}`;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export default generateEndpointPath;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Import express
|
|
2
2
|
import express from 'express';
|
|
3
3
|
|
|
4
|
-
// Import dce-
|
|
4
|
+
// Import dce-commonkit
|
|
5
5
|
import {
|
|
6
6
|
ParamType,
|
|
7
|
-
} from 'dce-
|
|
7
|
+
} from 'dce-commonkit';
|
|
8
8
|
|
|
9
9
|
// Import shared helpers
|
|
10
10
|
import genRouteHandler from '../genRouteHandler';
|