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.
- package/.eslintrc.js +0 -2
- package/dist/cjs/index.js +320 -27
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/client/initClient.d.ts +1 -1
- package/dist/cjs/types/components/AppWrapper.d.ts +6 -6
- package/dist/cjs/types/components/ButtonInputGroup.d.ts +1 -1
- package/dist/cjs/types/components/CSVDownloadButton.d.ts +1 -1
- package/dist/cjs/types/components/CheckboxButton.d.ts +1 -1
- package/dist/cjs/types/components/CopiableBox.d.ts +1 -1
- package/dist/cjs/types/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.d.ts +7 -1
- package/dist/cjs/types/components/DBEntryManagerPanel/AddOrEditDBEntry/index.d.ts +5 -4
- package/dist/cjs/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +1 -1
- package/dist/cjs/types/components/DBEntryManagerPanel/index.d.ts +13 -2
- package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntry.d.ts +1 -1
- package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntryField.d.ts +1 -1
- package/dist/cjs/types/components/Drawer.d.ts +1 -1
- package/dist/cjs/types/components/ErrorBox.d.ts +1 -1
- package/dist/cjs/types/components/IntelliTable.d.ts +1 -1
- package/dist/cjs/types/components/ItemPicker/NestableItemList.d.ts +1 -1
- package/dist/cjs/types/components/ItemPicker/index.d.ts +1 -1
- package/dist/cjs/types/components/ItemPicker/types/PickableItem.d.ts +1 -1
- package/dist/cjs/types/components/LogReviewer.d.ts +1 -1
- package/dist/cjs/types/components/Modal.d.ts +1 -1
- package/dist/cjs/types/components/PopFailureMark.d.ts +1 -1
- package/dist/cjs/types/components/PopPendingMark.d.ts +1 -1
- package/dist/cjs/types/components/PopSuccessMark.d.ts +1 -1
- package/dist/cjs/types/components/RadioButton.d.ts +1 -1
- package/dist/cjs/types/components/SimpleDateChooser.d.ts +1 -1
- package/dist/cjs/types/components/TabBox.d.ts +1 -1
- package/dist/cjs/types/helpers/abbreviate.test.d.ts +5 -0
- package/dist/cjs/types/helpers/addDBEditorEndpoints.d.ts +4 -3
- package/dist/cjs/types/helpers/avg.test.d.ts +5 -0
- package/dist/cjs/types/helpers/canReviewLogs.d.ts +5 -0
- package/dist/cjs/types/helpers/canReviewLogs.test.d.ts +5 -0
- package/dist/cjs/types/helpers/ceilToNumDecimals.test.d.ts +5 -0
- package/dist/cjs/types/helpers/compareArraysByProp.d.ts +3 -2
- package/dist/cjs/types/helpers/compareArraysByProp.test.d.ts +5 -0
- package/dist/cjs/types/helpers/extractProp.test.d.ts +5 -0
- package/dist/cjs/types/helpers/floorToNumDecimals.test.d.ts +5 -0
- package/dist/cjs/types/helpers/forceNumIntoBounds.test.d.ts +5 -0
- package/dist/cjs/types/helpers/genCSV.test.d.ts +5 -0
- package/dist/cjs/types/helpers/genCommaList.d.ts +12 -0
- package/dist/cjs/types/helpers/genCommaList.test.d.ts +1 -0
- package/dist/cjs/types/helpers/genRouteHandler.d.ts +7 -7
- package/dist/cjs/types/helpers/getHumanReadableDate.d.ts +1 -1
- package/dist/cjs/types/helpers/getHumanReadableDate.test.d.ts +5 -0
- package/dist/cjs/types/helpers/getLocalTimeInfo.d.ts +1 -1
- package/dist/cjs/types/helpers/getLocalTimeInfo.test.d.ts +6 -0
- package/dist/cjs/types/helpers/getMonthName.test.d.ts +5 -0
- package/dist/cjs/types/helpers/getOrdinal.test.d.ts +5 -0
- package/dist/cjs/types/helpers/getPartOfDay.test.d.ts +5 -0
- package/dist/cjs/types/helpers/getTimeInfoInET.d.ts +1 -1
- package/dist/cjs/types/helpers/getTimeInfoInET.test.d.ts +5 -0
- package/dist/cjs/types/helpers/parallelLimit.d.ts +1 -1
- package/dist/cjs/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +10 -0
- package/dist/cjs/types/helpers/validators/shared/helpers/validateRegex.d.ts +19 -0
- package/dist/cjs/types/helpers/validators/shared/types/ValidationResult.d.ts +12 -0
- package/dist/cjs/types/helpers/validators/validateEmail.d.ts +11 -0
- package/dist/cjs/types/helpers/validators/validateEmail.test.d.ts +1 -0
- package/dist/cjs/types/helpers/validators/validatePhoneNumber.d.ts +11 -0
- package/dist/cjs/types/helpers/validators/validatePhoneNumber.test.d.ts +1 -0
- package/dist/cjs/types/helpers/validators/validateString.d.ts +22 -0
- package/dist/cjs/types/helpers/validators/validateString.test.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +5 -1
- package/dist/cjs/types/server/initServer.d.ts +1 -1
- package/dist/cjs/types/types/IntelliTableColumn.d.ts +1 -1
- package/dist/cjs/types/types/Log/LogMainInfo.d.ts +1 -1
- package/dist/cjs/types/types/Log/LogSourceSpecificInfo.d.ts +1 -1
- package/dist/cjs/types/types/Log/LogTypeSpecificInfo.d.ts +1 -1
- package/dist/cjs/types/types/Log/index.d.ts +1 -1
- package/dist/cjs/types/types/LogFunction.d.ts +1 -1
- package/dist/cjs/types/types/LogMetadataContextMap.d.ts +1 -1
- package/dist/cjs/types/types/LogMetadataTagMap.d.ts +1 -1
- package/dist/cjs/types/types/LogMetadataTargetMap.d.ts +1 -1
- package/dist/cjs/types/types/LogMetadataType.d.ts +1 -1
- package/dist/esm/index.js +317 -28
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/client/initClient.d.ts +1 -1
- package/dist/esm/types/components/AppWrapper.d.ts +6 -6
- package/dist/esm/types/components/ButtonInputGroup.d.ts +1 -1
- package/dist/esm/types/components/CSVDownloadButton.d.ts +1 -1
- package/dist/esm/types/components/CheckboxButton.d.ts +1 -1
- package/dist/esm/types/components/CopiableBox.d.ts +1 -1
- package/dist/esm/types/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.d.ts +7 -1
- package/dist/esm/types/components/DBEntryManagerPanel/AddOrEditDBEntry/index.d.ts +5 -4
- package/dist/esm/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +1 -1
- package/dist/esm/types/components/DBEntryManagerPanel/index.d.ts +13 -2
- package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntry.d.ts +1 -1
- package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntryField.d.ts +1 -1
- package/dist/esm/types/components/Drawer.d.ts +1 -1
- package/dist/esm/types/components/ErrorBox.d.ts +1 -1
- package/dist/esm/types/components/IntelliTable.d.ts +1 -1
- package/dist/esm/types/components/ItemPicker/NestableItemList.d.ts +1 -1
- package/dist/esm/types/components/ItemPicker/index.d.ts +1 -1
- package/dist/esm/types/components/ItemPicker/types/PickableItem.d.ts +1 -1
- package/dist/esm/types/components/LogReviewer.d.ts +1 -1
- package/dist/esm/types/components/Modal.d.ts +1 -1
- package/dist/esm/types/components/PopFailureMark.d.ts +1 -1
- package/dist/esm/types/components/PopPendingMark.d.ts +1 -1
- package/dist/esm/types/components/PopSuccessMark.d.ts +1 -1
- package/dist/esm/types/components/RadioButton.d.ts +1 -1
- package/dist/esm/types/components/SimpleDateChooser.d.ts +1 -1
- package/dist/esm/types/components/TabBox.d.ts +1 -1
- package/dist/esm/types/helpers/abbreviate.test.d.ts +5 -0
- package/dist/esm/types/helpers/addDBEditorEndpoints.d.ts +4 -3
- package/dist/esm/types/helpers/avg.test.d.ts +5 -0
- package/dist/esm/types/helpers/canReviewLogs.d.ts +5 -0
- package/dist/esm/types/helpers/canReviewLogs.test.d.ts +5 -0
- package/dist/esm/types/helpers/ceilToNumDecimals.test.d.ts +5 -0
- package/dist/esm/types/helpers/compareArraysByProp.d.ts +3 -2
- package/dist/esm/types/helpers/compareArraysByProp.test.d.ts +5 -0
- package/dist/esm/types/helpers/extractProp.test.d.ts +5 -0
- package/dist/esm/types/helpers/floorToNumDecimals.test.d.ts +5 -0
- package/dist/esm/types/helpers/forceNumIntoBounds.test.d.ts +5 -0
- package/dist/esm/types/helpers/genCSV.test.d.ts +5 -0
- package/dist/esm/types/helpers/genCommaList.d.ts +12 -0
- package/dist/esm/types/helpers/genCommaList.test.d.ts +1 -0
- package/dist/esm/types/helpers/genRouteHandler.d.ts +7 -7
- package/dist/esm/types/helpers/getHumanReadableDate.d.ts +1 -1
- package/dist/esm/types/helpers/getHumanReadableDate.test.d.ts +5 -0
- package/dist/esm/types/helpers/getLocalTimeInfo.d.ts +1 -1
- package/dist/esm/types/helpers/getLocalTimeInfo.test.d.ts +6 -0
- package/dist/esm/types/helpers/getMonthName.test.d.ts +5 -0
- package/dist/esm/types/helpers/getOrdinal.test.d.ts +5 -0
- package/dist/esm/types/helpers/getPartOfDay.test.d.ts +5 -0
- package/dist/esm/types/helpers/getTimeInfoInET.d.ts +1 -1
- package/dist/esm/types/helpers/getTimeInfoInET.test.d.ts +5 -0
- package/dist/esm/types/helpers/parallelLimit.d.ts +1 -1
- package/dist/esm/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +10 -0
- package/dist/esm/types/helpers/validators/shared/helpers/validateRegex.d.ts +19 -0
- package/dist/esm/types/helpers/validators/shared/types/ValidationResult.d.ts +12 -0
- package/dist/esm/types/helpers/validators/validateEmail.d.ts +11 -0
- package/dist/esm/types/helpers/validators/validateEmail.test.d.ts +1 -0
- package/dist/esm/types/helpers/validators/validatePhoneNumber.d.ts +11 -0
- package/dist/esm/types/helpers/validators/validatePhoneNumber.test.d.ts +1 -0
- package/dist/esm/types/helpers/validators/validateString.d.ts +22 -0
- package/dist/esm/types/helpers/validators/validateString.test.d.ts +1 -0
- package/dist/esm/types/index.d.ts +5 -1
- package/dist/esm/types/server/initServer.d.ts +1 -1
- package/dist/esm/types/types/IntelliTableColumn.d.ts +1 -1
- package/dist/esm/types/types/Log/LogMainInfo.d.ts +1 -1
- package/dist/esm/types/types/Log/LogSourceSpecificInfo.d.ts +1 -1
- package/dist/esm/types/types/Log/LogTypeSpecificInfo.d.ts +1 -1
- package/dist/esm/types/types/Log/index.d.ts +1 -1
- package/dist/esm/types/types/LogFunction.d.ts +1 -1
- package/dist/esm/types/types/LogMetadataContextMap.d.ts +1 -1
- package/dist/esm/types/types/LogMetadataTagMap.d.ts +1 -1
- package/dist/esm/types/types/LogMetadataTargetMap.d.ts +1 -1
- package/dist/esm/types/types/LogMetadataType.d.ts +1 -1
- package/dist/index.d.ts +134 -56
- package/package.json +14 -13
- package/src/components/ItemPicker/index.test.tsx +10 -10
- package/src/helpers/abbreviate.test.ts +26 -0
- package/src/helpers/avg.test.ts +24 -0
- package/src/helpers/canReviewLogs.test.ts +67 -0
- package/src/helpers/canReviewLogs.ts +20 -0
- package/src/helpers/ceilToNumDecimals.test.ts +39 -0
- package/src/helpers/compareArraysByProp.test.ts +147 -0
- package/src/helpers/compareArraysByProp.ts +41 -22
- package/src/helpers/extractProp.test.ts +34 -0
- package/src/helpers/floorToNumDecimals.test.ts +39 -0
- package/src/helpers/forceNumIntoBounds.test.ts +34 -0
- package/src/helpers/genCSV.test.ts +61 -0
- package/src/helpers/genCSV.ts +5 -2
- package/src/helpers/genCommaList.test.ts +57 -0
- package/src/helpers/genCommaList.ts +21 -0
- package/src/helpers/getHumanReadableDate.test.ts +29 -0
- package/src/helpers/getLocalTimeInfo.test.ts +48 -0
- package/src/helpers/getMonthName.test.ts +79 -0
- package/src/helpers/getOrdinal.test.ts +84 -0
- package/src/helpers/{getOrdinal.tsx → getOrdinal.ts} +1 -0
- package/src/helpers/getPartOfDay.test.ts +56 -0
- package/src/helpers/getTimeInfoInET.test.ts +72 -0
- package/src/helpers/validators/shared/constants/ERROR_MESSAGES.ts +18 -0
- package/src/helpers/validators/shared/helpers/validateRegex.ts +47 -0
- package/src/helpers/validators/shared/types/ValidationResult.ts +20 -0
- package/src/helpers/validators/validateEmail.test.ts +110 -0
- package/src/helpers/validators/validateEmail.ts +47 -0
- package/src/helpers/validators/validatePhoneNumber.test.ts +94 -0
- package/src/helpers/validators/validatePhoneNumber.ts +49 -0
- package/src/helpers/validators/validateString.test.ts +173 -0
- package/src/helpers/validators/validateString.ts +171 -0
- package/src/index.ts +8 -0
- package/tsconfig.json +6 -2
- /package/src/helpers/{abbreviate.tsx → abbreviate.ts} +0 -0
- /package/src/helpers/{avg.tsx → avg.ts} +0 -0
- /package/src/helpers/{ceilToNumDecimals.tsx → ceilToNumDecimals.ts} +0 -0
- /package/src/helpers/{floorToNumDecimals.tsx → floorToNumDecimals.ts} +0 -0
- /package/src/helpers/{forceNumIntoBounds.tsx → forceNumIntoBounds.ts} +0 -0
- /package/src/helpers/{getLocalTimeInfo.tsx → getLocalTimeInfo.ts} +0 -0
- /package/src/helpers/{getTimeInfoInET.tsx → getTimeInfoInET.ts} +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import Variant from '../types/Variant';
|
|
8
|
-
|
|
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
|
|
36
|
-
confirmButtonVariant?: Variant
|
|
37
|
-
cancelButtonText?: string
|
|
38
|
-
cancelButtonVariant?: Variant
|
|
39
|
-
}
|
|
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
|
package/dist/cjs/types/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -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
|
-
|
|
10
|
+
type Props = {
|
|
11
11
|
type?: ModalType;
|
|
12
12
|
size?: ModalSize;
|
|
13
13
|
title?: React.ReactNode;
|
|
@@ -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
|
-
|
|
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:
|
|
39
|
+
collection: DCEMangoCollection;
|
|
39
40
|
}) => void;
|
|
40
41
|
export default addDBEditorEndpoints;
|
|
@@ -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,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
|
|
36
|
+
send: (text: string, status?: number) => void;
|
|
37
37
|
renderErrorPage: (opts?: {
|
|
38
|
-
title?: string
|
|
39
|
-
description?: string
|
|
40
|
-
code?: string
|
|
41
|
-
pageTitle?: string
|
|
42
|
-
status?: number
|
|
43
|
-
}
|
|
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?:
|
|
7
|
+
declare const getHumanReadableDate: (dateOrTimestamp?: Date | number) => string;
|
|
8
8
|
export default getHumanReadableDate;
|
|
@@ -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?:
|
|
9
|
+
declare const getLocalTimeInfo: (dateOrTimestamp?: Date | number) => {
|
|
10
10
|
timestamp: number;
|
|
11
11
|
year: number;
|
|
12
12
|
month: number;
|
|
@@ -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?:
|
|
10
|
+
declare const getTimeInfoInET: (dateOrTimestamp?: Date | number) => {
|
|
11
11
|
timestamp: number;
|
|
12
12
|
year: number;
|
|
13
13
|
month: number;
|
|
@@ -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
|
|
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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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;
|