dce-reactkit 3.12.3 → 4.0.0-beta-date-and-time.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.
Files changed (69) hide show
  1. package/dist/cjs/index.js +5338 -5515
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/LoadingSpinner.d.ts +2 -2
  4. package/dist/cjs/types/components/SimpleDateChooser.d.ts +3 -1
  5. package/dist/cjs/types/components/SimpleTimeChooser.d.ts +20 -0
  6. package/dist/cjs/types/components/Tooltip.d.ts +1 -1
  7. package/dist/cjs/types/index.d.ts +12 -11
  8. package/dist/cjs/types/types/ParamType.d.ts +10 -10
  9. package/dist/cjs/types/types/ReactKitErrorCode.d.ts +2 -14
  10. package/dist/esm/index.js +5344 -5517
  11. package/dist/esm/index.js.map +1 -1
  12. package/dist/esm/types/components/LoadingSpinner.d.ts +2 -2
  13. package/dist/esm/types/components/SimpleDateChooser.d.ts +3 -1
  14. package/dist/esm/types/components/SimpleTimeChooser.d.ts +20 -0
  15. package/dist/esm/types/components/Tooltip.d.ts +1 -1
  16. package/dist/esm/types/index.d.ts +12 -11
  17. package/dist/esm/types/types/ParamType.d.ts +10 -10
  18. package/dist/esm/types/types/ReactKitErrorCode.d.ts +2 -14
  19. package/dist/index.d.ts +183 -354
  20. package/genEncodedSecret.ts +84 -0
  21. package/package.json +7 -9
  22. package/rollup.config.js +2 -0
  23. package/src/components/AppWrapper.tsx +3 -1
  24. package/src/components/CheckboxButton.tsx +1 -1
  25. package/src/components/Dropdown.tsx +1 -1
  26. package/src/components/LogReviewer.tsx +2 -2
  27. package/src/components/Modal/index.tsx +1 -1
  28. package/src/components/RadioButton.tsx +3 -1
  29. package/src/components/SimpleDateChooser.tsx +62 -26
  30. package/src/components/SimpleTimeChooser.tsx +195 -0
  31. package/src/components/Tooltip.tsx +1 -1
  32. package/src/{client → helpers}/initClient.tsx +5 -1
  33. package/src/helpers/logClientEvent.tsx +3 -1
  34. package/src/helpers/visitServerEndpoint.tsx +1 -1
  35. package/src/index.ts +20 -20
  36. package/src/types/ParamType.ts +10 -10
  37. package/src/types/ReactKitErrorCode.tsx +3 -17
  38. package/dist/cjs/types/components/ItemPicker/index.test.d.ts +0 -1
  39. package/dist/cjs/types/helpers/addDBEditorEndpoints.d.ts +0 -41
  40. package/dist/cjs/types/helpers/genRouteHandler.d.ts +0 -76
  41. package/dist/cjs/types/helpers/handleError.d.ts +0 -18
  42. package/dist/cjs/types/helpers/handleSuccess.d.ts +0 -8
  43. package/dist/cjs/types/helpers/parseUserAgent.d.ts +0 -17
  44. package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/index.d.ts +0 -24
  45. package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +0 -33
  46. package/dist/cjs/types/server/initLogCollection.d.ts +0 -8
  47. package/dist/cjs/types/server/initServer.d.ts +0 -42
  48. package/dist/esm/types/components/ItemPicker/index.test.d.ts +0 -1
  49. package/dist/esm/types/helpers/addDBEditorEndpoints.d.ts +0 -41
  50. package/dist/esm/types/helpers/genRouteHandler.d.ts +0 -76
  51. package/dist/esm/types/helpers/handleError.d.ts +0 -18
  52. package/dist/esm/types/helpers/handleSuccess.d.ts +0 -8
  53. package/dist/esm/types/helpers/parseUserAgent.d.ts +0 -17
  54. package/dist/esm/types/helpers/visitEndpointOnAnotherServer/index.d.ts +0 -24
  55. package/dist/esm/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +0 -33
  56. package/dist/esm/types/server/initLogCollection.d.ts +0 -8
  57. package/dist/esm/types/server/initServer.d.ts +0 -42
  58. package/src/components/ItemPicker/index.test.tsx +0 -783
  59. package/src/helpers/addDBEditorEndpoints.ts +0 -128
  60. package/src/helpers/genRouteHandler.ts +0 -948
  61. package/src/helpers/handleError.ts +0 -65
  62. package/src/helpers/handleSuccess.ts +0 -18
  63. package/src/helpers/parseUserAgent.ts +0 -108
  64. package/src/helpers/visitEndpointOnAnotherServer/index.ts +0 -93
  65. package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +0 -164
  66. package/src/server/initLogCollection.ts +0 -27
  67. package/src/server/initServer.ts +0 -287
  68. /package/dist/cjs/types/{client → helpers}/initClient.d.ts +0 -0
  69. /package/dist/esm/types/{client → helpers}/initClient.d.ts +0 -0
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import React$1 from 'react';
3
3
  import { IconProp } from '@fortawesome/fontawesome-svg-core';
4
- import express from 'express';
5
4
 
6
5
  /**
7
6
  * Bootstrap variants
@@ -24,7 +23,7 @@ declare enum Variant {
24
23
  * @author Gabe Abrams
25
24
  */
26
25
 
27
- type Props$l = {
26
+ type Props$m = {
28
27
  children: React$1.ReactNode;
29
28
  };
30
29
  /**
@@ -107,27 +106,28 @@ declare const showFatalError: (error: any, errorTitle?: string) => Promise<void>
107
106
  * @author Gabe Abrams
108
107
  */
109
108
  declare const addFatalErrorHandler: (handler: () => void) => void;
110
- declare const AppWrapper: React$1.FC<Props$l>;
109
+ declare const AppWrapper: React$1.FC<Props$m>;
111
110
 
112
111
  /**
113
112
  * Loading spinner/indicator
114
113
  * @author Gabe Abrams
115
114
  */
116
- declare const LoadingSpinner: () => JSX.Element;
115
+
116
+ declare const LoadingSpinner: () => React$1.JSX.Element;
117
117
 
118
118
  /**
119
119
  * Displays an error
120
120
  * @author Gabe Abrams
121
121
  */
122
122
 
123
- type Props$k = {
123
+ type Props$l = {
124
124
  error: any;
125
125
  title?: string;
126
126
  onClose?: () => void;
127
127
  variant?: Variant;
128
128
  icon?: IconProp;
129
129
  };
130
- declare const ErrorBox: React$1.FC<Props$k>;
130
+ declare const ErrorBox: React$1.FC<Props$l>;
131
131
 
132
132
  /**
133
133
  * Types of buttons in the modal
@@ -226,21 +226,21 @@ declare const Modal: React$1.FC<ModalProps>;
226
226
  * @author Gabe Abrams
227
227
  */
228
228
 
229
- type Props$j = {
229
+ type Props$k = {
230
230
  title: React$1.ReactNode;
231
231
  children: React$1.ReactNode;
232
232
  topRightChildren?: React$1.ReactNode;
233
233
  noBottomMargin?: boolean;
234
234
  noBottomPadding?: boolean;
235
235
  };
236
- declare const TabBox: React$1.FC<Props$j>;
236
+ declare const TabBox: React$1.FC<Props$k>;
237
237
 
238
238
  /**
239
239
  * A radio selection button
240
240
  * @author Gabe Abrams
241
241
  */
242
242
 
243
- type Props$i = {
243
+ type Props$j = {
244
244
  text: React$1.ReactNode;
245
245
  onSelected: () => void;
246
246
  ariaLabel: string;
@@ -254,14 +254,14 @@ type Props$i = {
254
254
  small?: boolean;
255
255
  useComplexFormatting?: boolean;
256
256
  };
257
- declare const RadioButton: React$1.FC<Props$i>;
257
+ declare const RadioButton: React$1.FC<Props$j>;
258
258
 
259
259
  /**
260
260
  * A checkbox button
261
261
  * @author Gabe Abrams
262
262
  */
263
263
 
264
- type Props$h = {
264
+ type Props$i = {
265
265
  text: React$1.ReactNode;
266
266
  onChanged: (checked: boolean) => void;
267
267
  ariaLabel: string;
@@ -276,14 +276,14 @@ type Props$h = {
276
276
  dashed?: boolean;
277
277
  useComplexFormatting?: boolean;
278
278
  };
279
- declare const CheckboxButton: React$1.FC<Props$h>;
279
+ declare const CheckboxButton: React$1.FC<Props$i>;
280
280
 
281
281
  /**
282
282
  * Input group with a title and space for buttons
283
283
  * @author Gabe Abrams
284
284
  */
285
285
 
286
- type Props$g = {
286
+ type Props$h = {
287
287
  label: React$1.ReactNode;
288
288
  minLabelWidth?: string;
289
289
  children: React$1.ReactNode;
@@ -292,14 +292,15 @@ type Props$g = {
292
292
  isAdminFeature?: boolean;
293
293
  noMarginOnBottom?: boolean;
294
294
  };
295
- declare const ButtonInputGroup: React$1.FC<Props$g>;
295
+ declare const ButtonInputGroup: React$1.FC<Props$h>;
296
296
 
297
297
  /**
298
298
  * A very simple, lightweight date chooser
299
299
  * @author Gabe Abrams
300
+ * @author Gardeniu Liu
300
301
  */
301
302
 
302
- type Props$f = {
303
+ type Props$g = {
303
304
  ariaLabel: string;
304
305
  name: string;
305
306
  month: number;
@@ -313,9 +314,30 @@ type Props$f = {
313
314
  */
314
315
  onChange: (month: number, day: number, year: number) => void;
315
316
  numMonthsToShow?: number;
316
- chooseFromPast?: boolean;
317
+ dontAllowPast?: boolean;
318
+ dontAllowFuture?: boolean;
317
319
  };
318
- declare const SimpleDateChooser: React$1.FC<Props$f>;
320
+ declare const SimpleDateChooser: React$1.FC<Props$g>;
321
+
322
+ /**
323
+ * A very simple, lightweight time chooser
324
+ * @author Gardenia Liu
325
+ */
326
+
327
+ type Props$f = {
328
+ ariaLabel: string;
329
+ name: string;
330
+ hour: number;
331
+ minute: number;
332
+ /**
333
+ * Handler for when time changes
334
+ * @param hour new 24hr hour number
335
+ * @param minute new minute number
336
+ */
337
+ onChange: (hour: number, minute: number) => void;
338
+ intervalMin?: number;
339
+ };
340
+ declare const SimpleTimeChooser: React$1.FC<Props$f>;
319
341
 
320
342
  /**
321
343
  * Drawer container
@@ -473,16 +495,16 @@ declare const LogReviewer: React$1.FC<Props$8>;
473
495
  * @author Gabe Abrams
474
496
  */
475
497
  declare enum ParamType {
476
- Boolean = "boolean",
477
- BooleanOptional = "boolean-optional",
478
- Float = "float",
479
- FloatOptional = "float-optional",
480
- Int = "int",
481
- IntOptional = "int-optional",
482
- JSON = "json",
483
- JSONOptional = "json-optional",
484
- String = "string",
485
- StringOptional = "string-optional"
498
+ Boolean = "Boolean",
499
+ BooleanOptional = "BooleanOptional",
500
+ Float = "Float",
501
+ FloatOptional = "FloatOptional",
502
+ Int = "Int",
503
+ IntOptional = "IntOptional",
504
+ JSON = "JSON",
505
+ JSONOptional = "JSONOptional",
506
+ String = "String",
507
+ StringOptional = "StringOptional"
486
508
  }
487
509
 
488
510
  /**
@@ -641,7 +663,7 @@ declare const DBEntryManagerPanel: React$1.FC<Props$5>;
641
663
 
642
664
  type Props$4 = {
643
665
  text: string;
644
- children: JSX.Element;
666
+ children: any;
645
667
  };
646
668
  declare const Tooltip: React$1.FC<Props$4>;
647
669
 
@@ -774,6 +796,25 @@ declare const HOUR_IN_MS = 3600000;
774
796
  */
775
797
  declare const DAY_IN_MS = 86400000;
776
798
 
799
+ /**
800
+ * Path of the route for storing client-side logs
801
+ * @author Gabe Abrams
802
+ */
803
+ declare const LOG_REVIEW_ROUTE_PATH_PREFIX: string;
804
+
805
+ /**
806
+ * Path of the route for storing client-side logs
807
+ * @author Gabe Abrams
808
+ */
809
+ declare const LOG_ROUTE_PATH: string;
810
+
811
+ /**
812
+ * Route for checking the status of the current user's
813
+ * access to log review
814
+ * @author Gabe Abrams
815
+ */
816
+ declare const LOG_REVIEW_STATUS_ROUTE: string;
817
+
777
818
  /**
778
819
  * Dynamic words determined by the user's platform
779
820
  * @author Gabe Abrams
@@ -935,6 +976,106 @@ declare const visitServerEndpoint: (opts: {
935
976
  } | undefined;
936
977
  }) => Promise<any>;
937
978
 
979
+ /**
980
+ * Get a number's ordinal
981
+ * @author Gabe Abrams
982
+ * @param num the number being analyzed
983
+ * @returns ordinal
984
+ */
985
+ declare const getOrdinal: (num: number) => string;
986
+
987
+ /**
988
+ * Get current time info in US Boston Eastern Time, independent of machine
989
+ * timezone
990
+ * @author Gabe Abrams
991
+ * @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
992
+ * @returns object with timestamp (ms since epoch) and numbers
993
+ * corresponding to ET time values for year, month, day, hour, hour12, minute, isPM
994
+ * where hour is in 24hr time and hour12 is in 12hr time.
995
+ */
996
+ declare const getTimeInfoInET: (dateOrTimestamp?: Date | number) => {
997
+ timestamp: number;
998
+ year: number;
999
+ month: number;
1000
+ day: number;
1001
+ hour: number;
1002
+ hour12: number;
1003
+ minute: number;
1004
+ isPM: boolean;
1005
+ };
1006
+
1007
+ /**
1008
+ * Stub a server endpoint response
1009
+ * @author Gabe Abrams
1010
+ * @param opts object containing all arguments
1011
+ * @param [opts.method=GET] http method to stub
1012
+ * @param opts.path full pathname to stub
1013
+ * @param opts.body body of response if stubbing a successful response
1014
+ * @param opts.errorMessage message of error if stubbing a failed response
1015
+ * @param [opts.errorCode] error code if stubbing a failed response
1016
+ */
1017
+ declare const stubServerEndpoint: (opts: {
1018
+ method?: string | undefined;
1019
+ path: string;
1020
+ body?: any;
1021
+ errorMessage?: string | undefined;
1022
+ errorCode?: string | undefined;
1023
+ }) => void;
1024
+
1025
+ /**
1026
+ * Start a dynamic wait, call the function once the operation has completed and
1027
+ * the dynamic wait will continue waiting for the rest of the minimum time
1028
+ * @author Gabe Abrams
1029
+ * @param minWaitMs the minimum number of ms to wait
1030
+ * @returns async function to call to finish the wait
1031
+ */
1032
+ declare const startMinWait: (minWaitMs: number) => () => Promise<void>;
1033
+
1034
+ /**
1035
+ * Get a human-readable description of a date (all in ET)
1036
+ * @author Gabe Abrams
1037
+ * @param [dateOrTimestamp=today] the date or timestamp for the date to describe
1038
+ * @returns human-readable description of the date
1039
+ */
1040
+ declare const getHumanReadableDate: (dateOrTimestamp?: Date | number) => string;
1041
+
1042
+ /**
1043
+ * Get the current part of day (morning, evening, etc.)
1044
+ * @author Gabe Abrams
1045
+ * @returns the part of day (morning, evening, etc.)
1046
+ */
1047
+ declare const getPartOfDay: () => string;
1048
+
1049
+ /**
1050
+ * Create a human readable list from an array of strings.
1051
+ * For example, ['apple', 'orange'] becomes "apple and orange"
1052
+ * and ['apple', 'orange', 'mango'] becomes "apple, orange, and mango"
1053
+ * @author Gabe Abrams
1054
+ * @param items list of items in the list
1055
+ * @returns human-readable list
1056
+ */
1057
+ declare const stringsToHumanReadableList: (items: string[]) => string;
1058
+
1059
+ /**
1060
+ * Given a string, only keep the letters inside it
1061
+ * @author Gabe Abrams
1062
+ * @param str the string to parse
1063
+ * @returns only the letters inside of the string
1064
+ */
1065
+ declare const onlyKeepLetters: (str: string) => string;
1066
+
1067
+ /**
1068
+ * Run tasks in parallel with a limit on how many tasks can execute at once.
1069
+ * No guarantees are made about the order of task execution
1070
+ * @author Gabe Abrams
1071
+ * @param taskFunctions functions that start asynchronous tasks and optionally
1072
+ * resolve with values
1073
+ * @param [limit=no limit] maximum number of asynchronous tasks to permit to run at
1074
+ * once
1075
+ * @returns array of resolved values in the same order as the task functions
1076
+ */
1077
+ declare const parallelLimit: (taskFunctions: (() => Promise<any>)[], limit?: number) => Promise<any[]>;
1078
+
938
1079
  /**
939
1080
  * Allowed log levels
940
1081
  * @author Gabe Abrams
@@ -1083,234 +1224,6 @@ type LogFunction = (opts: ({
1083
1224
  target?: string;
1084
1225
  }))) => Promise<Log>;
1085
1226
 
1086
- /**
1087
- * Generate an express API route handler
1088
- * @author Gabe Abrams
1089
- * @param opts object containing all arguments
1090
- * @param opts.paramTypes map containing the types for each parameter that is
1091
- * included in the request (map: param name => type)
1092
- * @param opts.handler function that processes the request
1093
- * @param [opts.skipSessionCheck] if true, skip the session check (allow users
1094
- * to not be logged in and launched via LTI)
1095
- * @param [opts.allowedHosts] if included, only allow requests from these hosts
1096
- * (start a hostname with a "*" to only check the end of the hostname)
1097
- * you can include just one string instead of an array
1098
- * @param [opts.bannedHosts] if included, do not allow requests from these hosts
1099
- * (start a hostname with a "*" to only check the end of the hostname)
1100
- * you can include just one string instead of an array
1101
- * @param [opts.unhandledErrorMessagePrefix] if included, when an error that
1102
- * is not of type ErrorWithCode is thrown, the client will receive an error
1103
- * where the error message is prefixed with this string. For example,
1104
- * if unhandledErrorMessagePrefix is
1105
- * 'While saving progress, we encountered an error:'
1106
- * and the error is 'progressInfo is not an object',
1107
- * the client will receive an error with the message
1108
- * 'While saving progress, we encountered an error: progressInfo is not an object'
1109
- * @returns express route handler that takes the following arguments:
1110
- * params (map: param name => value),
1111
- * req (express request object),
1112
- * next (express next function),
1113
- * send (a function that sends a string to the client),
1114
- * redirect (takes a url and redirects the user to that url),
1115
- * renderErrorPage (shows a static error page to the user),
1116
- * renderInfoPage (shows a static info page to the user),
1117
- * renderCustomHTML (renders custom html and sends it to the user),
1118
- * and returns the value to send to the client as a JSON API response, or
1119
- * calls next() or redirect(...) or send(...) or renderErrorPage(...).
1120
- * Note: params also has userId, userFirstName,
1121
- * userLastName, userEmail, userAvatarURL, isLearner, isTTM, isAdmin,
1122
- * and any other variables that
1123
- * are directly added to the session, if the user does have a session.
1124
- */
1125
- declare const genRouteHandler: (opts: {
1126
- paramTypes?: {
1127
- [k: string]: ParamType;
1128
- } | undefined;
1129
- handler: (opts: {
1130
- params: {
1131
- [k: string]: any;
1132
- };
1133
- req: any;
1134
- next: () => void;
1135
- redirect: (pathOrURL: string) => void;
1136
- send: (text: string, status?: number) => void;
1137
- renderErrorPage: (opts?: {
1138
- title?: string;
1139
- description?: string;
1140
- code?: string;
1141
- pageTitle?: string;
1142
- status?: number;
1143
- }) => void;
1144
- renderInfoPage: (opts: {
1145
- title: string;
1146
- body: string;
1147
- }) => void;
1148
- renderCustomHTML: (opts: {
1149
- html: string;
1150
- status?: number;
1151
- }) => void;
1152
- logServerEvent: LogFunction;
1153
- }) => any;
1154
- skipSessionCheck?: boolean | undefined;
1155
- allowedHosts?: string | string[] | undefined;
1156
- bannedHosts?: string | string[] | undefined;
1157
- unhandledErrorMessagePrefix?: string | undefined;
1158
- }) => (req: any, res: any, next: () => void) => Promise<undefined>;
1159
-
1160
- /**
1161
- * Handle an error and respond to the client
1162
- * @author Gabe Abrams
1163
- * @param res express response
1164
- * @param error error info
1165
- * @param opts.err the error to send to the client
1166
- * or the error message
1167
- * @param [opts.code] an error code (only used if err.code is not
1168
- * included)
1169
- * @param [opts.status=500] the https status code to use
1170
- * defined)
1171
- */
1172
- declare const handleError: (res: any, error: ({
1173
- message: any;
1174
- code?: string;
1175
- status?: number;
1176
- } | Error | string | any)) => undefined;
1177
-
1178
- /**
1179
- * Send successful API response
1180
- * @author Gabe Abrams
1181
- * @param res express response
1182
- * @param body the body of the response to send to the client
1183
- */
1184
- declare const handleSuccess: (res: any, body: any) => undefined;
1185
-
1186
- type GetLaunchInfoFunction = (req: any) => {
1187
- launched: boolean;
1188
- launchInfo?: any;
1189
- };
1190
- /**
1191
- * Prepare dce-reactkit to run on the server
1192
- * @author Gabe Abrams
1193
- * @param opts object containing all arguments
1194
- * @param opts.app express app from inside of the postprocessor function that
1195
- * we will add routes to
1196
- * @param opts.getLaunchInfo CACCL LTI's get launch info function
1197
- * @param [opts.logCollection] mongo collection from dce-mango to use for
1198
- * storing logs. If none is included, logs are written to the console
1199
- * @param [opts.logReviewAdmins=all] info on which admins can review
1200
- * logs from the client. If not included, all Canvas admins are allowed to
1201
- * review logs. If null, no Canvas admins are allowed to review logs.
1202
- * If an array of Canvas userIds (numbers), only Canvas admins with those
1203
- * userIds are allowed to review logs. If a dce-mango collection, only
1204
- * Canvas admins with entries in that collection ({ userId, ...}) are allowed
1205
- * to review logs
1206
- */
1207
- declare const initServer: (opts: {
1208
- app: any;
1209
- getLaunchInfo: GetLaunchInfoFunction;
1210
- logCollection?: any;
1211
- logReviewAdmins?: (number[] | any);
1212
- }) => void;
1213
-
1214
- /**
1215
- * Get a number's ordinal
1216
- * @author Gabe Abrams
1217
- * @param num the number being analyzed
1218
- * @returns ordinal
1219
- */
1220
- declare const getOrdinal: (num: number) => string;
1221
-
1222
- /**
1223
- * Get current time info in US Boston Eastern Time, independent of machine
1224
- * timezone
1225
- * @author Gabe Abrams
1226
- * @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
1227
- * @returns object with timestamp (ms since epoch) and numbers
1228
- * corresponding to ET time values for year, month, day, hour, hour12, minute, isPM
1229
- * where hour is in 24hr time and hour12 is in 12hr time.
1230
- */
1231
- declare const getTimeInfoInET: (dateOrTimestamp?: Date | number) => {
1232
- timestamp: number;
1233
- year: number;
1234
- month: number;
1235
- day: number;
1236
- hour: number;
1237
- hour12: number;
1238
- minute: number;
1239
- isPM: boolean;
1240
- };
1241
-
1242
- /**
1243
- * Stub a server endpoint response
1244
- * @author Gabe Abrams
1245
- * @param opts object containing all arguments
1246
- * @param [opts.method=GET] http method to stub
1247
- * @param opts.path full pathname to stub
1248
- * @param opts.body body of response if stubbing a successful response
1249
- * @param opts.errorMessage message of error if stubbing a failed response
1250
- * @param [opts.errorCode] error code if stubbing a failed response
1251
- */
1252
- declare const stubServerEndpoint: (opts: {
1253
- method?: string | undefined;
1254
- path: string;
1255
- body?: any;
1256
- errorMessage?: string | undefined;
1257
- errorCode?: string | undefined;
1258
- }) => void;
1259
-
1260
- /**
1261
- * Start a dynamic wait, call the function once the operation has completed and
1262
- * the dynamic wait will continue waiting for the rest of the minimum time
1263
- * @author Gabe Abrams
1264
- * @param minWaitMs the minimum number of ms to wait
1265
- * @returns async function to call to finish the wait
1266
- */
1267
- declare const startMinWait: (minWaitMs: number) => () => Promise<void>;
1268
-
1269
- /**
1270
- * Get a human-readable description of a date (all in ET)
1271
- * @author Gabe Abrams
1272
- * @param [dateOrTimestamp=today] the date or timestamp for the date to describe
1273
- * @returns human-readable description of the date
1274
- */
1275
- declare const getHumanReadableDate: (dateOrTimestamp?: Date | number) => string;
1276
-
1277
- /**
1278
- * Get the current part of day (morning, evening, etc.)
1279
- * @author Gabe Abrams
1280
- * @returns the part of day (morning, evening, etc.)
1281
- */
1282
- declare const getPartOfDay: () => string;
1283
-
1284
- /**
1285
- * Create a human readable list from an array of strings.
1286
- * For example, ['apple', 'orange'] becomes "apple and orange"
1287
- * and ['apple', 'orange', 'mango'] becomes "apple, orange, and mango"
1288
- * @author Gabe Abrams
1289
- * @param items list of items in the list
1290
- * @returns human-readable list
1291
- */
1292
- declare const stringsToHumanReadableList: (items: string[]) => string;
1293
-
1294
- /**
1295
- * Given a string, only keep the letters inside it
1296
- * @author Gabe Abrams
1297
- * @param str the string to parse
1298
- * @returns only the letters inside of the string
1299
- */
1300
- declare const onlyKeepLetters: (str: string) => string;
1301
-
1302
- /**
1303
- * Run tasks in parallel with a limit on how many tasks can execute at once.
1304
- * No guarantees are made about the order of task execution
1305
- * @author Gabe Abrams
1306
- * @param taskFunctions functions that start asynchronous tasks and optionally
1307
- * resolve with values
1308
- * @param [limit=no limit] maximum number of asynchronous tasks to permit to run at
1309
- * once
1310
- * @returns array of resolved values in the same order as the task functions
1311
- */
1312
- declare const parallelLimit: (taskFunctions: (() => Promise<any>)[], limit?: number) => Promise<any[]>;
1313
-
1314
1227
  type MetadataPopulator = () => {
1315
1228
  [k: string]: any;
1316
1229
  } | Promise<{
@@ -1331,14 +1244,6 @@ declare const setClientEventMetadataPopulator: (newMetadataPopulator: MetadataPo
1331
1244
  */
1332
1245
  declare const logClientEvent: LogFunction;
1333
1246
 
1334
- /**
1335
- * Initialize a log collection given the dce-mango Collection class
1336
- * @author Gabe Abrams
1337
- * @param Collection the Collection class from dce-mango
1338
- * @returns initialized logCollection
1339
- */
1340
- declare const initLogCollection: (Collection: any) => any;
1341
-
1342
1247
  /**
1343
1248
  * Get the name of a month given the month number (1 = January, etc.)
1344
1249
  * If an invalid number is provided, we will treat it like January
@@ -1425,46 +1330,6 @@ declare const getLocalTimeInfo: (dateOrTimestamp?: Date | number) => {
1425
1330
  isPM: boolean;
1426
1331
  };
1427
1332
 
1428
- /**
1429
- * Interface for a collection in the database
1430
- * @author Yuen Ler Chow
1431
- */
1432
- type DCEMangoCollection = {
1433
- /**
1434
- * Find all items in the collection that match the filter query
1435
- * @param filterQuery query for the filter
1436
- * @returns list of items that match the filter query
1437
- */
1438
- find: (filterQuery: any) => Promise<any[]>;
1439
- /**
1440
- * Insert an item into the collection
1441
- * @param item the item to insert
1442
- */
1443
- insert: (item: any) => Promise<void>;
1444
- /**
1445
- * Delete an item in the collection
1446
- * @param id the id of the item to delete
1447
- */
1448
- delete: (filterQuery: {
1449
- id: string;
1450
- }) => Promise<void>;
1451
- };
1452
- /**
1453
- * Add all routes for the DBEditor
1454
- * @author Yuen Ler Chow
1455
- * @param opts object containing all arguments
1456
- * @param opts.app express app to add routes too
1457
- * @param opts.collectionName the name of the collection
1458
- * @param opts.adminsOnly true if the endpoint is for admins only
1459
- * @param opts.collection dce-mango db collection
1460
- */
1461
- declare const addDBEditorEndpoints: (opts: {
1462
- app: express.Application;
1463
- collectionName: string;
1464
- adminsOnly: boolean;
1465
- collection: DCEMangoCollection;
1466
- }) => void;
1467
-
1468
1333
  /**
1469
1334
  * Given an array of strings, create a single comma-separated string that includes
1470
1335
  * 'and' as well as an oxford comma.
@@ -1659,30 +1524,6 @@ declare const capitalize: (str: string) => string;
1659
1524
  */
1660
1525
  declare const shuffleArray: <T>(arr: T[]) => T[];
1661
1526
 
1662
- /**
1663
- * Send a server-to-server request from this sever to another server that uses
1664
- * dce-reactkit [for server only]
1665
- * @author Gabe Abrams
1666
- * @param opts object containing all arguments
1667
- * @param opts.host - the host of the other server
1668
- * @param opts.path - the path of the other server's endpoint
1669
- * @param [opts.method=GET] - the method of the endpoint
1670
- * @param [opts.params] - query/body parameters to include
1671
- * @param [opts.headers] - headers to include
1672
- * @returns response from server
1673
- */
1674
- declare const visitEndpointOnAnotherServer: (opts: {
1675
- host: string;
1676
- path: string;
1677
- method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
1678
- params?: {
1679
- [x: string]: any;
1680
- } | undefined;
1681
- headers?: {
1682
- [x: string]: any;
1683
- } | undefined;
1684
- }) => Promise<any>;
1685
-
1686
1527
  /**
1687
1528
  * Get number of words in string
1688
1529
  * @author Gardenia Liu
@@ -1693,31 +1534,6 @@ declare const visitEndpointOnAnotherServer: (opts: {
1693
1534
  */
1694
1535
  declare const getWordCount: (text: string) => number;
1695
1536
 
1696
- /**
1697
- * List of error codes built into the react kit
1698
- * @author Gabe Abrams
1699
- */
1700
- declare enum ReactKitErrorCode {
1701
- NoResponse = "DRK1",
1702
- NoCode = "DRK2",
1703
- SessionExpired = "DRK3",
1704
- MissingParameter = "DRK4",
1705
- InvalidParameter = "DRK5",
1706
- HostNotAllowed = "DRK17",
1707
- HostBanned = "DRK18",
1708
- WrongCourse = "DRK6",
1709
- NoCACCLSendRequestFunction = "DRK7",
1710
- NoCACCLGetLaunchInfoFunction = "DRK8",
1711
- NotTTM = "DRK9",
1712
- NotAdmin = "DRK10",
1713
- NotAllowedToReviewLogs = "DRK11",
1714
- ThemeCheckedBeforeReactKitReady = "DRK12",
1715
- SessionExpiredMessageGottenBeforeReactKitReady = "DRK13",
1716
- NotConnected = "DRK14",
1717
- SelfSigned = "DRK15",
1718
- ResponseParseError = "DRK16"
1719
- }
1720
-
1721
1537
  /**
1722
1538
  * Days of the week
1723
1539
  * @author Gabe Abrams
@@ -1748,4 +1564,17 @@ declare const LogBuiltInMetadata: {
1748
1564
  };
1749
1565
  };
1750
1566
 
1751
- export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, Dropdown, DropdownItemType, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, getWordCount, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, prompt, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitEndpointOnAnotherServer, visitServerEndpoint, waitMs };
1567
+ /**
1568
+ * List of error codes built into the react kit
1569
+ * @author Gabe Abrams
1570
+ */
1571
+ declare enum ReactKitErrorCode {
1572
+ NoResponse = "DRK1",
1573
+ NoCode = "DRK2",
1574
+ SessionExpired = "DRK3",
1575
+ NoCACCLSendRequestFunction = "DRK7",
1576
+ SimpleDateChooserInvalidDateRange = "DRK35",
1577
+ SimpleDateChooserInvalidNumMonths = "DRK36"
1578
+ }
1579
+
1580
+ export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, Dropdown, DropdownItemType, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_REVIEW_STATUS_ROUTE, LOG_ROUTE_PATH, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogLevel, LogMainInfo, LogMetadataType, LogReviewer, LogSource, LogSourceSpecificInfo, LogType, LogTypeSpecificInfo, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, SimpleTimeChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, getWordCount, idify, initClient, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, prompt, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };