dce-expresskit 4.3.4 → 5.0.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/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 +7 -1
- package/lib/helpers/initExpressKitCollections.js +24 -1
- package/lib/helpers/initExpressKitCollections.js.map +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.js +5 -5
- package/lib/helpers/visitEndpointOnAnotherServer/index.js.map +1 -1
- package/lib/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.js +7 -7
- 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 +3 -3
- package/lib/index.js +82 -47
- 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 +19 -2
- package/src/helpers/initServer.ts +3 -3
- package/src/helpers/visitEndpointOnAnotherServer/index.ts +5 -5
- package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +2 -2
- package/src/html/genErrorPage.ts +4 -7
- package/src/index.ts +4 -3
- package/src/errors/ErrorWithCode.tsx +0 -15
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.internalGetLogReviewerAdminCollection = exports.internalGetSelectAdminCollection = exports.internalGetCrossServerCredentialCollection = exports.internalGetLogCollection = void 0;
|
|
39
|
+
exports.getLogCollection = exports.internalGetLogReviewerAdminCollection = exports.internalGetSelectAdminCollection = exports.internalGetCrossServerCredentialCollection = exports.internalGetLogCollection = void 0;
|
|
40
40
|
/*------------------------------------------------------------------------*/
|
|
41
41
|
/* ------------------------- Collection Storage ------------------------- */
|
|
42
42
|
/*------------------------------------------------------------------------*/
|
|
@@ -132,6 +132,29 @@ var internalGetLogReviewerAdminCollection = function () { return __awaiter(void
|
|
|
132
132
|
}); };
|
|
133
133
|
exports.internalGetLogReviewerAdminCollection = internalGetLogReviewerAdminCollection;
|
|
134
134
|
/*------------------------------------------------------------------------*/
|
|
135
|
+
/* ----------------------- Public Collection Getters -------------------- */
|
|
136
|
+
/*------------------------------------------------------------------------*/
|
|
137
|
+
/**
|
|
138
|
+
* Get the log collection. Resolves after the collection has been initialized
|
|
139
|
+
* @author Yuen Ler Chow
|
|
140
|
+
* @returns a promise that resolves with the log collection
|
|
141
|
+
*/
|
|
142
|
+
var getLogCollection = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
143
|
+
return __generator(this, function (_a) {
|
|
144
|
+
switch (_a.label) {
|
|
145
|
+
case 0:
|
|
146
|
+
// Wait for collections to be initialized
|
|
147
|
+
return [4 /*yield*/, collectionsInitialized];
|
|
148
|
+
case 1:
|
|
149
|
+
// Wait for collections to be initialized
|
|
150
|
+
_a.sent();
|
|
151
|
+
// Return the log collection
|
|
152
|
+
return [2 /*return*/, logCollection];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}); };
|
|
156
|
+
exports.getLogCollection = getLogCollection;
|
|
157
|
+
/*------------------------------------------------------------------------*/
|
|
135
158
|
/* -------------------------------- Main -------------------------------- */
|
|
136
159
|
/*------------------------------------------------------------------------*/
|
|
137
160
|
/**
|
|
@@ -1 +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,6BAAoD,CAAC;AACzD,IAAI,4BAAoD,CAAC;AACzD,IAAM,sBAAsB,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;IACzD,6BAA6B,GAAG,OAAO,CAAC;IACxC,4BAA4B,GAAG,MAAM,CAAC;AACxC,CAAC,CAAC,CAAC;AAEH,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E;;;GAGG;AACI,IAAM,wBAAwB,GAAG;;;;YACtC,yCAAyC;YACzC,qBAAM,sBAAsB,EAAA;;gBAD5B,yCAAyC;gBACzC,SAA4B,CAAC;gBAE7B,4BAA4B;gBAC5B,sBAAO,aAAa,EAAC;;;KACtB,CAAC;AANW,QAAA,wBAAwB,4BAMnC;AAEF;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,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
|
+
{"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,6BAAoD,CAAC;AACzD,IAAI,4BAAoD,CAAC;AACzD,IAAM,sBAAsB,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;IACzD,6BAA6B,GAAG,OAAO,CAAC;IACxC,4BAA4B,GAAG,MAAM,CAAC;AACxC,CAAC,CAAC,CAAC;AAEH,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E;;;GAGG;AACI,IAAM,wBAAwB,GAAG;;;;YACtC,yCAAyC;YACzC,qBAAM,sBAAsB,EAAA;;gBAD5B,yCAAyC;gBACzC,SAA4B,CAAC;gBAE7B,4BAA4B;gBAC5B,sBAAO,aAAa,EAAC;;;KACtB,CAAC;AANW,QAAA,wBAAwB,4BAMnC;AAEF;;;GAGG;AACI,IAAM,0CAA0C,GAAG;;;;YACxD,yCAAyC;YACzC,qBAAM,sBAAsB,EAAA;;gBAD5B,yCAAyC;gBACzC,SAA4B,CAAC;gBAE7B,gDAAgD;gBAChD,sBAAO,+BAA+B,EAAC;;;KACxC,CAAC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AAa,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,6 +1,6 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
/**
|
|
3
|
-
* Prepare dce-
|
|
3
|
+
* Prepare dce-commonkit to run on the server
|
|
4
4
|
* @author Gabe Abrams
|
|
5
5
|
* @param opts object containing all arguments
|
|
6
6
|
* @param opts.app express app from inside of the postprocessor function that
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,uBAAuB;AACvB,+CAQuB;AAEvB,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,8BAAc,EACd,IAAA,yBAAe,EAAC;QACd,UAAU,EAAE;YACV,OAAO,EAAE,yBAAS,CAAC,MAAM;YACzB,UAAU,EAAE,yBAAS,CAAC,MAAM;YAC5B,IAAI,EAAE,yBAAS,CAAC,IAAI;YACpB,KAAK,EAAE,yBAAS,CAAC,MAAM;YACvB,QAAQ,EAAE,yBAAS,CAAC,IAAI;YACxB,YAAY,EAAE,yBAAS,CAAC,cAAc;YACtC,SAAS,EAAE,yBAAS,CAAC,cAAc;YACnC,UAAU,EAAE,yBAAS,CAAC,cAAc;YACpC,MAAM,EAAE,yBAAS,CAAC,cAAc;YAChC,MAAM,EAAE,yBAAS,CAAC,cAAc;SACjC;QACD,OAAO,EAAE,UAAC,EAA0B;gBAAxB,MAAM,YAAA,EAAE,cAAc,oBAAA;YAChC,kBAAkB;YAClB,IAAM,OAAO,GAA+B,CAC1C,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC;gBAC5D,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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;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"}
|
|
@@ -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
|
/*------------------------------------------------------------------------*/
|
|
@@ -71,13 +71,13 @@ var visitEndpointOnAnotherServer = function (opts) { return __awaiter(void 0, vo
|
|
|
71
71
|
response = _a.sent();
|
|
72
72
|
// Check for failure
|
|
73
73
|
if (!response || !response.body) {
|
|
74
|
-
throw new
|
|
74
|
+
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
75
|
}
|
|
76
76
|
if (!response.body.success) {
|
|
77
77
|
// Other errors
|
|
78
|
-
throw new
|
|
78
|
+
throw new dce_commonkit_1.ErrorWithCode((response.body.message
|
|
79
79
|
|| 'An unknown error occurred. Please contact an admin.'), (response.body.code
|
|
80
|
-
||
|
|
80
|
+
|| dce_commonkit_1.CommonKitErrorCode.NoCode));
|
|
81
81
|
}
|
|
82
82
|
body = response.body.body;
|
|
83
83
|
// Return
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/visitEndpointOnAnotherServer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/visitEndpointOnAnotherServer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAuB;AACvB,+CAGuB;AAEvB,sBAAsB;AACtB,0FAAoE;AAEpE,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E;;;;;;;;;GASG;AACH,IAAM,4BAA4B,GAAG,UACnC,IAMC;;;;oBAGgB,qBAAM,IAAA,mCAAyB,EAAC;oBAC/C,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,YAAY,EAAE,IAAI,CAAC,YAAY;iBAChC,CAAC,EAAA;;gBANI,QAAQ,GAAG,SAMf;gBAEF,oBAAoB;gBACpB,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;oBAChC,MAAM,IAAI,6BAAa,CACrB,uGAAuG,EACvG,kCAAkB,CAAC,UAAU,CAC9B,CAAC;gBACJ,CAAC;gBACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;oBAC3B,eAAe;oBACf,MAAM,IAAI,6BAAa,CACrB,CACE,QAAQ,CAAC,IAAI,CAAC,OAAO;2BAClB,qDAAqD,CACzD,EACD,CACE,QAAQ,CAAC,IAAI,CAAC,IAAI;2BACf,kCAAkB,CAAC,MAAM,CAC7B,CACF,CAAC;gBACJ,CAAC;gBAGO,IAAI,GAAK,QAAQ,CAAC,IAAI,KAAlB,CAAmB;gBAE/B,SAAS;gBACT,sBAAO,IAAI,EAAC;;;KACb,CAAC;AAEF,kBAAe,4BAA4B,CAAC"}
|
|
@@ -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
|
|
@@ -70,7 +70,7 @@ var credentials = (((_a = process.env.DCEKIT_CROSS_SERVER_CREDENTIALS) !== null
|
|
|
70
70
|
var parts = str.split(':');
|
|
71
71
|
// Check for errors
|
|
72
72
|
if (parts.length !== 3) {
|
|
73
|
-
throw new
|
|
73
|
+
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);
|
|
74
74
|
}
|
|
75
75
|
// Return the credential
|
|
76
76
|
return {
|
|
@@ -94,7 +94,7 @@ var getCrossServerCredential = function (host) {
|
|
|
94
94
|
return cred.host.toLowerCase() === host.toLowerCase();
|
|
95
95
|
});
|
|
96
96
|
if (!credential) {
|
|
97
|
-
throw new
|
|
97
|
+
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
98
|
}
|
|
99
99
|
// Return credential
|
|
100
100
|
return credential;
|
|
@@ -218,16 +218,16 @@ var sendServerToServerRequest = function (opts) { return __awaiter(void 0, void
|
|
|
218
218
|
}];
|
|
219
219
|
case 9:
|
|
220
220
|
err_1 = _b.sent();
|
|
221
|
-
throw new
|
|
221
|
+
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
222
|
case 10: return [3 /*break*/, 12];
|
|
223
223
|
case 11:
|
|
224
224
|
err_2 = _b.sent();
|
|
225
225
|
// Self-signed certificate error:
|
|
226
226
|
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
|
|
227
|
+
throw new dce_commonkit_1.ErrorWithCode('We refused to send a request because the receiver has self-signed certificates.', ExpressKitErrorCode_1.default.SelfSigned);
|
|
228
228
|
}
|
|
229
229
|
// No tries left
|
|
230
|
-
throw new
|
|
230
|
+
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
231
|
case 12: return [2 /*return*/];
|
|
232
232
|
}
|
|
233
233
|
});
|
|
@@ -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":";;;;;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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,10 +1,10 @@
|
|
|
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';
|
|
5
5
|
import handleSuccess from './helpers/handleSuccess';
|
|
6
6
|
import addDBEditorEndpoints from './helpers/addDBEditorEndpoints';
|
|
7
7
|
import visitEndpointOnAnotherServer from './helpers/visitEndpointOnAnotherServer';
|
|
8
|
-
import initExpressKitCollections from './helpers/initExpressKitCollections';
|
|
8
|
+
import initExpressKitCollections, { getLogCollection } from './helpers/initExpressKitCollections';
|
|
9
9
|
import CrossServerCredential from './types/CrossServerCredential';
|
|
10
|
-
export { ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, getTimestampFromTimeInfoInET, 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, };
|
|
10
|
+
export { ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, getTimestampFromTimeInfoInET, 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, getLogCollection, addDBEditorEndpoints, visitEndpointOnAnotherServer, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, CrossServerCredential, ParamType, };
|
package/lib/index.js
CHANGED
|
@@ -1,54 +1,88 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, "
|
|
11
|
-
Object.defineProperty(exports, "
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
-
Object.defineProperty(exports, "
|
|
14
|
-
Object.defineProperty(exports, "
|
|
15
|
-
Object.defineProperty(exports, "
|
|
16
|
-
Object.defineProperty(exports, "
|
|
17
|
-
Object.defineProperty(exports, "
|
|
18
|
-
Object.defineProperty(exports, "
|
|
19
|
-
Object.defineProperty(exports, "
|
|
20
|
-
Object.defineProperty(exports, "
|
|
21
|
-
Object.defineProperty(exports, "
|
|
22
|
-
Object.defineProperty(exports, "
|
|
23
|
-
Object.defineProperty(exports, "
|
|
24
|
-
Object.defineProperty(exports, "
|
|
25
|
-
Object.defineProperty(exports, "
|
|
26
|
-
Object.defineProperty(exports, "
|
|
27
|
-
Object.defineProperty(exports, "
|
|
28
|
-
Object.defineProperty(exports, "
|
|
29
|
-
Object.defineProperty(exports, "
|
|
30
|
-
Object.defineProperty(exports, "
|
|
31
|
-
Object.defineProperty(exports, "
|
|
32
|
-
Object.defineProperty(exports, "
|
|
33
|
-
Object.defineProperty(exports, "
|
|
34
|
-
Object.defineProperty(exports, "
|
|
35
|
-
Object.defineProperty(exports, "
|
|
36
|
-
Object.defineProperty(exports, "
|
|
37
|
-
Object.defineProperty(exports, "
|
|
38
|
-
Object.defineProperty(exports, "
|
|
39
|
-
Object.defineProperty(exports, "
|
|
40
|
-
Object.defineProperty(exports, "
|
|
41
|
-
Object.defineProperty(exports, "
|
|
42
|
-
Object.defineProperty(exports, "
|
|
43
|
-
Object.defineProperty(exports, "
|
|
44
|
-
Object.defineProperty(exports, "
|
|
45
|
-
Object.defineProperty(exports, "
|
|
46
|
-
Object.defineProperty(exports, "
|
|
47
|
-
Object.defineProperty(exports, "
|
|
48
|
-
Object.defineProperty(exports, "
|
|
49
|
-
Object.defineProperty(exports, "
|
|
50
|
-
Object.defineProperty(exports, "
|
|
51
|
-
Object.defineProperty(exports, "
|
|
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
|
+
exports.ParamType = void 0;
|
|
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; } });
|
|
52
86
|
// Import helpers
|
|
53
87
|
var initServer_1 = __importDefault(require("./helpers/initServer"));
|
|
54
88
|
exports.initServer = initServer_1.default;
|
|
@@ -62,6 +96,7 @@ var addDBEditorEndpoints_1 = __importDefault(require("./helpers/addDBEditorEndpo
|
|
|
62
96
|
exports.addDBEditorEndpoints = addDBEditorEndpoints_1.default;
|
|
63
97
|
var visitEndpointOnAnotherServer_1 = __importDefault(require("./helpers/visitEndpointOnAnotherServer"));
|
|
64
98
|
exports.visitEndpointOnAnotherServer = visitEndpointOnAnotherServer_1.default;
|
|
65
|
-
var initExpressKitCollections_1 =
|
|
99
|
+
var initExpressKitCollections_1 = __importStar(require("./helpers/initExpressKitCollections"));
|
|
66
100
|
exports.initExpressKitCollections = initExpressKitCollections_1.default;
|
|
101
|
+
Object.defineProperty(exports, "getLogCollection", { enumerable: true, get: function () { return initExpressKitCollections_1.getLogCollection; } });
|
|
67
102
|
//# 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":"
|
|
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.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",
|
|
@@ -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';
|