dce-reactkit 3.5.1-beta.1 → 3.5.3

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 (191) hide show
  1. package/.eslintrc.js +0 -2
  2. package/dist/cjs/index.js +320 -27
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/types/client/initClient.d.ts +1 -1
  5. package/dist/cjs/types/components/AppWrapper.d.ts +6 -6
  6. package/dist/cjs/types/components/ButtonInputGroup.d.ts +1 -1
  7. package/dist/cjs/types/components/CSVDownloadButton.d.ts +1 -1
  8. package/dist/cjs/types/components/CheckboxButton.d.ts +1 -1
  9. package/dist/cjs/types/components/CopiableBox.d.ts +1 -1
  10. package/dist/cjs/types/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.d.ts +7 -1
  11. package/dist/cjs/types/components/DBEntryManagerPanel/AddOrEditDBEntry/index.d.ts +5 -4
  12. package/dist/cjs/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +1 -1
  13. package/dist/cjs/types/components/DBEntryManagerPanel/index.d.ts +13 -2
  14. package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntry.d.ts +1 -1
  15. package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntryField.d.ts +1 -1
  16. package/dist/cjs/types/components/Drawer.d.ts +1 -1
  17. package/dist/cjs/types/components/ErrorBox.d.ts +1 -1
  18. package/dist/cjs/types/components/IntelliTable.d.ts +1 -1
  19. package/dist/cjs/types/components/ItemPicker/NestableItemList.d.ts +1 -1
  20. package/dist/cjs/types/components/ItemPicker/index.d.ts +1 -1
  21. package/dist/cjs/types/components/ItemPicker/types/PickableItem.d.ts +1 -1
  22. package/dist/cjs/types/components/LogReviewer.d.ts +1 -1
  23. package/dist/cjs/types/components/Modal.d.ts +1 -1
  24. package/dist/cjs/types/components/PopFailureMark.d.ts +1 -1
  25. package/dist/cjs/types/components/PopPendingMark.d.ts +1 -1
  26. package/dist/cjs/types/components/PopSuccessMark.d.ts +1 -1
  27. package/dist/cjs/types/components/RadioButton.d.ts +1 -1
  28. package/dist/cjs/types/components/SimpleDateChooser.d.ts +1 -1
  29. package/dist/cjs/types/components/TabBox.d.ts +1 -1
  30. package/dist/cjs/types/helpers/abbreviate.test.d.ts +5 -0
  31. package/dist/cjs/types/helpers/addDBEditorEndpoints.d.ts +4 -3
  32. package/dist/cjs/types/helpers/avg.test.d.ts +5 -0
  33. package/dist/cjs/types/helpers/canReviewLogs.d.ts +5 -0
  34. package/dist/cjs/types/helpers/canReviewLogs.test.d.ts +5 -0
  35. package/dist/cjs/types/helpers/ceilToNumDecimals.test.d.ts +5 -0
  36. package/dist/cjs/types/helpers/compareArraysByProp.d.ts +3 -2
  37. package/dist/cjs/types/helpers/compareArraysByProp.test.d.ts +5 -0
  38. package/dist/cjs/types/helpers/extractProp.test.d.ts +5 -0
  39. package/dist/cjs/types/helpers/floorToNumDecimals.test.d.ts +5 -0
  40. package/dist/cjs/types/helpers/forceNumIntoBounds.test.d.ts +5 -0
  41. package/dist/cjs/types/helpers/genCSV.test.d.ts +5 -0
  42. package/dist/cjs/types/helpers/genCommaList.d.ts +12 -0
  43. package/dist/cjs/types/helpers/genCommaList.test.d.ts +1 -0
  44. package/dist/cjs/types/helpers/genRouteHandler.d.ts +7 -7
  45. package/dist/cjs/types/helpers/getHumanReadableDate.d.ts +1 -1
  46. package/dist/cjs/types/helpers/getHumanReadableDate.test.d.ts +5 -0
  47. package/dist/cjs/types/helpers/getLocalTimeInfo.d.ts +1 -1
  48. package/dist/cjs/types/helpers/getLocalTimeInfo.test.d.ts +6 -0
  49. package/dist/cjs/types/helpers/getMonthName.test.d.ts +5 -0
  50. package/dist/cjs/types/helpers/getOrdinal.test.d.ts +5 -0
  51. package/dist/cjs/types/helpers/getPartOfDay.test.d.ts +5 -0
  52. package/dist/cjs/types/helpers/getTimeInfoInET.d.ts +1 -1
  53. package/dist/cjs/types/helpers/getTimeInfoInET.test.d.ts +5 -0
  54. package/dist/cjs/types/helpers/parallelLimit.d.ts +1 -1
  55. package/dist/cjs/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +10 -0
  56. package/dist/cjs/types/helpers/validators/shared/helpers/validateRegex.d.ts +19 -0
  57. package/dist/cjs/types/helpers/validators/shared/types/ValidationResult.d.ts +12 -0
  58. package/dist/cjs/types/helpers/validators/validateEmail.d.ts +11 -0
  59. package/dist/cjs/types/helpers/validators/validateEmail.test.d.ts +1 -0
  60. package/dist/cjs/types/helpers/validators/validatePhoneNumber.d.ts +11 -0
  61. package/dist/cjs/types/helpers/validators/validatePhoneNumber.test.d.ts +1 -0
  62. package/dist/cjs/types/helpers/validators/validateString.d.ts +22 -0
  63. package/dist/cjs/types/helpers/validators/validateString.test.d.ts +1 -0
  64. package/dist/cjs/types/index.d.ts +5 -1
  65. package/dist/cjs/types/server/initServer.d.ts +1 -1
  66. package/dist/cjs/types/types/IntelliTableColumn.d.ts +1 -1
  67. package/dist/cjs/types/types/Log/LogMainInfo.d.ts +1 -1
  68. package/dist/cjs/types/types/Log/LogSourceSpecificInfo.d.ts +1 -1
  69. package/dist/cjs/types/types/Log/LogTypeSpecificInfo.d.ts +1 -1
  70. package/dist/cjs/types/types/Log/index.d.ts +1 -1
  71. package/dist/cjs/types/types/LogFunction.d.ts +1 -1
  72. package/dist/cjs/types/types/LogMetadataContextMap.d.ts +1 -1
  73. package/dist/cjs/types/types/LogMetadataTagMap.d.ts +1 -1
  74. package/dist/cjs/types/types/LogMetadataTargetMap.d.ts +1 -1
  75. package/dist/cjs/types/types/LogMetadataType.d.ts +1 -1
  76. package/dist/esm/index.js +317 -28
  77. package/dist/esm/index.js.map +1 -1
  78. package/dist/esm/types/client/initClient.d.ts +1 -1
  79. package/dist/esm/types/components/AppWrapper.d.ts +6 -6
  80. package/dist/esm/types/components/ButtonInputGroup.d.ts +1 -1
  81. package/dist/esm/types/components/CSVDownloadButton.d.ts +1 -1
  82. package/dist/esm/types/components/CheckboxButton.d.ts +1 -1
  83. package/dist/esm/types/components/CopiableBox.d.ts +1 -1
  84. package/dist/esm/types/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.d.ts +7 -1
  85. package/dist/esm/types/components/DBEntryManagerPanel/AddOrEditDBEntry/index.d.ts +5 -4
  86. package/dist/esm/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +1 -1
  87. package/dist/esm/types/components/DBEntryManagerPanel/index.d.ts +13 -2
  88. package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntry.d.ts +1 -1
  89. package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntryField.d.ts +1 -1
  90. package/dist/esm/types/components/Drawer.d.ts +1 -1
  91. package/dist/esm/types/components/ErrorBox.d.ts +1 -1
  92. package/dist/esm/types/components/IntelliTable.d.ts +1 -1
  93. package/dist/esm/types/components/ItemPicker/NestableItemList.d.ts +1 -1
  94. package/dist/esm/types/components/ItemPicker/index.d.ts +1 -1
  95. package/dist/esm/types/components/ItemPicker/types/PickableItem.d.ts +1 -1
  96. package/dist/esm/types/components/LogReviewer.d.ts +1 -1
  97. package/dist/esm/types/components/Modal.d.ts +1 -1
  98. package/dist/esm/types/components/PopFailureMark.d.ts +1 -1
  99. package/dist/esm/types/components/PopPendingMark.d.ts +1 -1
  100. package/dist/esm/types/components/PopSuccessMark.d.ts +1 -1
  101. package/dist/esm/types/components/RadioButton.d.ts +1 -1
  102. package/dist/esm/types/components/SimpleDateChooser.d.ts +1 -1
  103. package/dist/esm/types/components/TabBox.d.ts +1 -1
  104. package/dist/esm/types/helpers/abbreviate.test.d.ts +5 -0
  105. package/dist/esm/types/helpers/addDBEditorEndpoints.d.ts +4 -3
  106. package/dist/esm/types/helpers/avg.test.d.ts +5 -0
  107. package/dist/esm/types/helpers/canReviewLogs.d.ts +5 -0
  108. package/dist/esm/types/helpers/canReviewLogs.test.d.ts +5 -0
  109. package/dist/esm/types/helpers/ceilToNumDecimals.test.d.ts +5 -0
  110. package/dist/esm/types/helpers/compareArraysByProp.d.ts +3 -2
  111. package/dist/esm/types/helpers/compareArraysByProp.test.d.ts +5 -0
  112. package/dist/esm/types/helpers/extractProp.test.d.ts +5 -0
  113. package/dist/esm/types/helpers/floorToNumDecimals.test.d.ts +5 -0
  114. package/dist/esm/types/helpers/forceNumIntoBounds.test.d.ts +5 -0
  115. package/dist/esm/types/helpers/genCSV.test.d.ts +5 -0
  116. package/dist/esm/types/helpers/genCommaList.d.ts +12 -0
  117. package/dist/esm/types/helpers/genCommaList.test.d.ts +1 -0
  118. package/dist/esm/types/helpers/genRouteHandler.d.ts +7 -7
  119. package/dist/esm/types/helpers/getHumanReadableDate.d.ts +1 -1
  120. package/dist/esm/types/helpers/getHumanReadableDate.test.d.ts +5 -0
  121. package/dist/esm/types/helpers/getLocalTimeInfo.d.ts +1 -1
  122. package/dist/esm/types/helpers/getLocalTimeInfo.test.d.ts +6 -0
  123. package/dist/esm/types/helpers/getMonthName.test.d.ts +5 -0
  124. package/dist/esm/types/helpers/getOrdinal.test.d.ts +5 -0
  125. package/dist/esm/types/helpers/getPartOfDay.test.d.ts +5 -0
  126. package/dist/esm/types/helpers/getTimeInfoInET.d.ts +1 -1
  127. package/dist/esm/types/helpers/getTimeInfoInET.test.d.ts +5 -0
  128. package/dist/esm/types/helpers/parallelLimit.d.ts +1 -1
  129. package/dist/esm/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +10 -0
  130. package/dist/esm/types/helpers/validators/shared/helpers/validateRegex.d.ts +19 -0
  131. package/dist/esm/types/helpers/validators/shared/types/ValidationResult.d.ts +12 -0
  132. package/dist/esm/types/helpers/validators/validateEmail.d.ts +11 -0
  133. package/dist/esm/types/helpers/validators/validateEmail.test.d.ts +1 -0
  134. package/dist/esm/types/helpers/validators/validatePhoneNumber.d.ts +11 -0
  135. package/dist/esm/types/helpers/validators/validatePhoneNumber.test.d.ts +1 -0
  136. package/dist/esm/types/helpers/validators/validateString.d.ts +22 -0
  137. package/dist/esm/types/helpers/validators/validateString.test.d.ts +1 -0
  138. package/dist/esm/types/index.d.ts +5 -1
  139. package/dist/esm/types/server/initServer.d.ts +1 -1
  140. package/dist/esm/types/types/IntelliTableColumn.d.ts +1 -1
  141. package/dist/esm/types/types/Log/LogMainInfo.d.ts +1 -1
  142. package/dist/esm/types/types/Log/LogSourceSpecificInfo.d.ts +1 -1
  143. package/dist/esm/types/types/Log/LogTypeSpecificInfo.d.ts +1 -1
  144. package/dist/esm/types/types/Log/index.d.ts +1 -1
  145. package/dist/esm/types/types/LogFunction.d.ts +1 -1
  146. package/dist/esm/types/types/LogMetadataContextMap.d.ts +1 -1
  147. package/dist/esm/types/types/LogMetadataTagMap.d.ts +1 -1
  148. package/dist/esm/types/types/LogMetadataTargetMap.d.ts +1 -1
  149. package/dist/esm/types/types/LogMetadataType.d.ts +1 -1
  150. package/dist/index.d.ts +134 -56
  151. package/package.json +14 -13
  152. package/src/components/ItemPicker/index.test.tsx +10 -10
  153. package/src/helpers/abbreviate.test.ts +26 -0
  154. package/src/helpers/avg.test.ts +24 -0
  155. package/src/helpers/canReviewLogs.test.ts +67 -0
  156. package/src/helpers/canReviewLogs.ts +20 -0
  157. package/src/helpers/ceilToNumDecimals.test.ts +39 -0
  158. package/src/helpers/compareArraysByProp.test.ts +147 -0
  159. package/src/helpers/compareArraysByProp.ts +41 -22
  160. package/src/helpers/extractProp.test.ts +34 -0
  161. package/src/helpers/floorToNumDecimals.test.ts +39 -0
  162. package/src/helpers/forceNumIntoBounds.test.ts +34 -0
  163. package/src/helpers/genCSV.test.ts +61 -0
  164. package/src/helpers/genCSV.ts +5 -2
  165. package/src/helpers/genCommaList.test.ts +57 -0
  166. package/src/helpers/genCommaList.ts +21 -0
  167. package/src/helpers/getHumanReadableDate.test.ts +29 -0
  168. package/src/helpers/getLocalTimeInfo.test.ts +48 -0
  169. package/src/helpers/getMonthName.test.ts +79 -0
  170. package/src/helpers/getOrdinal.test.ts +84 -0
  171. package/src/helpers/{getOrdinal.tsx → getOrdinal.ts} +1 -0
  172. package/src/helpers/getPartOfDay.test.ts +56 -0
  173. package/src/helpers/getTimeInfoInET.test.ts +72 -0
  174. package/src/helpers/validators/shared/constants/ERROR_MESSAGES.ts +18 -0
  175. package/src/helpers/validators/shared/helpers/validateRegex.ts +47 -0
  176. package/src/helpers/validators/shared/types/ValidationResult.ts +20 -0
  177. package/src/helpers/validators/validateEmail.test.ts +110 -0
  178. package/src/helpers/validators/validateEmail.ts +47 -0
  179. package/src/helpers/validators/validatePhoneNumber.test.ts +94 -0
  180. package/src/helpers/validators/validatePhoneNumber.ts +49 -0
  181. package/src/helpers/validators/validateString.test.ts +173 -0
  182. package/src/helpers/validators/validateString.ts +171 -0
  183. package/src/index.ts +8 -0
  184. package/tsconfig.json +6 -2
  185. /package/src/helpers/{abbreviate.tsx → abbreviate.ts} +0 -0
  186. /package/src/helpers/{avg.tsx → avg.ts} +0 -0
  187. /package/src/helpers/{ceilToNumDecimals.tsx → ceilToNumDecimals.ts} +0 -0
  188. /package/src/helpers/{floorToNumDecimals.tsx → floorToNumDecimals.ts} +0 -0
  189. /package/src/helpers/{forceNumIntoBounds.tsx → forceNumIntoBounds.ts} +0 -0
  190. /package/src/helpers/{getLocalTimeInfo.tsx → getLocalTimeInfo.ts} +0 -0
  191. /package/src/helpers/{getTimeInfoInET.tsx → getTimeInfoInET.ts} +0 -0
@@ -2,7 +2,7 @@
2
2
  * Type of CACCL's send request function
3
3
  * @author Gabe Abrams
4
4
  */
5
- declare type SendRequestFunction = (opts: {
5
+ type SendRequestFunction = (opts: {
6
6
  path: string;
7
7
  method: ('GET' | 'POST' | 'DELETE' | 'PUT');
8
8
  params?: {
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import React from 'react';
7
7
  import Variant from '../types/Variant';
8
- declare type Props = {
8
+ type Props = {
9
9
  children: React.ReactNode;
10
10
  dark?: boolean;
11
11
  };
@@ -32,11 +32,11 @@ export declare const alert: (title: string, text: string) => Promise<undefined>;
32
32
  * @returns true if the user confirmed
33
33
  */
34
34
  export declare const confirm: (title: string, text: string, opts?: {
35
- confirmButtonText?: string | undefined;
36
- confirmButtonVariant?: Variant | undefined;
37
- cancelButtonText?: string | undefined;
38
- cancelButtonVariant?: Variant | undefined;
39
- } | undefined) => Promise<boolean>;
35
+ confirmButtonText?: string;
36
+ confirmButtonVariant?: Variant;
37
+ cancelButtonText?: string;
38
+ cancelButtonVariant?: Variant;
39
+ }) => Promise<boolean>;
40
40
  /**
41
41
  * Show a fatal error message
42
42
  * @author Gabe Abrams
@@ -3,7 +3,7 @@
3
3
  * @author Gabe Abrams
4
4
  */
5
5
  import React from 'react';
6
- declare type Props = {
6
+ type Props = {
7
7
  label: string;
8
8
  minLabelWidth?: string;
9
9
  children: React.ReactNode;
@@ -3,7 +3,7 @@
3
3
  * @author Gabe Abrams
4
4
  */
5
5
  import React from 'react';
6
- declare type Props = {
6
+ type Props = {
7
7
  filename: string;
8
8
  csv: string;
9
9
  id?: string;
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import Variant from '../types/Variant';
7
- declare type Props = {
7
+ type Props = {
8
8
  text: string;
9
9
  onChanged: (checked: boolean) => void;
10
10
  ariaLabel: string;
@@ -3,7 +3,7 @@
3
3
  * @author Gabe Abrams
4
4
  */
5
5
  import React from 'react';
6
- declare type Props = {
6
+ type Props = {
7
7
  text: string;
8
8
  maxTextWidthRem?: number;
9
9
  label?: string;
@@ -1,6 +1,12 @@
1
+ /**
2
+ * Multiselect component that allows the user to type in values and add them to
3
+ * the multiselect component
4
+ * @author Yuen Ler Chow
5
+ * @author Gabe Abrams
6
+ */
1
7
  import React from 'react';
2
8
  import DBEntryFieldType from '../types/DBEntryFieldType';
3
- declare type Props = {
9
+ type Props = {
4
10
  type: DBEntryFieldType.StringArray | DBEntryFieldType.NumberArray;
5
11
  values: string[] | number[];
6
12
  onChange: (values: string[] | number[]) => void;
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * Panel for adding a DBEntry to the database
3
3
  * @author Yuen Ler Chow
4
+ * @author Gabe Abrams
4
5
  */
5
6
  import React from 'react';
6
7
  import DBEntry from '../types/DBEntry';
7
8
  import DBEntryField from '../types/DBEntryField';
8
- declare type Props = {
9
+ type Props = {
9
10
  /**
10
11
  * Handler for when the user finishes adding the DBEntry
11
12
  * (if no DBEntry is returned, process was cancelled)
@@ -14,15 +15,15 @@ declare type Props = {
14
15
  onFinished: (dbEntry?: DBEntry) => void;
15
16
  /**
16
17
  * Function to validate the DBEntry before saving
17
- * @param dbEntry
18
+ * @param dbEntry the DBEntry to validate
18
19
  */
19
20
  validateEntry?: (dbEntry: DBEntry) => Promise<void>;
20
21
  /**
21
22
  * Function to modify the DBEntry before saving
22
- * @param dbEntry
23
+ * @param dbEntry the DBEntry to modify
23
24
  * @returns the modified DBEntry
24
25
  */
25
- modifyEntry?: (dbEntry: DBEntry) => DBEntry;
26
+ modifyEntry?: (dbEntry: DBEntry) => Promise<DBEntry> | DBEntry;
26
27
  entryFields: DBEntryField[];
27
28
  dbEntryToEdit?: DBEntry;
28
29
  idPropName: string;
@@ -5,5 +5,5 @@
5
5
  * @param [adminsOnly] true if the endpoint is for admins only
6
6
  * @returns the endpoint path
7
7
  */
8
- declare const generateEndpointPath: (collectionName: string, adminsOnly?: boolean | undefined) => string;
8
+ declare const generateEndpointPath: (collectionName: string, adminsOnly?: boolean) => string;
9
9
  export default generateEndpointPath;
@@ -1,19 +1,30 @@
1
1
  /**
2
2
  * DB Entry Manager Panel
3
3
  * @author Yuen Ler Chow
4
+ * @author Gabe Abrams
4
5
  */
5
6
  import React from 'react';
6
7
  import DBEntry from './types/DBEntry';
7
8
  import DBEntryField from './types/DBEntryField';
8
- declare type Props = {
9
+ type Props = {
9
10
  entryFields: DBEntryField[];
10
11
  idPropName: string;
11
12
  titlePropName: string;
12
13
  descriptionPropName: string;
13
14
  itemListTitle: string;
14
15
  itemName: string;
16
+ /**
17
+ * Function to validate the db entry before sending to the server
18
+ * (throws an error if not validate)
19
+ * @param dbEntry the db entry to validate
20
+ */
15
21
  validateEntry?: (dbEntry: DBEntry) => Promise<void>;
16
- modifyEntry?: (dbEntry: DBEntry) => Promise<DBEntry>;
22
+ /**
23
+ * Function to modify the db entry before sending to the server
24
+ * @param dbEntry the db entry to modify
25
+ * @returns the modified db entry
26
+ */
27
+ modifyEntry?: (dbEntry: DBEntry) => Promise<DBEntry> | DBEntry;
17
28
  disableEdit?: boolean;
18
29
  collectionName: string;
19
30
  adminsOnly?: boolean;
@@ -2,7 +2,7 @@
2
2
  * Generic type for an object
3
3
  * @author Yuen Ler Chow
4
4
  */
5
- declare type DBEntry = {
5
+ type DBEntry = {
6
6
  [k: string]: any;
7
7
  };
8
8
  export default DBEntry;
@@ -3,7 +3,7 @@ import DBEntryFieldType from './DBEntryFieldType';
3
3
  * A database entry input field
4
4
  * @author Yuen Ler Chow
5
5
  */
6
- declare type DBEntryField = ({
6
+ type DBEntryField = ({
7
7
  label: string;
8
8
  objectKey: string;
9
9
  placeholder: string;
@@ -3,7 +3,7 @@
3
3
  * @author Gabe Abrams
4
4
  */
5
5
  import React from 'react';
6
- declare type Props = {
6
+ type Props = {
7
7
  customBackgroundColor?: string;
8
8
  children: React.ReactNode;
9
9
  };
@@ -3,7 +3,7 @@
3
3
  * @author Gabe Abrams
4
4
  */
5
5
  import React from 'react';
6
- declare type Props = {
6
+ type Props = {
7
7
  error: any;
8
8
  title?: string;
9
9
  onClose?: () => void;
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import IntelliTableColumn from '../types/IntelliTableColumn';
7
- declare type Props = {
7
+ type Props = {
8
8
  title: string;
9
9
  id: string;
10
10
  data: {
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import React from 'react';
7
7
  import PickableItem from './types/PickableItem';
8
- declare type Props = {
8
+ type Props = {
9
9
  items: PickableItem[];
10
10
  /**
11
11
  * Handler to call when item selection is changed
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import PickableItem from './types/PickableItem';
7
- declare type Props = {
7
+ type Props = {
8
8
  title: string;
9
9
  items: PickableItem[];
10
10
  /**
@@ -2,7 +2,7 @@
2
2
  * An item that can be chosen (for use within ItemPicker)
3
3
  * @author Gabe Abrams
4
4
  */
5
- declare type PickableItem = ({
5
+ type PickableItem = ({
6
6
  id: number | string;
7
7
  name: string;
8
8
  link?: string;
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import React from 'react';
7
7
  import LogMetadataType from '../types/LogMetadataType';
8
- declare type Props = {
8
+ type Props = {
9
9
  LogMetadata: LogMetadataType;
10
10
  onClose: () => void;
11
11
  };
@@ -7,7 +7,7 @@ import Variant from '../types/Variant';
7
7
  import ModalButtonType from '../types/ModalButtonType';
8
8
  import ModalSize from '../types/ModalSize';
9
9
  import ModalType from '../types/ModalType';
10
- declare type Props = {
10
+ type Props = {
11
11
  type?: ModalType;
12
12
  size?: ModalSize;
13
13
  title?: React.ReactNode;
@@ -3,7 +3,7 @@
3
3
  * @author Gabe Abrams
4
4
  */
5
5
  import React from 'react';
6
- declare type Props = {
6
+ type Props = {
7
7
  sizeRem?: number;
8
8
  circleVariant?: string;
9
9
  xVariant?: string;
@@ -3,7 +3,7 @@
3
3
  * @author Gabe Abrams
4
4
  */
5
5
  import React from 'react';
6
- declare type Props = {
6
+ type Props = {
7
7
  sizeRem?: number;
8
8
  circleVariant?: string;
9
9
  hourglassVariant?: string;
@@ -3,7 +3,7 @@
3
3
  * @author Gabe Abrams
4
4
  */
5
5
  import React from 'react';
6
- declare type Props = {
6
+ type Props = {
7
7
  sizeRem?: number;
8
8
  circleVariant?: string;
9
9
  checkVariant?: string;
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import Variant from '../types/Variant';
7
- declare type Props = {
7
+ type Props = {
8
8
  text: string;
9
9
  onSelected: () => void;
10
10
  ariaLabel: string;
@@ -3,7 +3,7 @@
3
3
  * @author Gabe Abrams
4
4
  */
5
5
  import React from 'react';
6
- declare type Props = {
6
+ type Props = {
7
7
  ariaLabel: string;
8
8
  name: string;
9
9
  month: number;
@@ -3,7 +3,7 @@
3
3
  * @author Gabe Abrams
4
4
  */
5
5
  import React from 'react';
6
- declare type Props = {
6
+ type Props = {
7
7
  title: React.ReactNode;
8
8
  children: React.ReactNode;
9
9
  noBottomMargin?: boolean;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Unit tests for abbreviate helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -3,7 +3,7 @@ import express from 'express';
3
3
  * Interface for a collection in the database
4
4
  * @author Yuen Ler Chow
5
5
  */
6
- interface Collection {
6
+ type DCEMangoCollection = {
7
7
  /**
8
8
  * Find all items in the collection that match the filter query
9
9
  * @param filterQuery
@@ -22,7 +22,7 @@ interface Collection {
22
22
  delete: (filterQuery: {
23
23
  id: string;
24
24
  }) => Promise<void>;
25
- }
25
+ };
26
26
  /**
27
27
  * Add all routes for the DBEditor
28
28
  * @author Yuen Ler Chow
@@ -30,11 +30,12 @@ interface Collection {
30
30
  * @param opts.app express app to add routes too
31
31
  * @param opts.collectionName the name of the collection
32
32
  * @param opts.adminsOnly true if the endpoint is for admins only
33
+ * @param opts.collection dce-mango db collection
33
34
  */
34
35
  declare const addDBEditorEndpoints: (opts: {
35
36
  app: express.Application;
36
37
  collectionName: string;
37
38
  adminsOnly: boolean;
38
- collection: Collection;
39
+ collection: DCEMangoCollection;
39
40
  }) => void;
40
41
  export default addDBEditorEndpoints;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Unit tests for avg helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Reset the cached version of canReview
3
+ * @author Gabe Abrams
4
+ */
5
+ export declare const resetCanReviewCache: () => void;
1
6
  /**
2
7
  * Check if the current user can review logs
3
8
  * @author Gabe Abrams
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Unit tests for canReviewLogs
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test file for the ceilToNumDecimals helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -4,9 +4,10 @@
4
4
  * @author Gabe Abrams
5
5
  * @param a the first array
6
6
  * @param b the second array
7
- * @param prop the property to compare with
7
+ * @param prop the property to compare with, or an array of props to compare
8
+ * with (if array, all values associated with those props must match)
8
9
  * @returns true if the arrays contain the same objects as determined by
9
10
  * the values associated with each object's prop
10
11
  */
11
- declare const compareArraysByProp: (a: any[], b: any[], prop: string) => boolean;
12
+ declare const compareArraysByProp: (a: any[], b: any[], prop: string | string[]) => boolean;
12
13
  export default compareArraysByProp;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test file for the compareArraysByProp helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test file for the extractProp helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test file for the floorToNumDecimals helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test file for the forceNumIntoBounds helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test file for the genCSV helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Given an array of strings, create a single comma-separated string that includes
3
+ * 'and' as well as an oxford comma.
4
+ * Ex: ['apples'] => 'apples'
5
+ * Ex: ['apples', 'bananas'] => 'apples and bananas'
6
+ * Ex: ['apples', 'bananas', 'grapes'] => 'apples, bananas, and grapes'
7
+ * @author Austen Money
8
+ * @param list an array of elements to be made into a single comma-separated string.
9
+ * @returns a comma-separated string.
10
+ */
11
+ declare const genCommaList: (list: string[]) => string;
12
+ export default genCommaList;
@@ -0,0 +1 @@
1
+ export {};
@@ -33,14 +33,14 @@ declare const genRouteHandler: (opts: {
33
33
  req: any;
34
34
  next: () => void;
35
35
  redirect: (pathOrURL: string) => void;
36
- send: (text: string, status?: number | undefined) => void;
36
+ send: (text: string, status?: number) => void;
37
37
  renderErrorPage: (opts?: {
38
- title?: string | undefined;
39
- description?: string | undefined;
40
- code?: string | undefined;
41
- pageTitle?: string | undefined;
42
- status?: number | undefined;
43
- } | undefined) => void;
38
+ title?: string;
39
+ description?: string;
40
+ code?: string;
41
+ pageTitle?: string;
42
+ status?: number;
43
+ }) => void;
44
44
  logServerEvent: LogFunction;
45
45
  }) => any;
46
46
  skipSessionCheck?: boolean | undefined;
@@ -4,5 +4,5 @@
4
4
  * @param [dateOrTimestamp=today] the date or timestamp for the date to describe
5
5
  * @returns human-readable description of the date
6
6
  */
7
- declare const getHumanReadableDate: (dateOrTimestamp?: number | Date | undefined) => string;
7
+ declare const getHumanReadableDate: (dateOrTimestamp?: Date | number) => string;
8
8
  export default getHumanReadableDate;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test file for the getHumanReadableDate helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -6,7 +6,7 @@
6
6
  * corresponding to time values for year, month, day, hour, hour12, minute, isPM
7
7
  * where hour is in 24hr time and hour12 is in 12hr time.
8
8
  */
9
- declare const getLocalTimeInfo: (dateOrTimestamp?: number | Date | undefined) => {
9
+ declare const getLocalTimeInfo: (dateOrTimestamp?: Date | number) => {
10
10
  timestamp: number;
11
11
  year: number;
12
12
  month: number;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Test for getLocalTimeInfo helper function
3
+ * NOTE: only works if this test is run on a machine in ET
4
+ * @author Gabe Abrams
5
+ */
6
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test for getMonthName helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test file for the getOrdinal helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test file for the getPartOfDay helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -7,7 +7,7 @@
7
7
  * corresponding to ET time values for year, month, day, hour, hour12, minute, isPM
8
8
  * where hour is in 24hr time and hour12 is in 12hr time.
9
9
  */
10
- declare const getTimeInfoInET: (dateOrTimestamp?: number | Date | undefined) => {
10
+ declare const getTimeInfoInET: (dateOrTimestamp?: Date | number) => {
11
11
  timestamp: number;
12
12
  year: number;
13
13
  month: number;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test file for the getTimeInfoInET helper
3
+ * @author Gabe Abrams
4
+ */
5
+ export {};
@@ -8,5 +8,5 @@
8
8
  * once
9
9
  * @returns array of resolved values in the same order as the task functions
10
10
  */
11
- declare const parallelLimit: (taskFunctions: (() => Promise<any>)[], limit?: number | undefined) => Promise<any[]>;
11
+ declare const parallelLimit: (taskFunctions: (() => Promise<any>)[], limit?: number) => Promise<any[]>;
12
12
  export default parallelLimit;
@@ -0,0 +1,10 @@
1
+ export declare const INVALID_REGEX_ERROR = "input does not follow the requested format";
2
+ export declare const INVALID_EMAIL_ERROR = "Please provide a valid email address.";
3
+ export declare const INVALID_PHONE_ERROR = "Please provide a valid phone number.";
4
+ export declare const INVALID_STRING_ERRORS: {
5
+ MIN_LEN: (minLen: number) => string;
6
+ MAX_LEN: (maxLen: number) => string;
7
+ LETTERS_ONLY: string;
8
+ NUMBERS_ONLY: string;
9
+ MESSAGE_INTRO: string;
10
+ };
@@ -0,0 +1,19 @@
1
+ import ValidationResult from '../types/ValidationResult';
2
+ /**
3
+ * Determines whether a given input string is considered valid based on
4
+ * the provided regex.
5
+ * @author Austen Money
6
+ * @param opts object containing all args
7
+ * @param opts.input user-provided input to validate
8
+ * @param opts.regex regular expression to check against input
9
+ * @param [opts.regexDescription] description of what regexString is checking
10
+ * for, used to customize error message
11
+ * @returns the unchanged input if valid, or a customized error message if
12
+ * invalid
13
+ */
14
+ declare const validateRegex: (opts: {
15
+ input: string;
16
+ regex: RegExp;
17
+ regexDescription?: string;
18
+ }) => ValidationResult<string>;
19
+ export default validateRegex;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Result of a validation function.
3
+ * @author Austen Money
4
+ */
5
+ type ValidationResult<CleanedValueType> = ({
6
+ isValid: true;
7
+ cleanedValue: CleanedValueType;
8
+ } | {
9
+ isValid: false;
10
+ errorMessage: string;
11
+ });
12
+ export default ValidationResult;
@@ -0,0 +1,11 @@
1
+ import ValidationResult from './shared/types/ValidationResult';
2
+ /**
3
+ * Determines whether a given email address is valid.
4
+ * @author Austen Money
5
+ * @param email email address to validate
6
+ * @returns whether email fulfills proper formatting requirements, includes a
7
+ * cleaned version of the address without leading or trailing
8
+ * whitespace if valid or an error message if invalid.
9
+ */
10
+ declare const validateEmail: (email: string) => ValidationResult<string>;
11
+ export default validateEmail;
@@ -0,0 +1,11 @@
1
+ import ValidationResult from './shared/types/ValidationResult';
2
+ /**
3
+ * Determines whether a given phone number is valid.
4
+ * @author Austen Money
5
+ * @param phoneNumber phone number to validate
6
+ * @returns whether phone number is considered valid - if valid, also returns
7
+ * a cleaned version of the number without any formatting. If invalid,
8
+ * returns an error message.
9
+ */
10
+ declare const validatePhoneNumber: (phoneNumber: string) => ValidationResult<string>;
11
+ export default validatePhoneNumber;