dce-reactkit 3.4.0 → 3.5.1-beta.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 (129) hide show
  1. package/.eslintrc.js +2 -0
  2. package/.vscode/settings.json +1 -0
  3. package/dist/cjs/index.js +36372 -191
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/types/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.d.ts +10 -0
  6. package/dist/cjs/types/components/DBEntryManagerPanel/AddOrEditDBEntry/index.d.ts +34 -0
  7. package/dist/cjs/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +9 -0
  8. package/dist/cjs/types/components/DBEntryManagerPanel/index.d.ts +25 -0
  9. package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntry.d.ts +8 -0
  10. package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntryField.d.ts +49 -0
  11. package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntryFieldType.d.ts +12 -0
  12. package/dist/cjs/types/helpers/addDBEditorEndpoints.d.ts +40 -0
  13. package/dist/cjs/types/helpers/canReviewLogs.d.ts +0 -5
  14. package/dist/cjs/types/index.d.ts +6 -1
  15. package/dist/esm/index.js +36587 -427
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/types/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.d.ts +10 -0
  18. package/dist/esm/types/components/DBEntryManagerPanel/AddOrEditDBEntry/index.d.ts +34 -0
  19. package/dist/esm/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +9 -0
  20. package/dist/esm/types/components/DBEntryManagerPanel/index.d.ts +25 -0
  21. package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntry.d.ts +8 -0
  22. package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntryField.d.ts +49 -0
  23. package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntryFieldType.d.ts +12 -0
  24. package/dist/esm/types/helpers/addDBEditorEndpoints.d.ts +40 -0
  25. package/dist/esm/types/helpers/canReviewLogs.d.ts +0 -5
  26. package/dist/esm/types/index.d.ts +6 -1
  27. package/dist/index.d.ts +166 -35
  28. package/package.json +16 -12
  29. package/src/client/initClient.tsx +23 -31
  30. package/src/components/AppWrapper.tsx +1 -1
  31. package/src/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.tsx +303 -0
  32. package/src/components/DBEntryManagerPanel/AddOrEditDBEntry/index.tsx +737 -0
  33. package/src/components/DBEntryManagerPanel/helpers/generateEndpointPath.ts +16 -0
  34. package/src/components/DBEntryManagerPanel/index.tsx +522 -0
  35. package/src/components/DBEntryManagerPanel/types/DBEntry.ts +7 -0
  36. package/src/components/DBEntryManagerPanel/types/DBEntryField.ts +94 -0
  37. package/src/components/DBEntryManagerPanel/types/DBEntryFieldType.ts +18 -0
  38. package/src/components/ItemPicker/index.test.tsx +10 -10
  39. package/src/helpers/addDBEditorEndpoints.ts +128 -0
  40. package/src/helpers/canReviewLogs.ts +0 -20
  41. package/src/helpers/genCSV.ts +2 -5
  42. package/src/helpers/{getOrdinal.ts → getOrdinal.tsx} +0 -1
  43. package/src/index.ts +11 -9
  44. package/tsconfig.json +2 -6
  45. package/dist/cjs/types/helpers/abbreviate.test.d.ts +0 -5
  46. package/dist/cjs/types/helpers/avg.test.d.ts +0 -5
  47. package/dist/cjs/types/helpers/canReviewLogs.test.d.ts +0 -5
  48. package/dist/cjs/types/helpers/ceilToNumDecimals.test.d.ts +0 -5
  49. package/dist/cjs/types/helpers/compareArraysByProp.test.d.ts +0 -5
  50. package/dist/cjs/types/helpers/extractProp.test.d.ts +0 -5
  51. package/dist/cjs/types/helpers/floorToNumDecimals.test.d.ts +0 -5
  52. package/dist/cjs/types/helpers/forceNumIntoBounds.test.d.ts +0 -5
  53. package/dist/cjs/types/helpers/genCSV.test.d.ts +0 -5
  54. package/dist/cjs/types/helpers/genCommaList.d.ts +0 -12
  55. package/dist/cjs/types/helpers/genCommaList.test.d.ts +0 -1
  56. package/dist/cjs/types/helpers/getHumanReadableDate.test.d.ts +0 -5
  57. package/dist/cjs/types/helpers/getLocalTimeInfo.test.d.ts +0 -6
  58. package/dist/cjs/types/helpers/getMonthName.test.d.ts +0 -5
  59. package/dist/cjs/types/helpers/getOrdinal.test.d.ts +0 -5
  60. package/dist/cjs/types/helpers/getPartOfDay.test.d.ts +0 -5
  61. package/dist/cjs/types/helpers/getTimeInfoInET.test.d.ts +0 -5
  62. package/dist/cjs/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +0 -10
  63. package/dist/cjs/types/helpers/validators/shared/helpers/validateRegex.d.ts +0 -19
  64. package/dist/cjs/types/helpers/validators/shared/types/ValidationResult.d.ts +0 -12
  65. package/dist/cjs/types/helpers/validators/validateEmail.d.ts +0 -11
  66. package/dist/cjs/types/helpers/validators/validateEmail.test.d.ts +0 -1
  67. package/dist/cjs/types/helpers/validators/validatePhoneNumber.d.ts +0 -11
  68. package/dist/cjs/types/helpers/validators/validatePhoneNumber.test.d.ts +0 -1
  69. package/dist/cjs/types/helpers/validators/validateString.d.ts +0 -22
  70. package/dist/cjs/types/helpers/validators/validateString.test.d.ts +0 -1
  71. package/dist/esm/types/helpers/abbreviate.test.d.ts +0 -5
  72. package/dist/esm/types/helpers/avg.test.d.ts +0 -5
  73. package/dist/esm/types/helpers/canReviewLogs.test.d.ts +0 -5
  74. package/dist/esm/types/helpers/ceilToNumDecimals.test.d.ts +0 -5
  75. package/dist/esm/types/helpers/compareArraysByProp.test.d.ts +0 -5
  76. package/dist/esm/types/helpers/extractProp.test.d.ts +0 -5
  77. package/dist/esm/types/helpers/floorToNumDecimals.test.d.ts +0 -5
  78. package/dist/esm/types/helpers/forceNumIntoBounds.test.d.ts +0 -5
  79. package/dist/esm/types/helpers/genCSV.test.d.ts +0 -5
  80. package/dist/esm/types/helpers/genCommaList.d.ts +0 -12
  81. package/dist/esm/types/helpers/genCommaList.test.d.ts +0 -1
  82. package/dist/esm/types/helpers/getHumanReadableDate.test.d.ts +0 -5
  83. package/dist/esm/types/helpers/getLocalTimeInfo.test.d.ts +0 -6
  84. package/dist/esm/types/helpers/getMonthName.test.d.ts +0 -5
  85. package/dist/esm/types/helpers/getOrdinal.test.d.ts +0 -5
  86. package/dist/esm/types/helpers/getPartOfDay.test.d.ts +0 -5
  87. package/dist/esm/types/helpers/getTimeInfoInET.test.d.ts +0 -5
  88. package/dist/esm/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +0 -10
  89. package/dist/esm/types/helpers/validators/shared/helpers/validateRegex.d.ts +0 -19
  90. package/dist/esm/types/helpers/validators/shared/types/ValidationResult.d.ts +0 -12
  91. package/dist/esm/types/helpers/validators/validateEmail.d.ts +0 -11
  92. package/dist/esm/types/helpers/validators/validateEmail.test.d.ts +0 -1
  93. package/dist/esm/types/helpers/validators/validatePhoneNumber.d.ts +0 -11
  94. package/dist/esm/types/helpers/validators/validatePhoneNumber.test.d.ts +0 -1
  95. package/dist/esm/types/helpers/validators/validateString.d.ts +0 -22
  96. package/dist/esm/types/helpers/validators/validateString.test.d.ts +0 -1
  97. package/src/helpers/abbreviate.test.ts +0 -26
  98. package/src/helpers/avg.test.ts +0 -24
  99. package/src/helpers/canReviewLogs.test.ts +0 -67
  100. package/src/helpers/ceilToNumDecimals.test.ts +0 -39
  101. package/src/helpers/compareArraysByProp.test.ts +0 -102
  102. package/src/helpers/extractProp.test.ts +0 -34
  103. package/src/helpers/floorToNumDecimals.test.ts +0 -39
  104. package/src/helpers/forceNumIntoBounds.test.ts +0 -34
  105. package/src/helpers/genCSV.test.ts +0 -61
  106. package/src/helpers/genCommaList.test.ts +0 -57
  107. package/src/helpers/genCommaList.ts +0 -21
  108. package/src/helpers/getHumanReadableDate.test.ts +0 -29
  109. package/src/helpers/getLocalTimeInfo.test.ts +0 -48
  110. package/src/helpers/getMonthName.test.ts +0 -79
  111. package/src/helpers/getOrdinal.test.ts +0 -84
  112. package/src/helpers/getPartOfDay.test.ts +0 -56
  113. package/src/helpers/getTimeInfoInET.test.ts +0 -72
  114. package/src/helpers/validators/shared/constants/ERROR_MESSAGES.ts +0 -18
  115. package/src/helpers/validators/shared/helpers/validateRegex.ts +0 -47
  116. package/src/helpers/validators/shared/types/ValidationResult.ts +0 -20
  117. package/src/helpers/validators/validateEmail.test.ts +0 -110
  118. package/src/helpers/validators/validateEmail.ts +0 -47
  119. package/src/helpers/validators/validatePhoneNumber.test.ts +0 -94
  120. package/src/helpers/validators/validatePhoneNumber.ts +0 -49
  121. package/src/helpers/validators/validateString.test.ts +0 -175
  122. package/src/helpers/validators/validateString.ts +0 -171
  123. /package/src/helpers/{abbreviate.ts → abbreviate.tsx} +0 -0
  124. /package/src/helpers/{avg.ts → avg.tsx} +0 -0
  125. /package/src/helpers/{ceilToNumDecimals.ts → ceilToNumDecimals.tsx} +0 -0
  126. /package/src/helpers/{floorToNumDecimals.ts → floorToNumDecimals.tsx} +0 -0
  127. /package/src/helpers/{forceNumIntoBounds.ts → forceNumIntoBounds.tsx} +0 -0
  128. /package/src/helpers/{getLocalTimeInfo.ts → getLocalTimeInfo.tsx} +0 -0
  129. /package/src/helpers/{getTimeInfoInET.ts → getTimeInfoInET.tsx} +0 -0
@@ -512,7 +512,7 @@ const assertExpectedItemsAreChecked = (
512
512
  }
513
513
  };
514
514
 
515
- test.skip(
515
+ test(
516
516
  'All Checkboxes appear when initially rendered',
517
517
  async () => {
518
518
  Raixa.render(
@@ -530,7 +530,7 @@ test.skip(
530
530
  },
531
531
  );
532
532
 
533
- test.skip(
533
+ test(
534
534
  'Collapsing item 3 results in only the first 3 items and item 24 showing',
535
535
  async () => {
536
536
  Raixa.render(
@@ -555,7 +555,7 @@ test.skip(
555
555
  },
556
556
  );
557
557
 
558
- test.skip(
558
+ test(
559
559
  'Collapsing item 15 results hides items 16 through 21',
560
560
  async () => {
561
561
  Raixa.render(
@@ -580,7 +580,7 @@ test.skip(
580
580
  },
581
581
  );
582
582
 
583
- test.skip(
583
+ test(
584
584
  'Collapsing item 10 results hides items 11 through 21',
585
585
  async () => {
586
586
  Raixa.render(
@@ -605,7 +605,7 @@ test.skip(
605
605
  },
606
606
  );
607
607
 
608
- test.skip(
608
+ test(
609
609
  'All Checkboxes are unchecked when initially rendered',
610
610
  async () => {
611
611
  Raixa.render(
@@ -626,7 +626,7 @@ test.skip(
626
626
  },
627
627
  );
628
628
 
629
- test.skip(
629
+ test(
630
630
  'Checking item 1 checks items 1',
631
631
  async () => {
632
632
  let updatedItems: PickableItem[] = [];
@@ -654,7 +654,7 @@ test.skip(
654
654
  },
655
655
  );
656
656
 
657
- test.skip(
657
+ test(
658
658
  'Clicking item 1 unchecks items 1',
659
659
  async () => {
660
660
  let updatedItems: PickableItem[] = [];
@@ -686,7 +686,7 @@ test.skip(
686
686
  },
687
687
  );
688
688
 
689
- test.skip(
689
+ test(
690
690
  'Checking item 3 checks items 3 through 23',
691
691
  async () => {
692
692
  let updatedItems: PickableItem[] = [];
@@ -720,7 +720,7 @@ test.skip(
720
720
  },
721
721
  );
722
722
 
723
- test.skip(
723
+ test(
724
724
  'Clicking folder 3 checks unchecks 3 through 23',
725
725
  async () => {
726
726
  let updatedItems: PickableItem[] = [];
@@ -750,7 +750,7 @@ test.skip(
750
750
  },
751
751
  );
752
752
 
753
- test.skip(
753
+ test(
754
754
  'Clicking dashed folder 3 checks 3 through 23',
755
755
  async () => {
756
756
  let updatedItems: PickableItem[] = [];
@@ -0,0 +1,128 @@
1
+ // Import express
2
+ import express from 'express';
3
+
4
+ // Import shared helpers
5
+ import genRouteHandler from './genRouteHandler';
6
+ import generateEndpointPath from '../components/DBEntryManagerPanel/helpers/generateEndpointPath';
7
+
8
+ // Import shared types
9
+ import ParamType from '../types/ParamType';
10
+
11
+ /**
12
+ * Interface for a collection in the database
13
+ * @author Yuen Ler Chow
14
+ */
15
+ type DCEMangoCollection = {
16
+ /**
17
+ * Find all items in the collection that match the filter query
18
+ * @param filterQuery
19
+ * @returns list of items that match the filter query
20
+ */
21
+ find: (filterQuery: any) => Promise<any[]>,
22
+ /**
23
+ * Insert an item into the collection
24
+ * @param item the item to insert
25
+ */
26
+ insert: (item: any) => Promise<void>,
27
+ /**
28
+ * Delete an item in the collection
29
+ * @param id the id of the item to delete
30
+ */
31
+ delete: (filterQuery: { id: string }) => Promise<void>,
32
+ };
33
+
34
+ /**
35
+ * Add all routes for the DBEditor
36
+ * @author Yuen Ler Chow
37
+ * @param opts object containing all arguments
38
+ * @param opts.app express app to add routes too
39
+ * @param opts.collectionName the name of the collection
40
+ * @param opts.adminsOnly true if the endpoint is for admins only
41
+ * @param opts.collection dce-mango db collection
42
+ */
43
+ const addDBEditorEndpoints = (
44
+ opts: {
45
+ app: express.Application,
46
+ collectionName: string,
47
+ adminsOnly: boolean,
48
+ collection: DCEMangoCollection,
49
+ },
50
+ ) => {
51
+ const {
52
+ app,
53
+ collectionName,
54
+ adminsOnly,
55
+ collection,
56
+ } = opts;
57
+
58
+ // Generate the endpoint path
59
+ const endpointPath = generateEndpointPath(collectionName, adminsOnly);
60
+
61
+ /**
62
+ * List all items in the collection
63
+ * @author Yuen Ler Chow
64
+ * @returns {any[]} the list of items in the collection
65
+ */
66
+ app.get(
67
+ endpointPath,
68
+ genRouteHandler({
69
+ paramTypes: {
70
+ filterQuery: ParamType.JSONOptional,
71
+ },
72
+ handler: async ({ params }) => {
73
+ const filterQuery = params.filterQuery ?? {};
74
+ const categories = await collection.find(filterQuery);
75
+ return categories;
76
+ },
77
+ }),
78
+ );
79
+
80
+ /**
81
+ * Create a new item in the collection
82
+ * @author Yuen Ler Chow
83
+ * @param {any} item the item to create
84
+ */
85
+ app.post(
86
+ endpointPath,
87
+ genRouteHandler({
88
+ paramTypes: {
89
+ item: ParamType.JSON,
90
+ },
91
+ handler: async ({
92
+ params,
93
+ }) => {
94
+ // Destructure params
95
+ const {
96
+ item,
97
+ } = params;
98
+
99
+ await collection.insert(item);
100
+ },
101
+ }),
102
+ );
103
+
104
+ /**
105
+ * Remove an item from the collection by id
106
+ * @author Yuen Ler Chow
107
+ */
108
+ app.delete(
109
+ `${endpointPath}/:id`,
110
+ genRouteHandler({
111
+ paramTypes: {
112
+ id: ParamType.String,
113
+ },
114
+ handler: async ({
115
+ params,
116
+ }) => {
117
+ // Destructure params
118
+ const {
119
+ id,
120
+ } = params;
121
+
122
+ await collection.delete({ id });
123
+ },
124
+ }),
125
+ );
126
+ };
127
+
128
+ export default addDBEditorEndpoints;
@@ -4,29 +4,9 @@ import visitServerEndpoint from './visitServerEndpoint';
4
4
  // Import shared constants
5
5
  import LOG_REVIEW_STATUS_ROUTE from '../constants/LOG_REVIEW_STATUS_ROUTE';
6
6
 
7
- /*------------------------------------------------------------------------*/
8
- /* -------------------------------- Cache ------------------------------- */
9
- /*------------------------------------------------------------------------*/
10
-
11
7
  // Cache user's ability
12
8
  let canReview: boolean | undefined = undefined;
13
9
 
14
- /*------------------------------------------------------------------------*/
15
- /* ---------------------------- Other Helpers --------------------------- */
16
- /*------------------------------------------------------------------------*/
17
-
18
- /**
19
- * Reset the cached version of canReview
20
- * @author Gabe Abrams
21
- */
22
- export const resetCanReviewCache = () => {
23
- canReview = undefined;
24
- };
25
-
26
- /*------------------------------------------------------------------------*/
27
- /* -------------------------------- Main -------------------------------- */
28
- /*------------------------------------------------------------------------*/
29
-
30
10
  /**
31
11
  * Check if the current user can review logs
32
12
  * @author Gabe Abrams
@@ -5,16 +5,13 @@
5
5
  * @returns escaped cell text
6
6
  */
7
7
  const escapeCellText = (text: string): string => {
8
- if (
9
- !String(text).includes(',')
10
- && !String(text).includes('"')
11
- ) {
8
+ if (!String(text).includes(',')) {
12
9
  // No need to escape
13
10
  return String(text);
14
11
  }
15
12
 
16
13
  // Perform escape
17
- return `"${String(text).replace(/"/g, '""')}"`;
14
+ return `"${String(text).replace(/"/g, '""')}`;
18
15
  };
19
16
 
20
17
  /**
@@ -1,4 +1,3 @@
1
- // Constants
2
1
  const ORDINALS = ['th', 'st', 'nd', 'rd'];
3
2
 
4
3
  /**
package/src/index.ts CHANGED
@@ -17,6 +17,7 @@ import ItemPicker from './components/ItemPicker';
17
17
  import LogReviewer from './components/LogReviewer';
18
18
  import IntelliTable from './components/IntelliTable';
19
19
  import CSVDownloadButton from './components/CSVDownloadButton';
20
+ import DBEntryManagerPanel from './components/DBEntryManagerPanel';
20
21
 
21
22
  // Import errors
22
23
  import ErrorWithCode from './errors/ErrorWithCode';
@@ -63,11 +64,8 @@ import canReviewLogs from './helpers/canReviewLogs';
63
64
  import isMobileOrTablet from './helpers/isMobileOrTablet';
64
65
  import extractProp from './helpers/extractProp';
65
66
  import compareArraysByProp from './helpers/compareArraysByProp';
66
- import genCommaList from './helpers/genCommaList';
67
- import validateEmail from './helpers/validators/validateEmail';
68
- import validatePhoneNumber from './helpers/validators/validatePhoneNumber';
69
- import validateString from './helpers/validators/validateString';
70
- import getLocalTimeInfo from './helpers/getLocalTimeInfo';
67
+ import getLocalTimeInfo from './helpers/getLocalTimeInfo';
68
+ import addDBEditorEndpoints from './helpers/addDBEditorEndpoints';
71
69
 
72
70
  // Import types
73
71
  import ModalButtonType from './types/ModalButtonType';
@@ -87,6 +85,9 @@ import IntelliTableColumn from './types/IntelliTableColumn';
87
85
 
88
86
  // Component-specific-types
89
87
  import PickableItem from './components/ItemPicker/types/PickableItem';
88
+ import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
89
+ import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
90
+ import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
90
91
 
91
92
  // Export each item
92
93
  export {
@@ -109,6 +110,7 @@ export {
109
110
  LogReviewer,
110
111
  IntelliTable,
111
112
  CSVDownloadButton,
113
+ DBEntryManagerPanel,
112
114
  // Global functions
113
115
  alert,
114
116
  confirm,
@@ -147,10 +149,6 @@ export {
147
149
  isMobileOrTablet,
148
150
  extractProp,
149
151
  compareArraysByProp,
150
- genCommaList,
151
- validateEmail,
152
- validatePhoneNumber,
153
- validateString,
154
152
  getLocalTimeInfo,
155
153
  // Client helpers
156
154
  initClient,
@@ -162,6 +160,7 @@ export {
162
160
  handleError,
163
161
  handleSuccess,
164
162
  initLogCollection,
163
+ addDBEditorEndpoints,
165
164
  // Types
166
165
  ModalButtonType,
167
166
  ModalSize,
@@ -178,6 +177,9 @@ export {
178
177
  IntelliTableColumn,
179
178
  // Component-specific-types
180
179
  PickableItem,
180
+ DBEntry,
181
+ DBEntryField,
182
+ DBEntryFieldType,
181
183
  // Server types
182
184
  ParamType,
183
185
  };
package/tsconfig.json CHANGED
@@ -15,12 +15,8 @@
15
15
  "allowSyntheticDefaultImports": true,
16
16
  "emitDeclarationOnly": true
17
17
  },
18
+
18
19
  "include": [
19
20
  "./src/**/*"
20
- ],
21
- "ts-node": {
22
- "compilerOptions": {
23
- "module": "commonjs"
24
- }
25
- },
21
+ ]
26
22
  }
@@ -1,5 +0,0 @@
1
- /**
2
- * Unit tests for abbreviate helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Unit tests for avg helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Unit tests for canReviewLogs
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the ceilToNumDecimals helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the compareArraysByProp helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the extractProp helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the floorToNumDecimals helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the forceNumIntoBounds helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the genCSV helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,12 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the getHumanReadableDate helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,6 +0,0 @@
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 {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test for getMonthName helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the getOrdinal helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the getPartOfDay helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the getTimeInfoInET helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,10 +0,0 @@
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
- };
@@ -1,19 +0,0 @@
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;
@@ -1,12 +0,0 @@
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;
@@ -1,11 +0,0 @@
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;
@@ -1,11 +0,0 @@
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;
@@ -1,22 +0,0 @@
1
- import ValidationResult from './shared/types/ValidationResult';
2
- /**
3
- * Determines whether a given input string is considered valid based on
4
- * the provided requirements.
5
- * @author Austen Money
6
- * @param input input string
7
- * @param opts options for validation
8
- * @returns whether input is considered valid according to reqs - if
9
- * valid, returns a cleaned version of input; if invalid, returns
10
- * a string containing error messages describing which requirements
11
- * were not met.
12
- */
13
- declare const validateString: (input: string, opts: {
14
- ignoreWhitespace?: boolean;
15
- minLen?: number;
16
- maxLen?: number;
17
- lettersOnly?: boolean;
18
- numbersOnly?: boolean;
19
- regexTest?: RegExp;
20
- regexDescription?: string;
21
- }) => ValidationResult<string>;
22
- export default validateString;
@@ -1,5 +0,0 @@
1
- /**
2
- * Unit tests for abbreviate helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Unit tests for avg helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Unit tests for canReviewLogs
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the ceilToNumDecimals helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the compareArraysByProp helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the extractProp helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the floorToNumDecimals helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the forceNumIntoBounds helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the genCSV helper
3
- * @author Gabe Abrams
4
- */
5
- export {};
@@ -1,12 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Test file for the getHumanReadableDate helper
3
- * @author Gabe Abrams
4
- */
5
- export {};